From cbfbedf2d3a87ef41e76fa2c4ba41f9a28d72de3 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Fri, 21 Aug 2020 13:40:14 +0000 Subject: [PATCH] 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 --- ietf/meeting/models.py | 33 +++-- ietf/static/ietf/css/ietf.css | 16 +++ ietf/templates/base.html | 4 +- ietf/templates/meeting/agenda.html | 113 +++++++++--------- .../meeting/session_buttons_include.html | 2 +- .../templates/meeting/timeslot_start_end.html | 5 + 6 files changed, 103 insertions(+), 70 deletions(-) create mode 100644 ietf/templates/meeting/timeslot_start_end.html diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py index 70dbffbee..5df942106 100644 --- a/ietf/meeting/models.py +++ b/ietf/meeting/models.py @@ -23,6 +23,7 @@ from django.conf import settings #from django.template.defaultfilters import slugify, date as date_format, time as time_format from django.template.defaultfilters import date as date_format from django.utils.text import slugify +from django.utils.safestring import mark_safe from ietf.dbtemplate.models import DBTemplate from ietf.doc.models import Document @@ -488,20 +489,19 @@ class TimeSlot(models.Model): return self.time + self.duration def get_hidden_location(self): - location = self.location - if location: - location = location.name - elif self.type_id == "reg": - location = self.meeting.reg_area - elif self.type_id == "break": - location = self.meeting.break_area - return location + if not hasattr(self, '_cached_hidden_location'): + location = self.location + if location: + location = location.name + elif self.type_id == "reg": + location = self.meeting.reg_area + elif self.type_id == "break": + location = self.meeting.break_area + self._cached_hidden_location = location + return self._cached_hidden_location def get_location(self): - location = self.get_hidden_location() - if not self.show_location: - location = "" - return location + return self.get_hidden_location() if self.show_location else "" def get_functional_location(self): name_parts = [] @@ -513,6 +513,15 @@ class TimeSlot(models.Model): name_parts.append(location) return ' - '.join(name_parts) + def get_html_location(self): + if not hasattr(self, '_cached_html_location'): + self._cached_html_location = self.get_location() + if len(self._cached_html_location) > 8: + self._cached_html_location = mark_safe(self._cached_html_location.replace('/', '/')) + else: + self._cached_html_location = mark_safe(self._cached_html_location.replace(' ', ' ')) + return self._cached_html_location + def tz(self): if not hasattr(self, '_cached_tz'): if self.meeting.time_zone: diff --git a/ietf/static/ietf/css/ietf.css b/ietf/static/ietf/css/ietf.css index 8d5f65829..aab014f5c 100644 --- a/ietf/static/ietf/css/ietf.css +++ b/ietf/static/ietf/css/ietf.css @@ -1289,3 +1289,19 @@ a.fc-event, .fc-event, .fc-content, .fc-title, .fc-event-container { cursor: default; background-color: #eee; } + +/* A modified .container-fluid without padding on very narrow devices*/ +.container-fluid-narrow { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} +@media (max-width: 480px) { + .container-fluid-narrow { + padding-right: 0; + padding-left: 0; + margin-right: auto; + margin-left: auto; + } +} \ No newline at end of file diff --git a/ietf/templates/base.html b/ietf/templates/base.html index 791785abd..1ad7555d5 100644 --- a/ietf/templates/base.html +++ b/ietf/templates/base.html @@ -85,7 +85,7 @@ -
+
{% comment %} {% bootstrap_messages %} {% endcomment %} {% for message in messages %}
{{ message }}
@@ -134,7 +134,7 @@
-