Commit aa60c70c authored by Simon Daron's avatar Simon Daron

Give archived a separate view

parent 5c332103
......@@ -17,6 +17,7 @@ urlpatterns = patterns('',
url(r'^emissions/(?P<slug>[\w,-]+)/$', 'panikweb.views.emission', name='emission-view'),
url(r'^emissions/(?P<emission_slug>[\w,-]+)/(?P<slug>[\w,-]+)/$', 'panikweb.views.episode', name='episode-view'),
url(r'^ckeditor/', include('ckeditor.urls')),
url(r'^archives$', 'panikweb.views.archives', name='archives'),
url(r'^get$', 'panikweb.views.get', name='get'),
url(r'^listen$', 'panikweb.views.listen', name='listen'),
url(r'^news/$', 'panikweb.views.news', name='news'),
......
......@@ -396,12 +396,22 @@ class Emissions(TemplateView):
def get_context_data(self, **kwargs):
context = super(Emissions, self).get_context_data(**kwargs)
context['sectionName'] = "emissions"
context['emissions'] = Emission.objects.all().order_by('title')
context['emissions'] = Emission.objects.all().filter(archived=False).order_by('title')
context['categories'] = Category.objects.all()
return context
emissions = Emissions.as_view()
class Archives(TemplateView):
template_name = 'archives.html'
def get_context_data(self, **kwargs):
context = super(Archives, self).get_context_data(**kwargs)
context['sectionName'] = "emissions"
context['emissions'] = Emission.objects.all().filter(archived=True).order_by('title')
return context
archives = Archives.as_view()
class Get(TemplateView):
template_name = 'get.html'
def get_context_data(self, **kwargs):
......
......@@ -170,6 +170,18 @@ $(function() {
$('[data-highlight].icon-check-empty').each(function(){
$(this).trigger('uncheck');
});
$('[data-toggle]').on('check',function(){
$($(this).attr('data-about')).find($(this).attr('data-toggle')).show();
}).on('uncheck',function(){
$($(this).attr('data-about')).find($(this).attr('data-toggle')).hide();
}).on('click',function(){
$(this).toggleClass('icon-check icon-check-empty');
if($(this).hasClass('icon-check')){$(this).trigger('check');
}else{ $(this).trigger('uncheck');}
});
$('[data-toggle].icon-check-empty').each(function(){
$(this).trigger('uncheck');
});
/*
$('[data-highlight].icon-check').each(function(){
$(this).trigger('check');
......
<nav>
<ul class="inline">
<li><a href="{% url 'emissions' %}" class="{% if class != "program" and class != "grid" %}active{% endif %}">
<li><a href="{% url 'emissions' %}" class="{% if class != "program" and class != "grid" and class != "archives" %}active{% endif %}">
<span class="icon-microphone" ></span>
<span class="iconLabel">Emissions</span>
</a></li>
......@@ -12,6 +12,10 @@
<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 %}">
<span class="icon-archive" ></span>
<span class="iconLabel">Archives</span>
</a></li>
</ul>
</nav>
{% if categories %}
......@@ -20,14 +24,13 @@
{% if class = "grid" %}
<li><button class="check icon-check-empty" data-about="#Main" data-highlight=".nonstop">Non-stop</button></li>
{% elif class = "emissions" %}
<li><button class="check icon-check" data-about="#Main" data-highlight=".nocat">?</button></li>
<li><button class="check icon-check-empty" data-about="#Main" data-highlight=".archived">Archives</button></li>
<li><button class="check icon-check" data-about="#Main" data-toggle=".nocat">?</button></li>
{% endif %}
{% for category in categories %}
{% if class = "grid" %}
<li><button class="check icon-check-empty" data-about="#Main" data-highlight=".{{ category|slugify }}">{{ category }}</button></li>
{% else %}
<li><button class="check icon-check" data-about="#Main" data-highlight=".{{ category|slugify }}">{{ category }}</button></li>
<li><button class="check icon-check" data-about="#Main" data-toggle=".{{ category|slugify }}">{{ category }}</button></li>
{% endif %}
{% endfor %}
</ul>
......@@ -47,12 +50,12 @@
<ul class="distributed">
<li>
<button data-tab="#Emission-tabs-default" class="active" >
<span class="iconLabel">A propos</span>
<span class="iconLabel">En bref</span>
</button>
</li>
<li>
<button data-tab="#Emission-tabs-episodes">
<span class="iconLabel">Archives</span>
<span class="iconLabel">Episodes</span>
</button >
</li>
</ul>
......
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