Commit 2144f89b authored by Simon Daron's avatar Simon Daron

Fusion grid/program/emission

parent ad42e4fc
...@@ -31,8 +31,10 @@ def news_nav(context, date=None): ...@@ -31,8 +31,10 @@ def news_nav(context, date=None):
} }
@register.inclusion_tag('emissions/nav.html', takes_context=True) @register.inclusion_tag('emissions/nav.html', takes_context=True)
def emission_nav(context, date=None): def emission_nav(context, date=None, klass=None):
return { return {
'class': klass,
'categories': context.get('categories'),
'episodes': context.get('episodes'), 'episodes': context.get('episodes'),
'emission': context.get('emission'), 'emission': context.get('emission'),
'episode': context.get('episode'), 'episode': context.get('episode'),
...@@ -62,6 +64,13 @@ def emission_detail(context, date=None): ...@@ -62,6 +64,13 @@ def emission_detail(context, date=None):
'schedules': context.get('schedules'), 'schedules': context.get('schedules'),
} }
@register.inclusion_tag('emissions/resume.html', takes_context=True)
def emission_resume(context, date=None):
return {
'emission': context.get('emission'),
'schedules': context.get('schedules'),
}
@register.inclusion_tag('includes/player.html', takes_context=False) @register.inclusion_tag('includes/player.html', takes_context=False)
def player(): def player():
return {'unique': uuid.uuid4()} return {'unique': uuid.uuid4()}
......
...@@ -10,8 +10,8 @@ admin.autodiscover() ...@@ -10,8 +10,8 @@ admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', 'panikweb.views.home', name='home'), url(r'^$', 'panikweb.views.home', name='home'),
url(r'^onair.json$', 'panikweb.views.onair', name='onair'), url(r'^onair.json$', 'panikweb.views.onair', name='onair'),
url(r'^program$', 'panikweb.views.program', name='program'), url(r'^program/$', 'panikweb.views.program', name='program'),
url(r'^(?P<year>\d{4})/(?P<week>\d+)/$', 'panikweb.views.week', name='program_week'), url(r'^program/(?P<year>\d{4})/(?P<week>\d+)/$', 'panikweb.views.program', name='program_week'),
url(r'^grid$', 'panikweb.views.grid', name='grid'), url(r'^grid$', 'panikweb.views.grid', name='grid'),
url(r'^emissions/$', 'panikweb.views.emissions', name='emissions'), url(r'^emissions/$', 'panikweb.views.emissions', name='emissions'),
url(r'^emissions/(?P<slug>[\w,-]+)/$', 'panikweb.views.emission', name='emission-view'), url(r'^emissions/(?P<slug>[\w,-]+)/$', 'panikweb.views.emission', name='emission-view'),
......
...@@ -85,10 +85,11 @@ class EpisodeDetailView(DetailView): ...@@ -85,10 +85,11 @@ class EpisodeDetailView(DetailView):
return context return context
episode = EpisodeDetailView.as_view() episode = EpisodeDetailView.as_view()
class ProgramView(TemplateView): class ProgramView(TemplateView):
template_name = 'program.html' template_name = 'program.html'
def get_context_data(self, **kwargs): def get_context_data(self, year=None, week=None, **kwargs):
context = super(ProgramView, self).get_context_data(**kwargs) context = super(ProgramView, self).get_context_data(**kwargs)
schedules = Schedule.objects.select_related().order_by('datetime') schedules = Schedule.objects.select_related().order_by('datetime')
days = [] days = []
...@@ -96,22 +97,13 @@ class ProgramView(TemplateView): ...@@ -96,22 +97,13 @@ class ProgramView(TemplateView):
days.append({'schedules': [x for x in schedules if x.is_on_weekday(day+1)], days.append({'schedules': [x for x in schedules if x.is_on_weekday(day+1)],
'datetime': datetime(2007, 1, day+1)}) 'datetime': datetime(2007, 1, day+1)})
context['days'] = days context['days'] = days
context['weekday'] = datetime.today().weekday()
context['week'] = week if week else datetime.today().isocalendar()[1]-1
context['year'] = year = year if year else datetime.today().year
return context return context
program = ProgramView.as_view() program = ProgramView.as_view()
class ProgramWeekView(TemplateView):
template_name = 'week.html'
def get_context_data(self, year, week, **kwargs):
context = super(ProgramWeekView, self).get_context_data(**kwargs)
context['week'] = week
context['year'] = year
return context
week = ProgramWeekView.as_view()
class TimeCell: class TimeCell:
nonstop = None nonstop = None
w = 1 w = 1
......
...@@ -27,10 +27,9 @@ $(function() { ...@@ -27,10 +27,9 @@ $(function() {
According to this link the probles is that $(html).filter('body').Attr('id') will not work! According to this link the probles is that $(html).filter('body').Attr('id') will not work!
http://www.devnetwork.net/viewtopic.php?f=13&t=117065 http://www.devnetwork.net/viewtopic.php?f=13&t=117065
*/ */
var bodyID = html.match(/<body id="(.*?)">/)[1].trim(); var bodyID = html.match(/<body id="(.*?)">/);
$('body').attr('id',bodyID); if(bodyID){$('body').attr('id',bodyID[1].trim());}
$('html, body').animate({scrollTop: $main.offset().top-$('#metaNav').height()+2}, 500); $('html, body').animate({scrollTop: $main.offset().top-$('#metaNav').height()+2}, 500);
$("a, area, form").removeClass('loading');
init(); init();
}; };
...@@ -46,9 +45,8 @@ $(function() { ...@@ -46,9 +45,8 @@ $(function() {
loadPage_request = $.get(href, null, afterLoad); loadPage_request = $.get(href, null, afterLoad);
}; };
init = function() { init = function() {
$("a, area, form").removeClass('loading'); $("#All a, #All area, #All form").removeClass('loading');
$("a, area").unbind('click').on('click',function() { $("#All a, #All area").unbind('click').on('click',function() {
$("a, area, form").removeClass('loading');
$(this).addClass('loading'); $(this).addClass('loading');
var href = $(this).attr("href"); var href = $(this).attr("href");
/* this checks the link points to a local document, be /* this checks the link points to a local document, be
...@@ -60,11 +58,11 @@ $(function() { ...@@ -60,11 +58,11 @@ $(function() {
return false; return false;
}else{ }else{
$(this).attr('target','_blanck'); $(this).attr('target','_blanck');
$("#All a, #All area, #All form").removeClass('loading');
return true; return true;
} }
}); });
$("#search-form").unbind('submit').on('submit', function(event) { $("#search-form").unbind('submit').on('submit', function(event) {
$("a, area, form").removeClass('loading');
event.preventDefault(); event.preventDefault();
$(this).addClass('loading'); $(this).addClass('loading');
loadPage($(this).attr('action') + '/?' + $(this).serialize()); loadPage($(this).attr('action') + '/?' + $(this).serialize());
......
{% extends "base.html" %} {% extends "base.html" %}
{% load paniktags %}
{% block bodyID %}Emissions{% endblock %} {% block bodyID %}Emissions{% endblock %}
{% block title %}Emissions{% endblock %} {% block title %}Emissions{% endblock %}
{% block nav %}
{% emission_nav with klass="emissions" %}
{% endblock %}
{% block main %} {% block main %}
<div class="emissions padded"> <div class="emissions padded">
<ul class="custom list columns padded"> <ul class="custom list columns padded">
{% for emission in emissions %} {% for emission in emissions %}
<li>{% include "emissions/inline.html" %}</li> <li>{% emission_resume %}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
......
<!--
-->
<nav> <nav>
<ul class="inline"> <ul class="inline">
<li> <li><a href="{% url 'emissions' %}">
<a href="{% url 'emissions' %}">
<span class="icon-bullhorn" ></span> <span class="icon-bullhorn" ></span>
<span class="iconLabel">Emission</span> <span class="iconLabel">Emissions</span>
</a> </a></li>
</li> <li><a href="{% url 'program' %}">
<span class="icon-calendar" ></span>
<span class="iconLabel">Cette semaine</span>
</a></li>
<li><a href="{% url 'grid' %}">
<span class="icon-th-large" ></span>
<span class="iconLabel">La grille</span>
</a></li>
</ul> </ul>
</nav> </nav>
<header class="mainHeader"> {% if class = "grid" %}
<nav id="gridNav" class="checkable">
<ul class="distributed by{{ categories.count }}">
<li><button onclick="
$('#grid *').removeClass('highlighted');
$('#grid .nonstop').addClass('highlighted');
">Non-stop</button></li>
{% for category in categories %}
<li><button onclick="
$('#grid *').removeClass('highlighted');
$('#grid .{{ category|slugify }}').addClass('highlighted');
">{{ category }}</button></li>
{% endfor %}
</ul>
</nav>
{% endif %}
{% if class = "week" %}
{% endif %}
{% if emission %}
<header class="mainHeader">
<h2 class="squashed title"> <h2 class="squashed title">
<a href="{% url 'emission-view' slug=emission.slug %}">{{ emission.title }}</a> <a href="{% url 'emission-view' slug=emission.slug %}">{{ emission.title }}</a>
</h2> </h2>
</header> </header>
{% if episodes %} {% if episodes %}
<div class="wrapper half"> <div class="wrapper half">
<nav class="tabs" data-tab-about="#Emission-container"> <nav class="tabs" data-tab-about="#Emission-container">
<ul class="distributed"> <ul class="distributed">
...@@ -41,5 +64,6 @@ ...@@ -41,5 +64,6 @@
<h5 class="active button padded " data-tab="#Emission-tabs-current">{{ episode.title }}</h5> <h5 class="active button padded " data-tab="#Emission-tabs-current">{{ episode.title }}</h5>
{% endif %} {% endif %}
</nav> </nav>
</div> </div>
{% endif %}
{% endif %} {% endif %}
TODO <div class="emission emission-resume resume">
<div class="{% if emission.archived %}archived{% endif %}">
{% if emission.date %}
<div class="date cf">
<span class="day">XX</span>
<span class="day-number">00</span>
<span class="year">0000</span>
</div>
{% endif %}
<a class="block" href="{% url 'emission-view' slug=emission.slug %}">
<h5 class="title ellipsis">{{ emission.title }}</h5>
{% if emission.description %}
<div class="description ellipsis">
{{ emission.description|safe|striptags }}
</div>
{% elif emission.text %}
<div class="description ellipsis">
{{ emission.text|safe|striptags|truncatewords:20}}
</div>
{% endif %}
</a>
</div>
</div>
{% extends "base.html" %} {% extends "emissions.html" %}
{% load paniktags %} {% load paniktags %}
{% block bodyID %}Grid{% endblock %} {% block bodyID %}Grid{% endblock %}
{% block title %}La grille{% endblock %} {% block title %}La grille{% endblock %}
{% block nav %} {% block nav %}
<nav id="gridNav" class="checkable"> {% emission_nav with klass="grid" %}
<ul class="distributed by{{ categories.count }}">
<li><button onclick="
$('#grid *').removeClass('highlighted');
$('#grid .nonstop').addClass('highlighted');
">Non-stop</button></li>
{% for category in categories %}
<li><button onclick="
$('#grid *').removeClass('highlighted');
$('#grid .{{ category|slugify }}').addClass('highlighted');
">{{ category }}</button></li>
{% endfor %}
</ul>
</nav>
{% endblock %} {% endblock %}
{% block main %} {% block main %}
<div id="grid" class=""> <div id="grid" class="">
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<span class="iconLabel">Listen</span> <span class="iconLabel">Listen</span>
</a></li> </a></li>
<li><a href="{% url 'emissions' %}"> <li><a href="{% url 'emissions' %}">
<span class="icon-bullhorn" ></span> <span class="icon-calendar" ></span>
<span class="iconLabel">Emissions</span> <span class="iconLabel">Program</span>
</a></li> </a></li>
<!-- <!--
--> -->
...@@ -21,15 +21,11 @@ ...@@ -21,15 +21,11 @@
<span class="icon-group" ></span> <span class="icon-group" ></span>
<span class="iconLabel">News</span> <span class="iconLabel">News</span>
</a></li> </a></li>
<li><a href="{% url 'program' %}">
<span class="icon-calendar" ></span>
<span class="iconLabel">Program</span>
</a></li>
-->
<li><a href="{% url 'grid' %}"> <li><a href="{% url 'grid' %}">
<span class="icon-th-large" ></span> <span class="icon-th-large" ></span>
<span class="iconLabel">Grid</span> <span class="iconLabel">Grid</span>
</a></li> </a></li>
-->
<li><a href="/la-radio/"> <li><a href="/la-radio/">
<span class="icon-info-sign" ></span> <span class="icon-info-sign" ></span>
<span class="iconLabel">About</span> <span class="iconLabel">About</span>
......
{% extends "base.html" %} {% extends "emissions.html" %}
{% load paniktags %} {% load paniktags %}
{% block bodyID %}Program{% endblock %} {% block bodyID %}Program{% endblock %}
{% block title %}Programme{% endblock %} {% block title %}Programme{% endblock %}
{% block nav %} {% block nav %}
{% emission_nav with klass="week" %}
{% if week %}
<div class="program">
<nav class="center">
<ul class="custom distributed">
<li>
<a
href="{% url 'program_week' year=year week=week|add:"-1" %}"
class="icon-chevron-sign-left"
></a>
</li>
<li>Semaine {{ week }}</li>
<li>
<a
href="{% url 'program_week' year=year week=week|add:"1" %}"
class="icon-chevron-sign-right"
></a>
</li>
</ul>
</nav>
</div>
{% endif %}
{% weekview year=year week=week fragment="nav" %} {% weekview year=year week=week fragment="nav" %}
{% endblock %} {% endblock %}
{% block main %} {% block main %}
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
{% block bodyID %}Program{% endblock %} {% block bodyID %}Program{% endblock %}
{% block title %}Programme{% endblock %} {% block title %}Programme{% endblock %}
{% block nav %} {% block nav %}
<div class="program"> {% emission_nav with klass="week" %}
<div class="program">
<nav class="center"> <nav class="center">
<ul class="custom distributed"> <ul class="custom distributed">
<li> <li>
...@@ -21,8 +22,8 @@ ...@@ -21,8 +22,8 @@
</li> </li>
</ul> </ul>
</nav> </nav>
</div>
{% weekview year=year week=week fragment="nav" %} {% weekview year=year week=week fragment="nav" %}
</div>
{% endblock %} {% endblock %}
{% block main %} {% block main %}
{% weekview year=year week=week fragment="program" %} {% weekview year=year week=week fragment="program" %}
......
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