Use miniconf schedule based on sections
This commit is contained in:
parent
96cbe2d7ee
commit
2cce659c28
6 changed files with 96 additions and 32 deletions
|
@ -0,0 +1,9 @@
|
|||
<a
|
||||
class="nav-item nav-link {% if active %}active{% endif %}"
|
||||
id="{{ section.schedule.section.slug }}-{{ timetable.day.date|date:"l"|lower}}-tab"
|
||||
data-toggle="tab" href="#{{section.schedule.section.slug}}-{{ timetable.day.date|date:"l"|lower}}"
|
||||
role="tab"
|
||||
aria-controls="{{section.schedule.section.slug}}-{{ timetable.day.date|date:"l"|lower}}"
|
||||
aria-selected="{% if active %}true{% else %}false{% endif %}">
|
||||
{{ label }}
|
||||
</a>
|
|
@ -21,16 +21,41 @@
|
|||
|
||||
<nav class="mb-4">
|
||||
<div class="nav schedule-nav" id="schedule-nav" role="tablist">
|
||||
Monday
|
||||
{% for section in sections %}
|
||||
{% if "Miniconf" in section.schedule.section.name %}
|
||||
{% for timetable in section.days %}
|
||||
<a
|
||||
class="nav-item nav-link {% if forloop.first %}active{% endif %}" id="schedule_day_{{ timetable.day.date|date:"l"|lower}}-tab" data-toggle="tab" href="#{{ timetable.day.date|date:"l"|lower}}" role="tab" aria-controls="{{ timetable.day.date|date:"l"|lower}}" aria-selected="{% if forloop.first %}true{% else %}false{% endif %}">
|
||||
{{ timetable.day.date|date:"l"}}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</nav>
|
||||
{% if timetable.day.date|date:"Y-m-d" == "2019-01-21" %}
|
||||
<a class="nav-item nav-link" id="123" data-toggle="tab" href="#123" role="tab" aria-controls="123" aria-selected="false">
|
||||
{{ section.schedule.section.name }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<br />
|
||||
|
||||
Tuesday
|
||||
{% for section in sections %}
|
||||
{% if "Miniconf" in section.schedule.section.name %}
|
||||
{% for timetable in section.days %}
|
||||
{% if timetable.day.date|date:"Y-m-d" == "2019-01-22" %}
|
||||
{% include "symposion/schedule/_schedule_nav_link.html" with label=section.schedule.section.name %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<br />
|
||||
|
||||
{% for section in sections %}
|
||||
{% if "Miniconf" not in section.schedule.section.name %}
|
||||
{% for timetable in section.days %}
|
||||
{% include "symposion/schedule/_schedule_nav_link.html" with active=forloop.first label=timetable.day.date|date:"l" %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="schedule-page bg-secondary text-primary pt-4 pb-4 mb-0">
|
||||
|
@ -39,25 +64,21 @@
|
|||
<div class="tab-content schedule-wrapper">
|
||||
{% for section in sections %}
|
||||
{% for timetable in section.days %}
|
||||
<div
|
||||
class="tab-pane fade {% if forloop.first %}show active{% endif %}"
|
||||
id="{{ timetable.day.date|date:"l"|lower}}"
|
||||
role="tabpanel"
|
||||
aria-labelledby="schedule_day_{{ timetable.day.date|date:"l"|lower}}-tab"
|
||||
>
|
||||
<div class="table-responsive hidden-md-down">
|
||||
{% include "symposion/schedule/_grid.html" %}
|
||||
</div>
|
||||
<div class="mobile-schedule">
|
||||
{% include "symposion/schedule/_mobile.html" %}
|
||||
<div class="tab-pane fade {% if timetable.day.date|date:'Y-m-d' == '2019-01-23' %}show active{% endif %}" id="{{ section.schedule.section.slug }}-{{ timetable.day.date|date:"l"|lower}}"
|
||||
role="tabpanel" aria-labelledby="{{ section.schedule.section.slug }}-{{ timetable.day.date|date:"l"|lower}}-tab">
|
||||
<div class="table-responsive hidden-md-down">
|
||||
{% include "symposion/schedule/_grid.html" %}
|
||||
</div>
|
||||
<div class="mobile-schedule">
|
||||
{% include "symposion/schedule/_mobile.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{%block footer_class %}footer-no-margin{% endblock %}
|
||||
|
@ -74,9 +95,10 @@
|
|||
var trailing = ' January 2019';
|
||||
|
||||
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
|
||||
var day = e.target.attributes['aria-controls'].value;
|
||||
var day = e.target.attributes['aria-controls'].value.split('-');
|
||||
day = day[day.length - 1];
|
||||
$('#schedule-date').text(day + ' ' + dates[day] + trailing);
|
||||
})
|
||||
</script>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
|
@ -376,6 +376,10 @@ hr {
|
|||
tr.calendar-row {
|
||||
height: 120px;
|
||||
|
||||
td.time {
|
||||
width: 85px;
|
||||
}
|
||||
|
||||
td.time > p {
|
||||
font-size: 1.25rem;
|
||||
text-transform: lowercase;
|
||||
|
|
16
vendor/symposion/managers.py
vendored
Normal file
16
vendor/symposion/managers.py
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
from django.db.models import Manager
|
||||
|
||||
|
||||
class DefaultSelectRelatedManager(Manager):
|
||||
def get_queryset(self):
|
||||
symposion_meta = getattr(self.model, 'SymposionMeta', None)
|
||||
if symposion_meta is None:
|
||||
return super().get_queryset()
|
||||
|
||||
select_related = getattr(symposion_meta, 'select_related', None)
|
||||
if select_related is None:
|
||||
return super().get_queryset()
|
||||
|
||||
|
||||
return super().get_queryset().select_related(*select_related)
|
||||
|
6
vendor/symposion/schedule/admin.py
vendored
6
vendor/symposion/schedule/admin.py
vendored
|
@ -33,14 +33,12 @@ update_slot_names.short_description = "Update slot names"
|
|||
|
||||
class SlotAdmin(admin.ModelAdmin):
|
||||
list_filter = ("day", "kind","exclusive","slotroom__room")
|
||||
list_display = ("day", "start", "end", "kind", "room_names",
|
||||
"content_override","exclusive")
|
||||
list_editable = ("exclusive","kind","start","end")
|
||||
list_display = ("day", "start", "end", "kind", "room_names", "content_override", "exclusive")
|
||||
inlines = [SlotRoomInline]
|
||||
actions = [update_slot_names]
|
||||
|
||||
def room_names(self, slot):
|
||||
return ", ".join(room.name for room in slot.rooms.all())
|
||||
return ", ".join(room.name for room in slot.rooms)
|
||||
|
||||
|
||||
class RoomAdmin(admin.ModelAdmin):
|
||||
|
|
23
vendor/symposion/schedule/models.py
vendored
23
vendor/symposion/schedule/models.py
vendored
|
@ -5,6 +5,7 @@ from django.contrib.auth.models import User
|
|||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from symposion.managers import DefaultSelectRelatedManager
|
||||
from symposion.text_parser import parse
|
||||
from symposion.proposals.models import ProposalBase
|
||||
from symposion.conference.models import Section
|
||||
|
@ -12,6 +13,7 @@ from symposion.speakers.models import Speaker
|
|||
|
||||
|
||||
class Schedule(models.Model):
|
||||
objects = DefaultSelectRelatedManager()
|
||||
|
||||
section = models.OneToOneField(Section, verbose_name=_("Section"))
|
||||
published = models.BooleanField(default=True, verbose_name=_("Published"))
|
||||
|
@ -20,6 +22,9 @@ class Schedule(models.Model):
|
|||
def __str__(self):
|
||||
return "%s Schedule" % self.section
|
||||
|
||||
class SymposionMeta:
|
||||
select_related = ('section', )
|
||||
|
||||
class Meta:
|
||||
ordering = ["section"]
|
||||
verbose_name = _('Schedule')
|
||||
|
@ -27,12 +32,17 @@ class Schedule(models.Model):
|
|||
|
||||
|
||||
class Day(models.Model):
|
||||
objects = DefaultSelectRelatedManager()
|
||||
|
||||
|
||||
schedule = models.ForeignKey(Schedule, verbose_name=_("Schedule"))
|
||||
date = models.DateField(verbose_name=_("Date"))
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % self.date
|
||||
return "%s: %s" % (self.schedule.section.name, self.date)
|
||||
|
||||
class SymposionMeta:
|
||||
select_related = ('schedule__section', )
|
||||
|
||||
class Meta:
|
||||
unique_together = [("schedule", "date")]
|
||||
|
@ -82,7 +92,7 @@ class SlotKind(models.Model):
|
|||
label = models.CharField(max_length=50, verbose_name=_("Label"))
|
||||
|
||||
def __str__(self):
|
||||
return self.label
|
||||
return ": ".join((self.schedule.section.name, self.label))
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Slot kind")
|
||||
|
@ -90,6 +100,7 @@ class SlotKind(models.Model):
|
|||
|
||||
|
||||
class Slot(models.Model):
|
||||
objects = DefaultSelectRelatedManager()
|
||||
|
||||
name = models.CharField(max_length=512, editable=False)
|
||||
day = models.ForeignKey(Day, verbose_name=_("Day"))
|
||||
|
@ -161,13 +172,16 @@ class Slot(models.Model):
|
|||
return Room.objects.filter(pk__in=self.slotroom_set.values("room"))
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
roomlist = ' '.join(map(lambda r: r.__unicode__(), self.rooms))
|
||||
roomlist = ' '.join(map(str, self.rooms))
|
||||
self.name = "%s %s (%s - %s) %s" % (self.day, self.kind, self.start, self.end, roomlist)
|
||||
self.content_override_html = parse(self.content_override)
|
||||
super(Slot, self).save(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
return "%s: %s" % (self.kind.schedule.section.name, self.name)
|
||||
|
||||
class SymposionMeta:
|
||||
select_related = ('kind__schedule__section', 'day')
|
||||
|
||||
class Meta:
|
||||
ordering = ["day", "start", "end"]
|
||||
|
@ -194,6 +208,7 @@ class SlotRoom(models.Model):
|
|||
|
||||
|
||||
class Presentation(models.Model):
|
||||
objects = DefaultSelectRelatedManager()
|
||||
|
||||
slot = models.OneToOneField(Slot, null=True, blank=True, related_name="content_ptr", verbose_name=_("Slot"))
|
||||
title = models.CharField(max_length=100, verbose_name=_("Title"))
|
||||
|
|
Loading…
Reference in a new issue