Commit 100c9bca authored by Simon Daron's avatar Simon Daron

Adapt tabs & program to show current day

parent 821bbcc8
......@@ -48,10 +48,11 @@ def metanav():
return {}
@register.inclusion_tag('includes/week.html', takes_context=True)
def weekview(context, year=None, week=None, fragment= None):
year = year if year else str(datetime.today().year)
week = week if week else str(datetime.today().isocalendar()[1]-1)
date = _date_from_string(year, '%Y', '1', '%w', week, '%W')
def weekview(context, year=None, week=None, weekday=None, fragment= None):
year = year if year else datetime.today().year
week = week if week else datetime.today().isocalendar()[1]-1
weekday = weekday if weekday else datetime.today().weekday()
date = _date_from_string(str(year), '%Y', '1', '%w', str(week), '%W')
date = datetime(*date.timetuple()[:3])
program = period_program(date, date+timedelta(days=7))
......@@ -62,6 +63,7 @@ def weekview(context, year=None, week=None, fragment= None):
return {
'fragment': fragment,
'days': days,
'weekday': weekday,
'week': week,
'year': year,
}
......
......@@ -71,8 +71,9 @@ $(function() {
$(".tabs").each(function() {
var self = $(this);
var about= $($(this).attr("data-tab-about"));
about.find("[data-tabbed]:not(:first)").hide();
$(this).find("[data-tab]:first").addClass("active");
var current = $(this).find("[data-tab].active")[0];
var dftShowSelector = current?".active":":first";
var activeTab = $(this).find("[data-tab]"+dftShowSelector+"").addClass("active");
$(this).find("[data-tab]").each(function() {
$(this).click(function (e) {
e.preventDefault();
......@@ -83,6 +84,7 @@ $(function() {
});
});
activeTab.trigger('click');
});
$("[data-audio-control]").each(function() {
var audio = $('#'+$(this).attr('data-audio-control'));
......
......@@ -8,6 +8,7 @@
{% if program %}dfsdfsdf
{{ program }}
{% endif %}
<div class="news">
<div class="wrapper">
<ul class="custom list news cf">
......@@ -51,7 +52,7 @@
</div>
</div>
<div class="program padded">
<div class="padded">
<div class="wrapper">
<h2>Cette semaine sur Panik</h2>
{% weekview %}
......
......@@ -3,7 +3,7 @@
<nav class="">
<ul class="days custom distributed">
{% for day in days %}
<li class=""><button data-tab="#Program-week-{{ day.datetime|slugify }}">{{ day.datetime|date:"D d" }}</button></li>
<li class=""><button class="{% if day.datetime.weekday = weekday %}active{% endif %}" data-tab="#Program-week-{{ day.datetime|slugify }}">{{ day.datetime|date:"D d" }}</button></li>
{% endfor %}
</ul>
</nav>
......
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