From f75ec3622af4dacf217a661b51ae5ad42d53b86b Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Mon, 12 Jun 2017 21:00:08 +0000 Subject: [PATCH] A first go at adding floor labels to the agenda pages. The placement of the labels are complicated by available whitespace beeing in different horizontal positions for different types of lines. Adding another column will push the session title out of the screen on small devices. - Legacy-Id: 13587 --- ietf/meeting/admin.py | 2 +- ietf/meeting/factories.py | 1 + .../migrations/0052_floorplan_short.py | 45 +++++++++++++++++++ ietf/meeting/models.py | 1 + ietf/meeting/resources.py | 1 + ietf/static/ietf/css/ietf.css | 4 +- ietf/templates/meeting/agenda.html | 16 ++++++- 7 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 ietf/meeting/migrations/0052_floorplan_short.py diff --git a/ietf/meeting/admin.py b/ietf/meeting/admin.py index 6bbaf9690..960bc1295 100644 --- a/ietf/meeting/admin.py +++ b/ietf/meeting/admin.py @@ -116,7 +116,7 @@ class ResourceAssociationAdmin(admin.ModelAdmin): admin.site.register(ResourceAssociation, ResourceAssociationAdmin) class FloorPlanAdmin(admin.ModelAdmin): - list_display = ['id', 'meeting', 'name', 'order', 'image', ] + list_display = ['id', 'meeting', 'name', 'short', 'order', 'image', ] raw_id_fields = ['meeting', ] admin.site.register(FloorPlan, FloorPlanAdmin) diff --git a/ietf/meeting/factories.py b/ietf/meeting/factories.py index a4c82275c..324ef29df 100644 --- a/ietf/meeting/factories.py +++ b/ietf/meeting/factories.py @@ -112,6 +112,7 @@ class FloorPlanFactory(factory.DjangoModelFactory): model = FloorPlan name = factory.Sequence(lambda n: u'Venue Floor %d' % n) + short = factory.Sequence(lambda n: u'%d' % n) meeting = factory.SubFactory(MeetingFactory) order = factory.Sequence(lambda n: n) image = factory.LazyAttribute( diff --git a/ietf/meeting/migrations/0052_floorplan_short.py b/ietf/meeting/migrations/0052_floorplan_short.py new file mode 100644 index 000000000..4a82ddf7e --- /dev/null +++ b/ietf/meeting/migrations/0052_floorplan_short.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2017-06-12 02:45 +from __future__ import unicode_literals + +from django.db import migrations, models + + +def forwards(apps, schema_editor): + floors = { + # id, meeting, name, short + 1: ("Berlin Intercontinental Floor 1", "1"), + 2: ("Berlin Intercontinental Floor 2", "2"), + 3: ("Berlin Intercontinental Floor 14", "14"), + 4: ("Seoul Conrad Floor 3", "3"), + 5: ("Seoul Conrad Floor 5", "5"), + 6: ("Seoul Conrad Floor 6", "6"), + 7: ("Chicago Swissotel Ballroom Level", "BL"), + 8: ("Chicago Swissotel Concourse Level", "CC"), + 9: ("Chicago Swissotel Floor 2", "2"), + 10:("Chicago Swissotel Floor 3", "3"), + } + FloorPlan = apps.get_model('meeting', "FloorPlan") + for f in FloorPlan.objects.all(): + name, short = floors[f.pk] + assert f.name == name, ("Unexpected floorplan name. Expected '%s' for FlooPlan#%s, found '%s' in the database"%(name, f.id, f.name)) + f.short = short + f.save() + +def backwards(apps, schema_editor): + pass + +class Migration(migrations.Migration): + + dependencies = [ + ('meeting', '0051_auto_20170511_0449'), + ] + + operations = [ + migrations.AddField( + model_name='floorplan', + name='short', + field=models.CharField(default=b'', max_length=2), + ), + migrations.RunPython(forwards, backwards), + ] diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py index c05a8d8a5..87cc40620 100644 --- a/ietf/meeting/models.py +++ b/ietf/meeting/models.py @@ -383,6 +383,7 @@ def floorplan_path(instance, filename): class FloorPlan(models.Model): name = models.CharField(max_length=255) + short = models.CharField(max_length=2, default='') time = models.DateTimeField(default=datetime.datetime.now) meeting = models.ForeignKey(Meeting) order = models.SmallIntegerField() diff --git a/ietf/meeting/resources.py b/ietf/meeting/resources.py index 0155c950e..fa44de60b 100644 --- a/ietf/meeting/resources.py +++ b/ietf/meeting/resources.py @@ -98,6 +98,7 @@ class FloorPlanResource(ModelResource): filtering = { "id": ALL, "name": ALL, + "short": ALL, "time": ALL, "order": ALL, "image": ALL, diff --git a/ietf/static/ietf/css/ietf.css b/ietf/static/ietf/css/ietf.css index 8d014938f..96fb06b6d 100644 --- a/ietf/static/ietf/css/ietf.css +++ b/ietf/static/ietf/css/ietf.css @@ -120,10 +120,12 @@ div.anchor-target { z-index: 0; } .panel-title { font-size: 14px } /* A new type of Bootstrap label and panel*/ -.label-blank { color: #555; background-color: #eee; } +.label-blank { color: #555; background-color: #eee; font-size: 0.9em; line-height: 0.9; padding: 0.2em 0.6em; } +.label.label-wide { margin-left: 1em; margin-right: 1em; } .panel-blank { color: #555; } .panel-blank > .panel-heading { background-color: #eee; } + /* Required form field labels - 2217 = ∗ */ label.required:after { content: "\2217"; color: #a94442; font-weight: bold; } diff --git a/ietf/templates/meeting/agenda.html b/ietf/templates/meeting/agenda.html index cb085cd6f..a596b0555 100644 --- a/ietf/templates/meeting/agenda.html +++ b/ietf/templates/meeting/agenda.html @@ -200,6 +200,12 @@ {% else %} {{item.timeslot.get_location|split:"/"|join:"/"}} {% endif %} + {% with item.timeslot.location.floorplan as floor %} + {% if item.timeslot.location.floorplan %} + {{floor.short}} + {% endif %} + {% endwith %} {% endif %} @@ -245,8 +251,14 @@ {% else %} - - + + {% with item.timeslot.location.floorplan as floor %} + {% if item.timeslot.location.floorplan %} + {{floor.short}} + {% endif %} + {% endwith %} + {% if item.timeslot.show_location and item.timeslot.get_location %} {% if schedule.meeting.number|add:"0" < 96 %}