more fiddling with schedule layout
This commit is contained in:
parent
201de12b49
commit
1908c18530
|
@ -102,7 +102,7 @@ class Speaker(CreatedUpdatedModel):
|
|||
ordering = ['name']
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
return '%s (%s)' % (self.name, self.camp)
|
||||
|
||||
def save(self, **kwargs):
|
||||
if not self.slug:
|
||||
|
|
|
@ -1,28 +1,49 @@
|
|||
{% extends 'schedule_base.html' %}
|
||||
|
||||
{% block schedule_content %}
|
||||
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}" class="btn btn-default" style="display: inline-block; padding: 5px;">Overview</a>
|
||||
{% for day in camp.camp_days %}
|
||||
<div class="row">
|
||||
<div class="btn-group btn-group-justified">
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}{% if eventtype %}?type={{ eventtype.slug }}{% endif %}" class="btn {% if urlyear %}btn-default{% else %}btn-primary{% endif %}">Overview</a>
|
||||
{% for day in camp.camp_days %}
|
||||
{% with day.lower.date|date:"m" as month_padded %}
|
||||
{% with day.lower.date|date:"d" as day_padded %}
|
||||
<a href="{% url 'schedule_day' camp_slug=camp.slug year=day.lower.date.year month=month_padded day=day_padded %}" class="btn btn-default" style="display: inline-block; padding: 5px;">
|
||||
<a href="{% url 'schedule_day' camp_slug=camp.slug year=day.lower.date.year month=month_padded day=day_padded %}{% if eventtype %}?type={{ eventtype.slug }}{% endif %}" class="btn btn-sm {% if urlyear and urlyear|add:"0" == day.lower.date.year and urlmonth == month_padded and urlday == day_padded %}btn-primary{% else %}btn-default{% endif %}">
|
||||
{{ day.lower.date|date:"l" }}
|
||||
</a>
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<p>
|
||||
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}" style="background-color: black; border: 0; color: white; display: inline-block; padding: 5px;">
|
||||
All
|
||||
</a>
|
||||
{% for event_type in camp.event_types %}
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}?type={{ event_type.slug }}" style="background-color: {{ event_type.color }}; border: 0; color: {% if event_type.light_text %}white{% else %}black{% endif %}; display: inline-block; padding: 5px;">
|
||||
{{ event_type.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
<div class="row">
|
||||
<div class="btn-group btn-group-justified">
|
||||
|
||||
{% if not urlyear %}
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}" style="background-color: black; border: 0; color: white;" class="btn">
|
||||
{% if eventtype %}All{% else %}<b>All</b>{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% url 'schedule_day' camp_slug=camp.slug year=urlyear month=urlmonth day=urlday %}" style="background-color: black; border: 0; color: white;" class="btn">
|
||||
{% if eventtype %}All{% else %}<b>All</b>{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% for event_type in camp.event_types %}
|
||||
{% if not urlyear %}
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}?type={{ event_type.slug }}" style="background-color: {{ event_type.color }}; border: 0; color: {% if event_type.light_text %}white{% else %}black{% endif %};" class="btn">
|
||||
{% if eventtype and eventtype == event_type %}<b>{{ event_type.name }}</b>{% else %}{{ event_type.name }}{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% url 'schedule_day' camp_slug=camp.slug year=urlyear month=urlmonth day=urlday %}?type={{ event_type.slug }}" style="background-color: {{ event_type.color }}; border: 0; color: {% if event_type.light_text %}white{% else %}black{% endif %};" class="btn">
|
||||
{% if eventtype and eventtype == event_type %}<b>{{ event_type.name }}</b>{% else %}{{ event_type.name }}{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
|
|
|
@ -2,17 +2,15 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="row">
|
||||
<div class="btn-group btn-group-justified">
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}" class="btn {% if request.resolver_match.url_name == "schedule_index" or urlyear %}btn-primary{% else %}btn-default{% endif %}">Schedule</a>
|
||||
<a href="{% url 'call_for_speakers' camp_slug=camp.slug %}" class="btn {% if request.resolver_match.url_name == "call_for_speakers" %}btn-primary{% else %}btn-default{% endif %}">Call for Speakers</a>
|
||||
<a href="{% url 'speaker_index' camp_slug=camp.slug %}" class="btn {% if request.resolver_match.url_name == "speaker_index" %}btn-primary{% else %}btn-default{% endif %}">Speakers</a>
|
||||
<a href="{% url 'event_index' camp_slug=camp.slug %}" class="btn {% if request.resolver_match.url_name == "event_index" %}btn-primary{% else %}btn-default{% endif %}">Talks & Events</a>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}" class="btn btn-default">Schedule</a>
|
||||
<a href="{% url 'call_for_speakers' camp_slug=camp.slug %}" class="btn btn-default">Call for Speakers</a>
|
||||
<a href="{% url 'speaker_index' camp_slug=camp.slug %}" class="btn btn-default">Speakers</a>
|
||||
<a href="{% url 'event_index' camp_slug=camp.slug %}" class="btn btn-default">Talks & Events</a>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
{% block schedule_content %}
|
||||
{% endblock schedule_content %}
|
||||
|
||||
|
|
|
@ -87,9 +87,19 @@ class ProgramDayView(CampViewMixin, TemplateView):
|
|||
timeslots.append(timeslot)
|
||||
context['timeslots'] = timeslots
|
||||
|
||||
# include the components to make the urls
|
||||
context['urlyear'] = self.kwargs['year']
|
||||
context['urlmonth'] = self.kwargs['month']
|
||||
context['urlday'] = self.kwargs['day']
|
||||
|
||||
if 'type' in self.request.GET:
|
||||
context['eventtype'] = models.EventType.objects.get(slug=self.request.GET['type'])
|
||||
|
||||
print dir(self.request.resolver_match.func.view_class)
|
||||
return context
|
||||
|
||||
|
||||
|
||||
class EventDetailView(CampViewMixin, DetailView):
|
||||
model = models.Event
|
||||
template_name = 'program_event_detail.html'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{% load static from staticfiles %}
|
||||
{% load bootstrap3 %}
|
||||
{% load menubutton %}
|
||||
{% static "" as baseurl %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -68,14 +69,14 @@
|
|||
{% if camp %}
|
||||
<div class="row">
|
||||
<div class="btn-group btn-group-justified">
|
||||
<a class="btn {% if request.resolver_match.url_name == "camp_detail" %}btn-primary{% else %}btn-default{% endif %}" href="{% url 'camp_detail' camp_slug=camp.slug %}">{{ camp.title }}</a>
|
||||
<a class="btn {% if request.resolver_match.url_name == "info" %}btn-primary{% else %}btn-default{% endif %}" href="{% url 'info' camp_slug=camp.slug %}">Info</a></li>
|
||||
<a class="btn {% if request.resolver_match.url_name == "village_list" %}btn-primary{% else %}btn-default{% endif %}" href="{% url 'village_list' camp_slug=camp.slug %}">Villages</a>
|
||||
<a class="btn {% if request.resolver_match.url_name == "schedule_index" %}btn-primary{% else %}btn-default{% endif %}" href="{% url 'schedule_index' camp_slug=camp.slug %}">Schedule</a>
|
||||
<a class="btn {% if request.resolver_match.url_name == "sponsors" %}btn-primary{% else %}btn-default{% endif %}" href="{% url 'sponsors' camp_slug=camp.slug %}">Sponsors</a>
|
||||
<a class="btn {% menubuttonclass 'camps' %}" href="{% url 'camp_detail' camp_slug=camp.slug %}">{{ camp.title }}</a>
|
||||
<a class="btn {% menubuttonclass 'info' %}" href="{% url 'info' camp_slug=camp.slug %}">Info</a></li>
|
||||
<a class="btn {% menubuttonclass 'villages' %}" href="{% url 'village_list' camp_slug=camp.slug %}">Villages</a>
|
||||
<a class="btn {% menubuttonclass 'program' %}" href="{% url 'schedule_index' camp_slug=camp.slug %}">Schedule</a>
|
||||
<a class="btn {% menubuttonclass 'sponsors' %}" href="{% url 'sponsors' camp_slug=camp.slug %}">Sponsors</a>
|
||||
</div>
|
||||
<p>
|
||||
</div>
|
||||
<p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% bootstrap_messages %}
|
||||
{% block content %}{% endblock %}
|
||||
|
@ -93,3 +94,4 @@
|
|||
{% bootstrap_javascript jquery=1 %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
12
utils/templatetags/menubutton.py
Normal file
12
utils/templatetags/menubutton.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
import datetime
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def menubuttonclass(context, appname):
|
||||
if appname == context['request'].resolver_match.func.view_class.__module__.split(".")[0]:
|
||||
return "btn-primary"
|
||||
else:
|
||||
return "btn-default"
|
||||
|
Loading…
Reference in a new issue