Commits

Luke Plant committed 1f595e0

New layout for showing sermon details, including adding series information and link

Comments (0)

Files changed (4)

christchurch/static/christchurch/css/style.css

 .centered {
     text-align: center;
 }
+
+div.sermon {
+    background-color: #f0f0f0;
+    border-radius: 5px;
+    padding: 5px;
+    margin-bottom: 5px;
+}
+
+.sermon h3 {
+    margin: 0px;
+    padding: 0px 2px;
+}
+
+p.sermonactions, p.sermondetails {
+    margin: 4px 8px;
+    padding: 2px 4px;
+}
+
+p.sermondetails {
+    border-radius: 4px;
+    border: 1px solid #c0c0c0;
+}
+
+.sermonactions img {
+    vertical-align: bottom;
+    margin-right: 4px;
+}
Add a comment to this file

christchurch/static/christchurch/img/audio-icon-small.png

Added
New image

sermons/templates/sermons/index.html

 {% paginate %}
 
 {% for sermon in sermons %}
-  {% ifchanged sermon.date_delivered %}
-  <h2>{{ sermon.date_delivered|date:"F j, Y" }}</h2>
+  {% ifchanged sermon.date_delivered|date:"FY" %}
+  <h2>{{ sermon.date_delivered|date:"F Y" }}</h2>
   {% endifchanged %}
-  <p>{{ sermon.nice_time }}: <a href="{{ sermon.sermon.url }}">{{ sermon.speaker }} {% if sermon.title %} - {{ sermon.title }}{% endif %}{% if sermon.nice_passage %} - {{ sermon.nice_passage }}{% endif %}</a></p>
+  <div class="sermon">
+    <h3>{% if sermon.title %}{{ sermon.title }}{% if sermon.nice_passage %} - {% endif %}{% endif %}{{ sermon.nice_passage }}</h3>
+    <p class="sermondetails"><span class="sermondate">{{ sermon.date_delivered|date:"F j, Y" }}</span>
+      | <span class="sermontime">{{ sermon.nice_time }}</span>
+      | <span class="speaker">by <a href="?speaker={{ sermon.speaker.id }}">{{ sermon.speaker }}</a></span>
+      {% if sermon.series and 'series' not in request.GET %}
+      | From series <a href="?series={{ sermon.series.id }}">{{ sermon.series.name }}</a>
+      {% endif %}
+    </p>
+    <p class="sermonactions"><a href="{{ sermon.sermon.url }}"><img src="{{ STATIC_URL }}christchurch/img/audio-icon-small.png" />Listen/download</a></p>
+  </div>
 {% endfor %}
 
 {% paginate %}
 
 
 def index(request):
-    sermons = Sermon.objects.filter(published=True)
+    sermons = Sermon.objects.filter(published=True).select_related('series', 'speaker')
     sermonsfilter = SermonFilterSet(sermons, request.GET)
     return render(request, "sermons/index.html", {'sermons': sermonsfilter.qs,
                                                   'sermonsfilter': sermonsfilter})
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.