Skip to content

Commit

Permalink
Merge pull request #340 from CTPUG/tracks
Browse files Browse the repository at this point in the history
Support for tracks
  • Loading branch information
stefanor committed Jan 29, 2017
2 parents a71b123 + 9666019 commit 803688e
Show file tree
Hide file tree
Showing 19 changed files with 631 additions and 487 deletions.
2 changes: 1 addition & 1 deletion wafer/schedule/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class ScheduleItemAdmin(admin.ModelAdmin):
form = ScheduleItemAdminForm

change_list_template = 'admin/scheduleitem_list.html'
readonly_fields = ('get_talk_css_class',)
readonly_fields = ('get_css_classes',)
list_display = ('get_start_time', 'venue', 'get_title', 'expand')
list_editable = ('expand',)

Expand Down
18 changes: 12 additions & 6 deletions wafer/schedule/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,20 @@ def get_title(self):
return self.details
return 'No title'

def get_talk_css_class(self):
"""Talk type css class if it's available"""
def get_css_classes(self):
"""Get all applied CSS classes, based on this item, type, and track"""
if self.css_class:
yield self.css_class
else:
yield 'schedule'

if self.talk:
return self.talk.talk_type.css_class()
# Fallback for pages
return ''
if self.talk.talk_type:
yield self.talk.talk_type.css_class()
if self.talk.track:
yield self.talk.track.css_class()

get_talk_css_class.short_description = 'Talk Type CSS class'
get_css_classes.short_description = 'Talk Type & Track CSS classes'

def get_desc(self):
if self.details:
Expand Down
106 changes: 53 additions & 53 deletions wafer/schedule/templates/wafer.schedule/current.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,59 @@
{% block title %}{% trans "Happening now" %} - {{ WAFER_CONFERENCE_NAME }}{% endblock %}
{% block content %}
<section class="wafer wafer-schedule">
<h1>{% trans "Happening now" %}</h1>
<div class="wafer_schedule">
{% if not active %}
{# Schedule is incomplete / invalid, so show nothing #}
{% blocktrans %}
<p>The final schedule has not been published yet.</p>
{% endblocktrans %}
{% elif not slots %}
{% blocktrans %}
<p>Nothing happening right now.</p>
{% endblocktrans %}
{% else %}
<table cellspacing=1 cellpadding=0>
<tr>
<td colspan="{{ schedule_day.venues|length|add:1 }}" class="title">{{ schedule_day.day.date|date:"l (d b)" }}</td>
</tr>
<tr>
<th>{% trans "Time" %}</th>
{% for venue in schedule_day.venues %}
<th><a href="{{ venue.get_absolute_url }}">{{ venue.name }}</a></th>
<h1>{% trans "Happening now" %}</h1>
<div class="wafer_schedule">
{% if not active %}
{# Schedule is incomplete / invalid, so show nothing #}
{% blocktrans %}
<p>The final schedule has not been published yet.</p>
{% endblocktrans %}
{% elif not slots %}
{% blocktrans %}
<p>Nothing happening right now.</p>
{% endblocktrans %}
{% else %}
<table cellspacing=1 cellpadding=0>
<tr>
<td colspan="{{ schedule_day.venues|length|add:1 }}" class="title">{{ schedule_day.day.date|date:"l (d b)" }}</td>
</tr>
<tr>
<th>{% trans "Time" %}</th>
{% for venue in schedule_day.venues %}
<th><a href="{{ venue.get_absolute_url }}">{{ venue.name }}</a></th>
{% endfor %}
</tr>
{% for row in slots %}
<tr>
{% if row.slot == cur_slot %}
<td>{{ row.slot.get_start_time|time:"H:i" }} - {{ row.slot.end_time|time:"H:i" }} (Now On)</td>
{% else %}
<td>{{ row.slot.get_start_time|time:"H:i" }} - {{ row.slot.end_time|time:"H:i" }}</td>
{% endif %}
{% for item in row.get_sorted_items %}
{% if item.item == "unavailable" %}
<td colspan="{{ item.colspan }}" rowspan="{{ item.rowspan }}" class="unavailable"></td>
{% else %}
{% if item.note == "complete" %}
<td colspan="{{ item.colspan }}" rowspan="{{ item.rowspan }}" class="completed">
{% elif item.note == "current" %}
<td colspan="{{ item.colspan }}" rowspan="{{ item.rowspan }}" class="current_active">
{% else %}
<td colspan="{{ item.colspan }}" rowspan="{{ item.rowspan }}" class="future">
{% endif %}
{% include "wafer.schedule/schedule_item.html" with item=item.item %}
</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tr>
{% for row in slots %}
<tr>
{% if row.slot == cur_slot %}
<td>{{ row.slot.get_start_time|time:"H:i" }} - {{ row.slot.end_time|time:"H:i" }} (Now On)</td>
{% else %}
<td>{{ row.slot.get_start_time|time:"H:i" }} - {{ row.slot.end_time|time:"H:i" }}</td>
{% endif %}
{% for item in row.get_sorted_items %}
{% if item.item == "unavailable" %}
<td colspan="{{ item.colspan }}" rowspan="{{ item.rowspan }}" class="unavailable"></td>
{% else %}
{% if item.note == "complete" %}
<td colspan="{{ item.colspan }}" rowspan="{{ item.rowspan }}" class="completed">
{% elif item.note == "current" %}
<td colspan="{{ item.colspan }}" rowspan="{{ item.rowspan }}" class="current_active">
{% else %}
<td colspan="{{ item.colspan }}" rowspan="{{ item.rowspan }}" class="future">
{% endif %}
{% include "wafer.schedule/schedule_item.html" with item=item.item %}
</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</table>
{% endif %}
<div class="timestamp">
Last updated: {% now "H:i:s" %}
<div class="errors"></div>
</div>
</div>
</table>
{% endif %}
<div class="timestamp">
Last updated: {% now "H:i:s" %}
<div class="errors"></div>
</div>
</div>
</section>
{% endblock %}
{% block extra_foot %}
Expand Down Expand Up @@ -87,7 +87,7 @@ <h1>{% trans "Happening now" %}</h1>
});
}
$(function() {
registerRefresh({{ refresh }});
registerRefresh({{ refresh }});
});
</script>
{% endif %}
Expand Down

0 comments on commit 803688e

Please sign in to comment.