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
This commit is contained in:
Henrik Levkowetz 2020-08-21 13:40:14 +00:00
parent 6b560de71d
commit cbfbedf2d3
6 changed files with 103 additions and 70 deletions

View file

@ -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('/', '/<wbr>'))
else:
self._cached_html_location = mark_safe(self._cached_html_location.replace(' ', '&nbsp;'))
return self._cached_html_location
def tz(self):
if not hasattr(self, '_cached_tz'):
if self.meeting.time_zone:

View file

@ -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;
}
}

View file

@ -85,7 +85,7 @@
</div>
</div>
</nav>
<div class="container-fluid">
<div class="container-fluid-narrow">
{% comment %} {% bootstrap_messages %} {% endcomment %}
{% for message in messages %}
<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 @@
</div>
<footer class="row col-md-12 col-sm-12">
<footer class="col-md-12 col-sm-12">
<div class="col-md-12">
<div class="text-center">
<p class="small text-muted">

View file

@ -155,9 +155,9 @@
{% for item in filtered_assignments %}
{% ifchanged item.timeslot.time|date:"Y-m-d" %}
<tr><th class="gap" colspan="6"></th></tr>
<tr><th class="gap" colspan="5"></th></tr>
<tr class="warning">
<th colspan="6">
<th colspan="5">
{# The anchor here needs to be in a div, not in the th, in order for the anchor-target margin hack to work #}
<div class="anchor-target" id="{{item.timeslot.time|slugify}}"></div>
{% if "-utc" in request.path %}
@ -173,13 +173,14 @@
{% ifchanged %}
<tr class="info">
<th class="text-nowrap text-right">
{% if "-utc" in request.path %}
{{item.timeslot.utc_start_time|date:"G:i"}}-{{item.timeslot.utc_end_time|date:"G:i"}}
{% else %}
{{item.timeslot.time|date:"G:i"}}-{{item.timeslot.end_time|date:"G:i"}}
{% endif %}
<span class="hidden-xs">
{% include "meeting/timeslot_start_end.html" %}
</span>
</th>
<th colspan="5">
<th colspan="4">
<span class="hidden-sm hidden-md hidden-lg">
{% include "meeting/timeslot_start_end.html" %}
</span>
{% if "-utc" in request.path %}
{{ item.timeslot.utc_start_time|date:"l"}}
{% else %}
@ -194,25 +195,28 @@
{% if item.timeslot.type.slug == 'break' or item.timeslot.type.slug == 'reg' or item.timeslot.type.slug == 'other' %}
<tr id="row-{{ item.slug }}" timeslot-type="{{item.timeslot.type.slug}}">
<td class="text-nowrap text-right">
{% if "-utc" in request.path %}
{{item.timeslot.utc_start_time|date:"G:i"}}-{{item.timeslot.utc_end_time|date:"G:i"}}
{% else %}
{{item.timeslot.time|date:"G:i"}}-{{item.timeslot.end_time|date:"G:i"}}
{% endif %}
<span class="hidden-xs">
{% include "meeting/timeslot_start_end.html" %}
</span>
</td>
<td colspan="3">
{% if item.timeslot.show_location and item.timeslot.get_location %}
<span class="hidden-sm hidden-md hidden-lg">
{% include "meeting/timeslot_start_end.html" %}
</span>
{% if item.timeslot.show_location and item.timeslot.get_html_location %}
{% if schedule.meeting.number|add:"0" < 96 %}
<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>
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
{% elif item.timeslot.location.floorplan %}
<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>
<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>
{% else %}
{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}
{{item.timeslot.get_html_location}}
{% endif %}
{% with item.timeslot.location.floorplan as floor %}
{% if item.timeslot.location.floorplan %}
<span class="hidden-xs">
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}#{{floor.name|xslugify}}"
class="pull-right" title="{{floor.name}}"><span class="label label-blank label-wide">{{floor.short}}</span></a>
</span>
{% endif %}
{% endwith %}
{% endif %}
@ -228,22 +232,20 @@
{% if item.session.current_status == 'canceled' %}
<span class="label label-danger pull-right">CANCELLED</span>
{% else %}
<div class="pull-right padded-left">
{% if item.timeslot.type.slug == 'other' %}
{% if item.session.agenda or item.session.remote_instructions or item.session.agenda_note %}
{% include "meeting/session_buttons_include.html" with show_agenda=True session=item.session meeting=schedule.meeting %}
{% else %}
{% for slide in item.session.slides %}
<a href="{{slide.get_href}}">{{ slide.title|clean_whitespace }}</a>
<br>
{% endfor %}
{% endif %}
{% endif %}
</div>
{% endif %}
</td>
<td class="col-md-2 text-right">
<span class="hidden-xs">
{% if item.timeslot.type.slug == 'other' %}
{% if item.session.agenda or item.session.remote_instructions or item.session.agenda_note %}
{% include "meeting/session_buttons_include.html" with show_agenda=True session=item.session meeting=schedule.meeting %}
{% else %}
{% for slide in item.session.slides %}
<a href="{{slide.get_href}}">{{ slide.title|clean_whitespace }}</a>
<br>
{% endfor %}
{% endif %}
{% endif %}
</span>
</td>
</tr>
{% endif %}
@ -253,20 +255,21 @@
<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 %}>
{% if item.timeslot.type.slug == 'plenary' %}
<th class="text-nowrap text-right">
{% if "-utc" in request.path %}
{{item.timeslot.utc_start_time|date:"G:i"}}-{{item.timeslot.utc_end_time|date:"G:i"}}
{% else %}
{{item.timeslot.time|date:"G:i"}}-{{item.timeslot.end_time|date:"G:i"}}
{% endif %}
<span class="hidden-xs">
{% include "meeting/timeslot_start_end.html" %}
</span>
</th>
<td colspan="3">
{% if item.timeslot.show_location and item.timeslot.get_location %}
<span class="hidden-sm hidden-md hidden-lg">
{% include "meeting/timeslot_start_end.html" %}
</span>
{% if item.timeslot.show_location and item.timeslot.get_html_location %}
{% if schedule.meeting.number|add:"0" < 96 %}
<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>
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
{% elif item.timeslot.location.floorplan %}
<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>
<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>
{% else %}
{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}
{{item.timeslot.get_html_location}}
{% endif %}
{% endif %}
</td>
@ -275,19 +278,21 @@
<td>
{% with item.timeslot.location.floorplan as floor %}
{% if item.timeslot.location.floorplan %}
<span class="hidden-xs">
<a href="{% url 'ietf.meeting.views.floor_plan' num=schedule.meeting.number %}#{{floor.name|xslugify}}"
class="pull-right" title="{{floor.name}}"><span class="label label-blank">{{floor.short}}</span></a>
</span>
{% endif %}
{% endwith %}
</td>
<td>
{% if item.timeslot.show_location and item.timeslot.get_location %}
{% if item.timeslot.show_location and item.timeslot.get_html_location %}
{% if schedule.meeting.number|add:"0" < 96 %}
<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>
<a href="https://tools.ietf.org/agenda/{{schedule.meeting.number}}/venue/?room={{ item.timeslot.get_html_location|xslugify }}">{{item.timeslot.get_html_location}}</a>
{% elif item.timeslot.location.floorplan %}
<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>
<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>
{% else %}
{{item.timeslot.get_location|split:"/"|join:"/<wbr>"}}
{{item.timeslot.get_html_location}}
{% endif %}
{% endif %}
</td>
@ -316,12 +321,16 @@
</a>
{% endif %}
{% if item.session.historic_group.state_id == "bof" %}
<span class="label label-success pull-right">BOF</span>
{% endif %}
{% if item.session.current_status == 'canceled' %}
<span class="label label-danger pull-right">CANCELLED</span>
{% else %}
<div class="pull-right padded-left">
{% include "meeting/session_buttons_include.html" with show_agenda=True session=item.session meeting=schedule.meeting %}
</div>
{% endif %}
{% if item.session.historic_group.state_id == "bof" %}
<span class="label label-success pull-right">BOF</span>
{% endif %}
{% if item.session.agenda_note|first_url|conference_url %}
@ -329,12 +338,6 @@
{% elif item.session.agenda_note %}
<br><span class="text-danger">{{item.session.agenda_note}}</span>
{% endif %}
</td>
<td class="text-nowrap text-right">
<span class="hidden-xs">
{% include "meeting/session_buttons_include.html" with show_agenda=True session=item.session meeting=schedule.meeting %}
</span>
</td>
</tr>
{% endif %}

View file

@ -4,7 +4,7 @@
{% load textfilters %}
{% origin %}
<span id="session-buttons-{{session.pk}}">
<span id="session-buttons-{{session.pk}}" class="text-nowrap">
{% with acronym=session.historic_group.acronym %}
{% if session.agenda and show_agenda %}
{% include "meeting/session_agenda_include.html" %}

View file

@ -0,0 +1,5 @@
{% if "-utc" in request.path %}
{{item.timeslot.utc_start_time|date:"G:i"}}-{{item.timeslot.utc_end_time|date:"G:i"}}
{% else %}
{{item.timeslot.time|date:"G:i"}}-{{item.timeslot.end_time|date:"G:i"}}
{% endif %}