Commit 00b68203 authored by Simon Daron's avatar Simon Daron
Browse files

News rework, nav & archives @fred todo search & categories

parent be05aef8
......@@ -29,8 +29,9 @@ def audio(context, sound=None):
}
@register.inclusion_tag('news/nav.html', takes_context=True)
def news_nav(context, date=None):
def news_nav(context, date=None, klass=None):
return {
'class': klass,
'newsitem': context.get('newsitem'),
'categories': context.get('categories'),
'news': context.get('news'),
......
......@@ -18,10 +18,12 @@ urlpatterns = patterns('',
url(r'^emissions/(?P<slug>[\w,-]+)/episodes$', 'panikweb.views.emissionEpisodes', name='emissionEpisodes'),
url(r'^emissions/(?P<slug>[\w,-]+)/$', 'panikweb.views.emission', name='emission-view'),
url(r'^ckeditor/', include('ckeditor.urls')),
url(r'^archives$', 'panikweb.views.archives', name='archives'),
url(r'^emissions/archives$', 'panikweb.views.emissionsArchives', name='emissionsArchives'),
url(r'^get$', 'panikweb.views.get', name='get'),
url(r'^listen$', 'panikweb.views.listen', name='listen'),
url(r'^listen/archives$', 'panikweb.views.listen', name='listen-archives'),
url(r'^news/$', 'panikweb.views.news', name='news'),
url(r'^news/archives$', 'panikweb.views.newsArchives', name='newsArchives'),
url(r'^news/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitemview', name='news-view'),
url(r'^search/', 'panikweb.search.view', name='search'),
......
......@@ -375,7 +375,7 @@ class Home(TemplateView):
def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['sectionName'] = "Home"
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:6])
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:9])
context['emissions'] = list(Emission.objects.filter(archived=False).order_by('title'))
schedules = Schedule.objects.select_related().order_by('datetime')
days = []
......@@ -414,8 +414,7 @@ class NewsItemView(DetailView):
def get_context_data(self, **kwargs):
context = super(NewsItemView, self).get_context_data(**kwargs)
context['sectionName'] = "News"
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:6])
context['newsAll'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:9])
context['categories'] = NewsCategory.objects.all()
return context
newsitemview = NewsItemView.as_view()
......@@ -425,14 +424,25 @@ class News(TemplateView):
def get_context_data(self, **kwargs):
context = super(News, self).get_context_data(**kwargs)
context['sectionName'] = "News"
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:6])
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:9])
context['news'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[3:45])
context['newsAll'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['categories'] = NewsCategory.objects.all()
return context
news = News.as_view()
class NewsArchives(TemplateView):
template_name = 'news/archives.html'
def get_context_data(self, **kwargs):
context = super(NewsArchives, self).get_context_data(**kwargs)
context['sectionName'] = "News"
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:6])
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[0:60])
context['categories'] = NewsCategory.objects.all()
return context
newsArchives = NewsArchives.as_view()
class Emissions(TemplateView):
template_name = 'emissions.html'
......@@ -445,15 +455,14 @@ class Emissions(TemplateView):
emissions = Emissions.as_view()
class Archives(TemplateView):
template_name = 'archives.html'
class emissionsArchives(TemplateView):
template_name = 'emissions/archives.html'
def get_context_data(self, **kwargs):
context = super(Archives, self).get_context_data(**kwargs)
context = super(emissionsArchives, self).get_context_data(**kwargs)
context['sectionName'] = "Emissions"
context['emissions'] = Emission.objects.prefetch_related('categories').filter(archived=True).order_by('title')
return context
archives = Archives.as_view()
emissionsArchives = emissionsArchives.as_view()
class Get(TemplateView):
template_name = 'get.html'
......
{% extends "emissions.html" %}
{% load paniktags %}
{% block bodyID %}Emissions{% endblock %}
{% block title %}Archives{% endblock %}
{% block nav %}
{% emission_nav with klass="archives" %}
{% endblock %}
......@@ -14,7 +14,7 @@
<span class="icon-th-large" ></span>
<span class="iconLabel">La grille</span>
</a></li>
<li><a href="{% url 'archives' %}" class="{% if class = "archives" %}active{% endif %}">
<li><a href="{% url 'emissionsArchives' %}" class="{% if class = "archives" %}active{% endif %}">
<span class="icon-archive" ></span>
<span class="iconLabel">Archives</span>
</a></li>
......
......@@ -2,8 +2,9 @@
{% load paniktags %}
{% block title %}News{% endblock %}
{% block nav %}
{% news_nav %}
{% with focus as news %}
{% news_nav %}
{% newsroll %}
{% endwith %}
{% endblock %}
{% block main %}
......
{% load thumbnails %}
{% load staticfiles %}
<div class="content content-inline inline cf {{ class }}">
<a class="block cf" href="{% url 'news-view' slug=content.slug %}">
{% if content.image %}
{% if class == "special" %}
{% if class == "special" and content.image %}
<img class="logo" src="{{ content.image|thumbnail:'320x240' }}"/>
{% else %}
{% elif content.image %}
<img class="logo left" src="{{ content.image|thumbnail:'60x60' }}"/>
{% endif %}
{% else %}
<img class="logo left" width="60" height="60" src="{% static "img/defaultLogo.png" %}"/>
{% endif %}
{% if content.datetime %}
<div class="label smooth {% if class == "special" %}center marged {% endif %}">{{ content.datetime|date:"D m/M" }}</div>
<div class="smooth {% if class == "special" %}center marged {% endif %}">{{ content.datetime|date:"D m/M" }}</div>
{% endif %}
<div class="content">
<h5 class="title {% if not class %}ellipsis{% endif %}">{{ content.title }}</h5>
......
{% load paniktags %}
<!--
TODO make requests to load specific news roll & compagnie from groups
-->
<div class="wrapper">
<nav>
<ul class="inline padded">
<li><a href="{% url 'news' %}" class="{% if class != "archives" %}active{% endif %}">
<span class="iconLabel">Dernières</span>
<span class="icon-bolt" ></span>
<span class="iconLabel">Dernières</span>
</a></li>
<li><a href="{% url 'archives' %}" class="{% if class = "archives" %}active{% endif %}">
<li><a href="{% url 'newsArchives' %}" class="{% if class = "archives" %}active{% endif %}">
<span class="icon-archive" ></span>
<span class="iconLabel">Archives</span>
</a></li>
</ul>
</nav>
</div>
<!--
TODO make requests to load specific news roll & compagnie from groups
<div class="wrapper">
{% if categories %}
<nav id="newsNav" class="checkable">
......@@ -27,4 +27,4 @@ TODO make requests to load specific news roll & compagnie from groups
</nav>
{% endif %}
</div>
{% newsroll %}
-->
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment