Rooms have optional track names, access schedule by day via URL (#87)
* Optional track name with room name on schedule, access schedule by day eg /schedule/?day=Monday * Changed to using a Track model rather than a char field
This commit is contained in:
		
							parent
							
								
									fccf547e9f
								
							
						
					
					
						commit
						0eda616345
					
				
					 5 changed files with 36 additions and 5 deletions
				
			
		|  | @ -1,3 +1,4 @@ | ||||||
|  | {% load lca2017_tags %} | ||||||
| <table class="calendar table table-bordered"> | <table class="calendar table table-bordered"> | ||||||
|   <thead> |   <thead> | ||||||
|     <tr> |     <tr> | ||||||
|  | @ -6,6 +7,14 @@ | ||||||
|           <th>{{ room.name }}</th> |           <th>{{ room.name }}</th> | ||||||
|           {% endfor %} |           {% endfor %} | ||||||
|     </tr> |     </tr> | ||||||
|  |     <tr> | ||||||
|  |       <th class="time"> </th> | ||||||
|  |         {% for room in timetable.rooms %} | ||||||
|  |           {% with room|trackname:timetable.day as track_name %} | ||||||
|  |           <th class="track-name">{% if track_name %}<p>{{ track_name }}{% endif %}</th> | ||||||
|  | 	  {% endwith %} | ||||||
|  |         {% endfor %} | ||||||
|  |     </tr> | ||||||
|   </thead> |   </thead> | ||||||
|   <tbody> |   <tbody> | ||||||
|     {% for row in timetable %} |     {% for row in timetable %} | ||||||
|  |  | ||||||
|  | @ -28,21 +28,25 @@ | ||||||
|         <div class="panel--tabs"> |         <div class="panel--tabs"> | ||||||
|           {% for section in sections %} |           {% for section in sections %} | ||||||
|             {% for timetable in section.days %} |             {% for timetable in section.days %} | ||||||
|               <a data-tab-control="{{ timetable.day.date|date:"l"}}" class="panel--tab-switch {% if forloop.is_first and forloop.parentloop.is_first %}is-active{% endif %}">{{ timetable.day.date|date:"l"}}</a> |               {% if day_switch == None %} | ||||||
|  |               <a data-tab-control="{{ timetable.day.date|date:"l"}}" class="panel--tab-switch {% if forloop.first and forloop.parentloop.first %}is-active{% endif %}">{{ timetable.day.date|date:"l"}}</a> | ||||||
|  |               {% else %} | ||||||
|  |               <a data-tab-control="{{ timetable.day.date|date:"l"}}" class="panel--tab-switch {% if timetable.day.date|date:"l"|lower == day_switch|lower %}is-active{% endif %}">{{ timetable.day.date|date:"l"}}</a> | ||||||
|  |               {% endif %} | ||||||
|             {% endfor %} |             {% endfor %} | ||||||
|           {% endfor %} |           {% endfor %} | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
| 
 | 
 | ||||||
|       {% for section in sections %} |       {% for section in sections %} | ||||||
|          {% cache 600 "schedule-table" section.schedule.section %} |         {% cache 600 "schedule-table" section.schedule.section %} | ||||||
|             {% for timetable in section.days %} |             {% for timetable in section.days %} | ||||||
|               <div data-tab-content="{{ timetable.day.date|date:"l"}}" class="panel--tab-content is-active"> |               <div data-tab-content="{{ timetable.day.date|date:"l"}}" class="panel--tab-content {% if timetable.day.date|date:"l"|lower == day_switch|lower %}is-active{% endif %}"> | ||||||
|                 <h3>{{ section.schedule.section.name }} — {{ timetable.day.date|date:"l" }}, {{ timetable.day.date }}</h3> |                 <h3>{{ section.schedule.section.name }} — {{ timetable.day.date|date:"l" }}, {{ timetable.day.date }}</h3> | ||||||
|                 {% include "symposion/schedule/_grid.html" %} |                 {% include "symposion/schedule/_grid.html" %} | ||||||
|               </div> |               </div> | ||||||
|             {% endfor %} |             {% endfor %} | ||||||
|           {% endcache %} |          {% endcache %} | ||||||
|       {% endfor %} |       {% endfor %} | ||||||
| 
 | 
 | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ from django.conf import settings | ||||||
| from django.contrib.staticfiles.templatetags import staticfiles | from django.contrib.staticfiles.templatetags import staticfiles | ||||||
| from easy_thumbnails.files import get_thumbnailer | from easy_thumbnails.files import get_thumbnailer | ||||||
| from symposion.conference import models as conference_models | from symposion.conference import models as conference_models | ||||||
|  | from symposion.schedule.models import Track | ||||||
| 
 | 
 | ||||||
| CONFERENCE_ID = settings.CONFERENCE_ID | CONFERENCE_ID = settings.CONFERENCE_ID | ||||||
| 
 | 
 | ||||||
|  | @ -92,3 +93,11 @@ def gst(amount): | ||||||
| @register.simple_tag() | @register.simple_tag() | ||||||
| def conference_name(): | def conference_name(): | ||||||
|     return conference_models.Conference.objects.get(id=CONFERENCE_ID).title |     return conference_models.Conference.objects.get(id=CONFERENCE_ID).title | ||||||
|  | 
 | ||||||
|  | @register.filter() | ||||||
|  | def trackname(room, day): | ||||||
|  |     try: | ||||||
|  |         track_name = room.track_set.get(day=day).name | ||||||
|  |     except Track.DoesNotExist: | ||||||
|  |         track_name = None | ||||||
|  |     return track_name | ||||||
|  |  | ||||||
|  | @ -681,6 +681,14 @@ table th { | ||||||
|   text-transform: uppercase; |   text-transform: uppercase; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .track-name { | ||||||
|  |   margin-top: 0; | ||||||
|  |   margin-bottom: 0; | ||||||
|  |   font-weight: bold; | ||||||
|  |   text-transform: none; | ||||||
|  |   font-size: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| table th, table td { | table th, table td { | ||||||
|   padding: 10px; |   padding: 10px; | ||||||
|   padding: 0.625rem; |   padding: 0.625rem; | ||||||
|  |  | ||||||
|  | @ -33,9 +33,10 @@ function setupTabs() { | ||||||
| 	for (var x = 0; x < elements.length; x++) { | 	for (var x = 0; x < elements.length; x++) { | ||||||
| 		u.addEventListener(elements[x], 'click', tabClickhandler); | 		u.addEventListener(elements[x], 'click', tabClickhandler); | ||||||
| 	} | 	} | ||||||
| 	//Activate the first
 | 	// Activate the first element with 'is-active' found
 | ||||||
| 	var event = document.createEvent('Events'); | 	var event = document.createEvent('Events'); | ||||||
| 	event.initEvent('click', true, false); | 	event.initEvent('click', true, false); | ||||||
|  | 	elements = document.querySelectorAll('[data-tab-control].is-active'); | ||||||
| 	elements[0].dispatchEvent(event); | 	elements[0].dispatchEvent(event); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Scott Bragg
						Scott Bragg