Skip to content

Commit cbfbedf

Browse files
committed
Updated the IETF meeting agenda rendering so as to show the session links to materials, meetecho, jabber, notepad etc. also for narrov-screen devices such as phones, based on code from lars@eggert.org. Also moved some template code doing markup tweaking of the room name to a TimeSlot method, and factored out session start- and end-time display, repeated in 4 locations, to a template snipped. Added a new CSS class which provides less padding at the sides of pages on narrow devices.
- Legacy-Id: 18403
1 parent 6b560de commit cbfbedf

File tree

6 files changed

+103
-70
lines changed

6 files changed

+103
-70
lines changed

ietf/meeting/models.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#from django.template.defaultfilters import slugify, date as date_format, time as time_format
2424
from django.template.defaultfilters import date as date_format
2525
from django.utils.text import slugify
26+
from django.utils.safestring import mark_safe
2627

2728
from ietf.dbtemplate.models import DBTemplate
2829
from ietf.doc.models import Document
@@ -488,20 +489,19 @@ def end_time(self):
488489
return self.time + self.duration
489490

490491
def get_hidden_location(self):
491-
location = self.location
492-
if location:
493-
location = location.name
494-
elif self.type_id == "reg":
495-
location = self.meeting.reg_area
496-
elif self.type_id == "break":
497-
location = self.meeting.break_area
498-
return location
492+
if not hasattr(self, '_cached_hidden_location'):
493+
location = self.location
494+
if location:
495+
location = location.name
496+
elif self.type_id == "reg":
497+
location = self.meeting.reg_area
498+
elif self.type_id == "break":
499+
location = self.meeting.break_area
500+
self._cached_hidden_location = location
501+
return self._cached_hidden_location
499502

500503
def get_location(self):
501-
location = self.get_hidden_location()
502-
if not self.show_location:
503-
location = ""
504-
return location
504+
return self.get_hidden_location() if self.show_location else ""
505505

506506
def get_functional_location(self):
507507
name_parts = []
@@ -513,6 +513,15 @@ def get_functional_location(self):
513513
name_parts.append(location)
514514
return ' - '.join(name_parts)
515515

516+
def get_html_location(self):
517+
if not hasattr(self, '_cached_html_location'):
518+
self._cached_html_location = self.get_location()
519+
if len(self._cached_html_location) > 8:
520+
self._cached_html_location = mark_safe(self._cached_html_location.replace('/', '/<wbr>'))
521+
else:
522+
self._cached_html_location = mark_safe(self._cached_html_location.replace(' ', '&nbsp;'))
523+
return self._cached_html_location
524+
516525
def tz(self):
517526
if not hasattr(self, '_cached_tz'):
518527
if self.meeting.time_zone:

ietf/static/ietf/css/ietf.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,3 +1289,19 @@ a.fc-event, .fc-event, .fc-content, .fc-title, .fc-event-container {
12891289
cursor: default;
12901290
background-color: #eee;
12911291
}
1292+
1293+
/* A modified .container-fluid without padding on very narrow devices*/
1294+
.container-fluid-narrow {
1295+
padding-right: 15px;
1296+
padding-left: 15px;
1297+
margin-right: auto;
1298+
margin-left: auto;
1299+
}
1300+
@media (max-width: 480px) {
1301+
.container-fluid-narrow {
1302+
padding-right: 0;
1303+
padding-left: 0;
1304+
margin-right: auto;
1305+
margin-left: auto;
1306+
}
1307+
}

ietf/templates/base.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
</div>
8686
</div>
8787
</nav>
88-
<div class="container-fluid">
88+
<div class="container-fluid-narrow">
8989
{% comment %} {% bootstrap_messages %} {% endcomment %}
9090
{% for message in messages %}
9191
<div class="alert{% if message.level_tag %} alert-{% if message.level_tag == 'error' %}danger{% else %}{{ message.level_tag }}{% endif %}{% endif %}{% if message.extra_tags %} {{message.extra_tags}}{% endif %} alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&#215;</button>{{ message }}</div>
@@ -134,7 +134,7 @@
134134
</div>
135135

136136

137-
<footer class="row col-md-12 col-sm-12">
137+
<footer class="col-md-12 col-sm-12">
138138
<div class="col-md-12">
139139
<div class="text-center">
140140
<p class="small text-muted">

ietf/templates/meeting/agenda.html

Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ <h2>
155155
{% for item in filtered_assignments %}
156156

157157
{% ifchanged item.timeslot.time|date:"Y-m-d" %}
158-
<tr><th class="gap" colspan="6"></th></tr>
158+
<tr><th class="gap" colspan="5"></th></tr>
159159
<tr class="warning">
160-
<th colspan="6">
160+
<th colspan="5">
161161
{# The anchor here needs to be in a div, not in the th, in order for the anchor-target margin hack to work #}
162162
<div class="anchor-target" id="{{item.timeslot.time|slugify}}"></div>
163163
{% if "-utc" in request.path %}
@@ -173,13 +173,14 @@ <h2>
173173
{% ifchanged %}
174174
<tr class="info">
175175
<th class="text-nowrap text-right">
176-
{% if "-utc" in request.path %}
177-
{{item.timeslot.utc_start_time|date:"G:i"}}-{{item.timeslot.utc_end_time|date:"G:i"}}
178-
{% else %}
179-
{{item.timeslot.time|date:"G:i"}}-{{item.timeslot.end_time|date:"G:i"}}
180-
{% endif %}
176+
<span class="hidden-xs">
177+
{% include "meeting/timeslot_start_end.html" %}
178+
</span>
181179
</th>
182-
<th colspan="5">
180+
<th colspan="4">
181+
<span class="hidden-sm hidden-md hidden-lg">
182+
{% include "meeting/timeslot_start_end.html" %}
183+
</span>
183184
{% if "-utc" in request.path %}
184185
{{ item.timeslot.utc_start_time|date:"l"}}
185186
{% else %}
@@ -194,25 +195,28 @@ <h2>
194195
{% if item.timeslot.type.slug == 'break' or item.timeslot.type.slug == 'reg' or item.timeslot.type.slug == 'other' %}
195196
<tr id="row-{{ item.slug }}" timeslot-type="{{item.timeslot.type.slug}}">
196197
<td class="text-nowrap text-right">
197-
{% if "-utc" in request.path %}
198-
{{item.timeslot.utc_start_time|date:"G:i"}}-{{item.timeslot.utc_end_time|date:"G:i"}}
199-
{% else %}
200-
{{item.timeslot.time|date:"G:i"}}-{{item.timeslot.end_time|date:"G:i"}}
201-
{% endif %}
198+
<span class="hidden-xs">
199+
{% include "meeting/timeslot_start_end.html" %}
200+
</span>
202201
</td>
203202
<td colspan="3">
204-
{% if item.timeslot.show_location and item.timeslot.get_location %}
203+
<span class="hidden-sm hidden-md hidden-lg">
204+
{% include "meeting/timeslot_start_end.html" %}
205+
</span>
206+
{% if item.timeslot.show_location and item.timeslot.get_html_location %}
205207
{% if schedule.meeting.number|add:"0" < 96 %}
206-
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_location|xslugify }}">{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}</a>
208+
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
207209
{% elif item.timeslot.location.floorplan %}
208-
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}?room={{ item.timeslot.get_location|xslugify }}">{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}</a>
210+
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
209211
{% else %}
210-
{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}
212+
{{item.timeslot.get_html_location}}
211213
{% endif %}
212214
{% with item.timeslot.location.floorplan as floor %}
213215
{% if item.timeslot.location.floorplan %}
216+
<span class="hidden-xs">
214217
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}#{{floor.name|xslugify}}"
215218
class="pull-right" title="{{floor.name}}"><span class="label label-blank label-wide">{{floor.short}}</span></a>
219+
</span>
216220
{% endif %}
217221
{% endwith %}
218222
{% endif %}
@@ -228,22 +232,20 @@ <h2>
228232

229233
{% if item.session.current_status == 'canceled' %}
230234
<span class="label label-danger pull-right">CANCELLED</span>
235+
{% else %}
236+
<div class="pull-right padded-left">
237+
{% if item.timeslot.type.slug == 'other' %}
238+
{% if item.session.agenda or item.session.remote_instructions or item.session.agenda_note %}
239+
{% include "meeting/session_buttons_include.html" with show_agenda=True session=item.session meeting=schedule.meeting %}
240+
{% else %}
241+
{% for slide in item.session.slides %}
242+
<a href="{{slide.get_href}}">{{ slide.title|clean_whitespace }}</a>
243+
<br>
244+
{% endfor %}
245+
{% endif %}
246+
{% endif %}
247+
</div>
231248
{% endif %}
232-
233-
</td>
234-
<td class="col-md-2 text-right">
235-
<span class="hidden-xs">
236-
{% if item.timeslot.type.slug == 'other' %}
237-
{% if item.session.agenda or item.session.remote_instructions or item.session.agenda_note %}
238-
{% include "meeting/session_buttons_include.html" with show_agenda=True session=item.session meeting=schedule.meeting %}
239-
{% else %}
240-
{% for slide in item.session.slides %}
241-
<a href="{{slide.get_href}}">{{ slide.title|clean_whitespace }}</a>
242-
<br>
243-
{% endfor %}
244-
{% endif %}
245-
{% endif %}
246-
</span>
247249
</td>
248250
</tr>
249251
{% endif %}
@@ -253,20 +255,21 @@ <h2>
253255
<tr id="row-{{item.slug}}" timeslot-type="{{item.timeslot.type.slug}}" data-ske="row-{{ item.slug }}" {% if item.timeslot.type.slug == 'plenary' %}class="{{item.timeslot.type.slug}}danger"{% endif %}>
254256
{% if item.timeslot.type.slug == 'plenary' %}
255257
<th class="text-nowrap text-right">
256-
{% if "-utc" in request.path %}
257-
{{item.timeslot.utc_start_time|date:"G:i"}}-{{item.timeslot.utc_end_time|date:"G:i"}}
258-
{% else %}
259-
{{item.timeslot.time|date:"G:i"}}-{{item.timeslot.end_time|date:"G:i"}}
260-
{% endif %}
258+
<span class="hidden-xs">
259+
{% include "meeting/timeslot_start_end.html" %}
260+
</span>
261261
</th>
262262
<td colspan="3">
263-
{% if item.timeslot.show_location and item.timeslot.get_location %}
263+
<span class="hidden-sm hidden-md hidden-lg">
264+
{% include "meeting/timeslot_start_end.html" %}
265+
</span>
266+
{% if item.timeslot.show_location and item.timeslot.get_html_location %}
264267
{% if schedule.meeting.number|add:"0" < 96 %}
265-
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_location|xslugify }}">{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}</a>
268+
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
266269
{% elif item.timeslot.location.floorplan %}
267-
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}?room={{ item.timeslot.get_location|xslugify }}">{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}</a>
270+
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
268271
{% else %}
269-
{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}
272+
{{item.timeslot.get_html_location}}
270273
{% endif %}
271274
{% endif %}
272275
</td>
@@ -275,19 +278,21 @@ <h2>
275278
<td>
276279
{% with item.timeslot.location.floorplan as floor %}
277280
{% if item.timeslot.location.floorplan %}
281+
<span class="hidden-xs">
278282
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}#{{floor.name|xslugify}}"
279283
class="pull-right" title="{{floor.name}}"><span class="label label-blank">{{floor.short}}</span></a>
284+
</span>
280285
{% endif %}
281286
{% endwith %}
282287
</td>
283288
<td>
284-
{% if item.timeslot.show_location and item.timeslot.get_location %}
289+
{% if item.timeslot.show_location and item.timeslot.get_html_location %}
285290
{% if schedule.meeting.number|add:"0" < 96 %}
286-
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_location|xslugify }}">{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}</a>
291+
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
287292
{% elif item.timeslot.location.floorplan %}
288-
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}?room={{ item.timeslot.get_location|xslugify }}">{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}</a>
293+
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
289294
{% else %}
290-
{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}
295+
{{item.timeslot.get_html_location}}
291296
{% endif %}
292297
{% endif %}
293298
</td>
@@ -316,25 +321,23 @@ <h2>
316321
</a>
317322
{% endif %}
318323

319-
{% if item.session.historic_group.state_id == "bof" %}
320-
<span class="label label-success pull-right">BOF</span>
321-
{% endif %}
322-
323324
{% if item.session.current_status == 'canceled' %}
324325
<span class="label label-danger pull-right">CANCELLED</span>
326+
{% else %}
327+
<div class="pull-right padded-left">
328+
{% include "meeting/session_buttons_include.html" with show_agenda=True session=item.session meeting=schedule.meeting %}
329+
</div>
330+
{% endif %}
331+
332+
{% if item.session.historic_group.state_id == "bof" %}
333+
<span class="label label-success pull-right">BOF</span>
325334
{% endif %}
326335

327336
{% if item.session.agenda_note|first_url|conference_url %}
328337
<br><a href={{item.session.agenda_note|first_url}}>{{item.session.agenda_note|slice:":23"}}</a>
329338
{% elif item.session.agenda_note %}
330339
<br><span class="text-danger">{{item.session.agenda_note}}</span>
331340
{% endif %}
332-
333-
</td>
334-
<td class="text-nowrap text-right">
335-
<span class="hidden-xs">
336-
{% include "meeting/session_buttons_include.html" with show_agenda=True session=item.session meeting=schedule.meeting %}
337-
</span>
338341
</td>
339342
</tr>
340343
{% endif %}

ietf/templates/meeting/session_buttons_include.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{% load textfilters %}
55
{% origin %}
66

7-
<span id="session-buttons-{{session.pk}}">
7+
<span id="session-buttons-{{session.pk}}" class="text-nowrap">
88
{% with acronym=session.historic_group.acronym %}
99
{% if session.agenda and show_agenda %}
1010
{% include "meeting/session_agenda_include.html" %}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% if "-utc" in request.path %}
2+
{{item.timeslot.utc_start_time|date:"G:i"}}-{{item.timeslot.utc_end_time|date:"G:i"}}
3+
{% else %}
4+
{{item.timeslot.time|date:"G:i"}}-{{item.timeslot.end_time|date:"G:i"}}
5+
{% endif %}

0 commit comments

Comments
 (0)