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

Fusion grid/program/emission

parent ad42e4fc
......@@ -31,8 +31,10 @@ def news_nav(context, date=None):
}
@register.inclusion_tag('emissions/nav.html', takes_context=True)
def emission_nav(context, date=None):
def emission_nav(context, date=None, klass=None):
return {
'class': klass,
'categories': context.get('categories'),
'episodes': context.get('episodes'),
'emission': context.get('emission'),
'episode': context.get('episode'),
......@@ -62,6 +64,13 @@ def emission_detail(context, date=None):
'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)
def player():
return {'unique': uuid.uuid4()}
......
......@@ -10,8 +10,8 @@ admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'panikweb.views.home', name='home'),
url(r'^onair.json$', 'panikweb.views.onair', name='onair'),
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/$', 'panikweb.views.program', name='program'),
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'^emissions/$', 'panikweb.views.emissions', name='emissions'),
url(r'^emissions/(?P<slug>[\w,-]+)/$', 'panikweb.views.emission', name='emission-view'),
......
......@@ -85,10 +85,11 @@ class EpisodeDetailView(DetailView):
return context
episode = EpisodeDetailView.as_view()
class ProgramView(TemplateView):
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)
schedules = Schedule.objects.select_related().order_by('datetime')
days = []
......@@ -96,22 +97,13 @@ class ProgramView(TemplateView):
days.append({'schedules': [x for x in schedules if x.is_on_weekday(day+1)],
'datetime': datetime(2007, 1, day+1)})
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
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:
nonstop = None
w = 1
......
......@@ -27,10 +27,9 @@ $(function() {
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
*/
var bodyID = html.match(/<body id="(.*?)">/)[1].trim();
$('body').attr('id',bodyID);
var bodyID = html.match(/<body id="(.*?)">/);
if(bodyID){$('body').attr('id',bodyID[1].trim());}
$('html, body').animate({scrollTop: $main.offset().top-$('#metaNav').height()+2}, 500);
$("a, area, form").removeClass('loading');
init();
};
......@@ -46,9 +45,8 @@ $(function() {
loadPage_request = $.get(href, null, afterLoad);
};
init = function() {
$("a, area, form").removeClass('loading');
$("a, area").unbind('click').on('click',function() {
$("a, area, form").removeClass('loading');
$("#All a, #All area, #All form").removeClass('loading');
$("#All a, #All area").unbind('click').on('click',function() {
$(this).addClass('loading');
var href = $(this).attr("href");
/* this checks the link points to a local document, be
......@@ -60,11 +58,11 @@ $(function() {
return false;
}else{
$(this).attr('target','_blanck');
$("#All a, #All area, #All form").removeClass('loading');
return true;
}
});
$("#search-form").unbind('submit').on('submit', function(event) {
$("a, area, form").removeClass('loading');
event.preventDefault();
$(this).addClass('loading');
loadPage($(this).attr('action') + '/?' + $(this).serialize());
......
{% extends "base.html" %}
{% load paniktags %}
{% block bodyID %}Emissions{% endblock %}
{% block title %}Emissions{% endblock %}
{% block nav %}
{% emission_nav with klass="emissions" %}
{% endblock %}
{% block main %}
<div class="emissions padded">
<ul class="custom list columns padded">
{% for emission in emissions %}
<li>{% include "emissions/inline.html" %}</li>
<li>{% emission_resume %}</li>
{% endfor %}
</ul>
</div>
......
<!--
-->
<nav>
<ul class="inline">
<li>
<a href="{% url 'emissions' %}">
<span class="icon-bullhorn" ></span>
<span class="iconLabel">Emission</span>
</a>
</li>
<li><a href="{% url 'emissions' %}">
<span class="icon-bullhorn" ></span>
<span class="iconLabel">Emissions</span>
</a></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>
</nav>
<header class="mainHeader">
<h2 class="squashed title">
<a href="{% url 'emission-view' slug=emission.slug %}">{{ emission.title }}</a>
</h2>
</header>
{% if episodes %}
<div class="wrapper half">
<nav class="tabs" data-tab-about="#Emission-container">
<ul class="distributed">
<li>
<button data-tab="#Emission-tabs-last" >
<span class="iconLabel">Dernier épisode</span>
</button>
</li>
<li>
<button data-tab="#Emission-tabs-episodes">
<span class="iconLabel">Archives</span>
</button >
</li>
<li>
<button data-tab="#Emission-tabs-detail" >
<span class="iconLabel">A propos</span>
</button>
</li>
{% 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>
{% if episode %}
<hr />
<h5 class="active button padded " data-tab="#Emission-tabs-current">{{ episode.title }}</h5>
{% endif %}
</nav>
</div>
{% endif %}
{% if class = "week" %}
{% endif %}
{% if emission %}
<header class="mainHeader">
<h2 class="squashed title">
<a href="{% url 'emission-view' slug=emission.slug %}">{{ emission.title }}</a>
</h2>
</header>
{% if episodes %}
<div class="wrapper half">
<nav class="tabs" data-tab-about="#Emission-container">
<ul class="distributed">
<li>
<button data-tab="#Emission-tabs-last" >
<span class="iconLabel">Dernier épisode</span>
</button>
</li>
<li>
<button data-tab="#Emission-tabs-episodes">
<span class="iconLabel">Archives</span>
</button >
</li>
<li>
<button data-tab="#Emission-tabs-detail" >
<span class="iconLabel">A propos</span>
</button>
</li>
</ul>
{% if episode %}
<hr />
<h5 class="active button padded " data-tab="#Emission-tabs-current">{{ episode.title }}</h5>
{% endif %}
</nav>
</div>
{% 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 %}
{% block bodyID %}Grid{% endblock %}
{% block title %}La grille{% endblock %}
{% block nav %}
<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>
{% emission_nav with klass="grid" %}
{% endblock %}
{% block main %}
<div id="grid" class="">
......
......@@ -11,8 +11,8 @@
<span class="iconLabel">Listen</span>
</a></li>
<li><a href="{% url 'emissions' %}">
<span class="icon-bullhorn" ></span>
<span class="iconLabel">Emissions</span>
<span class="icon-calendar" ></span>
<span class="iconLabel">Program</span>
</a></li>
<!--
-->
......@@ -21,15 +21,11 @@
<span class="icon-group" ></span>
<span class="iconLabel">News</span>
</a></li>
<li><a href="{% url 'program' %}">
<span class="icon-calendar" ></span>
<span class="iconLabel">Program</span>
</a></li>
-->
<li><a href="{% url 'grid' %}">
<span class="icon-th-large" ></span>
<span class="iconLabel">Grid</span>
</a></li>
-->
<li><a href="/la-radio/">
<span class="icon-info-sign" ></span>
<span class="iconLabel">About</span>
......
{% extends "base.html" %}
{% extends "emissions.html" %}
{% load paniktags %}
{% block bodyID %}Program{% endblock %}
{% block title %}Programme{% endblock %}
{% 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" %}
{% endblock %}
{% block main %}
......
......@@ -3,26 +3,27 @@
{% block bodyID %}Program{% endblock %}
{% block title %}Programme{% endblock %}
{% block nav %}
<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>
{% emission_nav with klass="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>
{% weekview year=year week=week fragment="nav" %}
</div>
{% endblock %}
{% block main %}
{% 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