Skip to content

Commit

Permalink
interlink speaker and schedule pages (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
epsy authored and PirosB3 committed Jun 28, 2017
1 parent dc0a3e5 commit 4be6d28
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pybay/templates/frontend/schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h3 class="sch-timeslot-time">{{ time }}</h3>
{% with talk=slot.content_ptr %}
<div class="sch-timeslot-slot sch-timeslot-kind-{{ slot.kind.label }} sch-talk-level-{{ talk.proposal.audience_level }} sch-talk-{% value_from_list_or_default talk.proposal.category|cut:" " allowed_categories "other" %}">
{% if talk.speaker.photo %}<p class="sch-speaker-photo"><img src="{% thumbnail talk.speaker.photo '50x50' %}" alt="{{ talk.speaker.name }}" /></p>{% endif %}
<h4>{{ talk.title }}</h4>
<h4><a href="{% url 'pybay_speakers_detail' talk.speaker.name_slug %}">{{ talk.title }}</a></h4>
<p class="sch-speaker">{{ talk.speaker.name }}</p>
{% if talk.speaker.photo %}<p class="sch-speaker-photo"><img src="{% thumbnail talk.speaker.photo '50x50' %}" alt="{{ talk.speaker.name }}" /></p>{% endif %}
<p class="sch-description">{{ talk.description }}</p>
Expand Down
7 changes: 6 additions & 1 deletion pybay/templates/frontend/speakers_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{% load thumbnail %}
{% block content %}
{% load get_speaker_url_with_fallback %}
{% load slot_desc %}

<section>
<div class="container" style="padding-top: 150px;">
<div class="row">
Expand Down Expand Up @@ -30,6 +32,10 @@ <h1><strong>{{ speaker.name }}</strong></h1>
<h2><strong>{{ talk.title }}</strong></h2>
{{ talk.category | capfirst }}, {{ talk.get_audience_level_display | capfirst }}
</div>
{% slot_desc talk as talk_slot %}
{% if talk_slot %}
<a href="{% url 'pybay_schedule' %}" class="btn">{{ talk_slot }}</a>
{% endif %}
</div>

<div class="row">
Expand All @@ -43,7 +49,6 @@ <h3>Description</h3>
<h3>Abstract</h3>
{{ talk.abstract }}
</p>
<a href="#" class="btn">Conference Schedule</a>
</div>
</div>
</div>
Expand Down
27 changes: 27 additions & 0 deletions pybay/templatetags/slot_desc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from django.template import Library
from django.conf import settings

from symposion.schedule.models import Presentation, Slot

import logging


register = Library()
log = logging.getLogger(__name__)


@register.simple_tag
def slot_desc(talk):
try:
slot = talk.presentation.slot
except (Presentation.DoesNotExist, Slot.DoesNotExist):
log.error("Talk %s does not have a slot", talk.name)
slot = None

if slot is None:
return None

return "{} | {}-{} | {}".format(
slot.day.date.strftime("%-m/%-d/%Y"), slot.start.strftime("%-I:%M %p"),
slot.end.strftime("%-I:%M %p"), slot.rooms[0],
)
2 changes: 1 addition & 1 deletion pybay/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
url(r"^reviews/", include("symposion.reviews.urls")),
url(r"^boxes/", include("pinax.boxes.urls")),

url(r"^schedule/", views.pybay_schedule),
url(r"^schedule/", views.pybay_schedule, name='pybay_schedule'),
url(r"^schedule-sym/", include("symposion.schedule.urls")),
# url(r"^account/signup/$", SignupView.as_view(), name="account_signup"),
# url(r"^account/login/$", symposion.views.LoginView.as_view(), name="account_login"),
Expand Down

0 comments on commit 4be6d28

Please sign in to comment.