more fiddling with schedule layout
This commit is contained in:
parent
201de12b49
commit
1908c18530
|
@ -102,7 +102,7 @@ class Speaker(CreatedUpdatedModel):
|
||||||
ordering = ['name']
|
ordering = ['name']
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return '%s (%s)' % (self.name, self.camp)
|
||||||
|
|
||||||
def save(self, **kwargs):
|
def save(self, **kwargs):
|
||||||
if not self.slug:
|
if not self.slug:
|
||||||
|
|
|
@ -1,28 +1,49 @@
|
||||||
{% extends 'schedule_base.html' %}
|
{% extends 'schedule_base.html' %}
|
||||||
|
|
||||||
{% block schedule_content %}
|
{% block schedule_content %}
|
||||||
|
<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 %}{% 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 %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}" class="btn btn-default" style="display: inline-block; padding: 5px;">Overview</a>
|
<p>
|
||||||
{% 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;">
|
|
||||||
{{ day.lower.date|date:"l" }}
|
|
||||||
</a>
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<hr />
|
<div class="row">
|
||||||
|
<div class="btn-group btn-group-justified">
|
||||||
|
|
||||||
<a href="{% url 'schedule_index' camp_slug=camp.slug %}" style="background-color: black; border: 0; color: white; display: inline-block; padding: 5px;">
|
{% if not urlyear %}
|
||||||
All
|
<a href="{% url 'schedule_index' camp_slug=camp.slug %}" style="background-color: black; border: 0; color: white;" class="btn">
|
||||||
</a>
|
{% if eventtype %}All{% else %}<b>All</b>{% endif %}
|
||||||
{% for event_type in camp.event_types %}
|
</a>
|
||||||
<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;">
|
{% else %}
|
||||||
{{ event_type.name }}
|
<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">
|
||||||
</a>
|
{% if eventtype %}All{% else %}<b>All</b>{% endif %}
|
||||||
{% endfor %}
|
</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 />
|
<hr />
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,15 @@
|
||||||
|
|
||||||
{% block content %}
|
{% 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>
|
<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 %}
|
{% block schedule_content %}
|
||||||
{% endblock schedule_content %}
|
{% endblock schedule_content %}
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,19 @@ class ProgramDayView(CampViewMixin, TemplateView):
|
||||||
timeslots.append(timeslot)
|
timeslots.append(timeslot)
|
||||||
context['timeslots'] = timeslots
|
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
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EventDetailView(CampViewMixin, DetailView):
|
class EventDetailView(CampViewMixin, DetailView):
|
||||||
model = models.Event
|
model = models.Event
|
||||||
template_name = 'program_event_detail.html'
|
template_name = 'program_event_detail.html'
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{% load static from staticfiles %}
|
{% load static from staticfiles %}
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load menubutton %}
|
||||||
{% static "" as baseurl %}
|
{% static "" as baseurl %}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -33,13 +34,13 @@
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="/">
|
<a class="navbar-brand" href="/">
|
||||||
{% if request.resolver_match.kwargs.camp_slug %}
|
{% if request.resolver_match.kwargs.camp_slug %}
|
||||||
<img src="{% static camp.logo_small %}" class="img-responsive" />
|
<img src="{% static camp.logo_small %}" class="img-responsive" />
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{% static 'img/logo-small.png' %}" class="img-responsive" />
|
<img src="{% static 'img/logo-small.png' %}" class="img-responsive" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="navbar" class="navbar-collapse collapse">
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li><a href="{% url 'news:index' %}">News</a></li>
|
<li><a href="{% url 'news:index' %}">News</a></li>
|
||||||
<li><a href="{% url 'shop:index' %}">Shop</a></li>
|
<li><a href="{% url 'shop:index' %}">Shop</a></li>
|
||||||
|
@ -51,7 +52,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="{% url 'contact' %}">Contact</a></li>
|
<li><a href="{% url 'contact' %}">Contact</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
|
@ -68,14 +69,14 @@
|
||||||
{% if camp %}
|
{% if camp %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="btn-group btn-group-justified">
|
<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 {% menubuttonclass 'camps' %}" 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 {% menubuttonclass 'info' %}" 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 {% menubuttonclass 'villages' %}" 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 {% menubuttonclass 'program' %}" 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 'sponsors' %}" href="{% url 'sponsors' camp_slug=camp.slug %}">Sponsors</a>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% bootstrap_messages %}
|
{% bootstrap_messages %}
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
|
@ -93,3 +94,4 @@
|
||||||
{% bootstrap_javascript jquery=1 %}
|
{% bootstrap_javascript jquery=1 %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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