From 84d5293fbc37caa5abc2d25cc36eae89b2c588b7 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 7 Sep 2013 10:14:54 +0200 Subject: [PATCH] Rework (projector) template with bootstrap. - Always use templatetag 'absolute_url' instead of (depricated) 'model_url'. Search and replace all old arguments: edit -> update, view -> detail, delete - Fixed bug in setting default value in 'absolute_url' templatetag (default value is defined in models.py only). Updated 'backend' template. --- openslides/agenda/templates/agenda/edit.html | 2 +- .../agenda/templates/agenda/item_row.html | 2 +- .../agenda/templates/agenda/item_slide.html | 10 +- .../agenda/item_slide_list_of_speaker.html | 4 +- .../templates/agenda/speaker_widget.html | 1 + .../agenda/templates/agenda/widget.html | 2 +- openslides/agenda/views.py | 2 +- .../assignment/assignment_detail.html | 8 +- .../templates/assignment/assignment_form.html | 7 +- .../templates/assignment/assignment_list.html | 8 +- .../templates/assignment/slide.html | 23 ++- openslides/core/templatetags/tags.py | 14 +- openslides/motion/static/styles/motion.css | 3 + .../templates/motion/category_list.html | 6 +- .../templates/motion/motion_detail.html | 11 +- .../motion/templates/motion/motion_form.html | 2 +- .../motion/templates/motion/motion_list.html | 13 +- openslides/motion/templates/motion/slide.html | 44 ++-- .../motion/templates/motion/widget.html | 2 +- openslides/participant/forms.py | 2 +- .../templates/participant/group_overview.html | 10 +- .../templates/participant/group_slide.html | 11 +- .../templates/participant/import.html | 2 +- .../templates/participant/overview.html | 6 +- .../templates/participant/user_slide.html | 30 +-- .../templates/participant/user_widget.html | 2 +- .../static/img/presentation-header-bg.png | Bin 1046 -> 0 bytes .../projector/static/styles/projector.css | 193 +++++++++--------- openslides/projector/templates/projector.html | 23 ++- .../templates/projector/default_slide.html | 3 +- .../overlay_countdown_projector.html | 6 +- .../projector/slide_projectorslide.html | 7 +- tests/participant/test_views.py | 2 +- 33 files changed, 246 insertions(+), 215 deletions(-) delete mode 100644 openslides/projector/static/img/presentation-header-bg.png diff --git a/openslides/agenda/templates/agenda/edit.html b/openslides/agenda/templates/agenda/edit.html index 74886d454..4d26f393f 100644 --- a/openslides/agenda/templates/agenda/edit.html +++ b/openslides/agenda/templates/agenda/edit.html @@ -5,7 +5,7 @@ {% block title %} {% if item %} - {{ item.title }} – {% trans "Edit item" %} + {{ item }} – {% trans "Edit item" %} {% else %} {% trans "New item" %} {% endif %} diff --git a/openslides/agenda/templates/agenda/item_row.html b/openslides/agenda/templates/agenda/item_row.html index 14c8b86e1..0491e082d 100644 --- a/openslides/agenda/templates/agenda/item_row.html +++ b/openslides/agenda/templates/agenda/item_row.html @@ -18,7 +18,7 @@ {% endif %} {% if perms.agenda.can_manage_agenda %} - + diff --git a/openslides/agenda/templates/agenda/item_slide.html b/openslides/agenda/templates/agenda/item_slide.html index 9fad18538..f8fc53c8d 100644 --- a/openslides/agenda/templates/agenda/item_slide.html +++ b/openslides/agenda/templates/agenda/item_slide.html @@ -1,8 +1,10 @@ {% load i18n %} +

+ {{ item }} +
+

+ {% if item.text %} -

{{ item }}

- {{ item.text|safe|linebreaks }} -{% else %} -
{{ item }}
+ {{ item.text|safe|linebreaks }} {% endif %} diff --git a/openslides/agenda/templates/agenda/item_slide_list_of_speaker.html b/openslides/agenda/templates/agenda/item_slide_list_of_speaker.html index a1a4611b2..97bfb329e 100644 --- a/openslides/agenda/templates/agenda/item_slide_list_of_speaker.html +++ b/openslides/agenda/templates/agenda/item_slide_list_of_speaker.html @@ -16,10 +16,10 @@

{{ title }}

-

+

{% trans 'List of speakers' %} {% if item.speaker_list_closed %}({% trans 'closed' %}){% endif %} -

+

{% if list_of_speakers %} diff --git a/openslides/agenda/templates/agenda/speaker_widget.html b/openslides/agenda/templates/agenda/speaker_widget.html index b3ea0fcda..a0265bd70 100644 --- a/openslides/agenda/templates/agenda/speaker_widget.html +++ b/openslides/agenda/templates/agenda/speaker_widget.html @@ -10,4 +10,5 @@


{% trans 'Next speaker' %} {% trans 'End speach' %} +
{% endif %} diff --git a/openslides/agenda/templates/agenda/widget.html b/openslides/agenda/templates/agenda/widget.html index 86ebfb1b2..ce9a49f5f 100644 --- a/openslides/agenda/templates/agenda/widget.html +++ b/openslides/agenda/templates/agenda/widget.html @@ -23,7 +23,7 @@ rel="tooltip" data-original-title="{% trans 'Show' %}">   - + diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index acb865750..f306fc727 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -85,7 +85,7 @@ class Overview(TemplateView): active_slide = get_active_slide() if active_slide['callback'] == 'agenda': - agenda_active = active_slide.get('pk', 'agenda') == 'agenda' + agenda_is_active = active_slide.get('pk', 'agenda') == 'agenda' active_type = active_slide.get('type', 'text') else: agenda_is_active = None diff --git a/openslides/assignment/templates/assignment/assignment_detail.html b/openslides/assignment/templates/assignment/assignment_detail.html index 690043390..bba20fbaa 100644 --- a/openslides/assignment/templates/assignment/assignment_detail.html +++ b/openslides/assignment/templates/assignment/assignment_detail.html @@ -23,8 +23,10 @@ PDF {% if perms.projector.can_manage_projector %} - - + + {% endif %} {% if perms.assignment.can_manage_assignment or perms.agenda.can_manage_agenda %} @@ -177,7 +179,7 @@ {% endfor %} {% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %} - + {% trans 'New ballot' %} diff --git a/openslides/assignment/templates/assignment/assignment_form.html b/openslides/assignment/templates/assignment/assignment_form.html index 2f16d43df..f3105a19a 100644 --- a/openslides/assignment/templates/assignment/assignment_form.html +++ b/openslides/assignment/templates/assignment/assignment_form.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load i18n %} +{% load tags %} {% block title %} {% if assignment %} @@ -19,7 +20,11 @@ {% trans "New election" %} {% endif %} - {% trans "Back to overview" %} + {% if assignment %} + {% trans "Back to election" %} + {% else %} + {% trans "Back to overview" %} + {% endif %} diff --git a/openslides/assignment/templates/assignment/assignment_list.html b/openslides/assignment/templates/assignment/assignment_list.html index c312c0d2d..910357827 100644 --- a/openslides/assignment/templates/assignment/assignment_list.html +++ b/openslides/assignment/templates/assignment/assignment_list.html @@ -37,7 +37,7 @@ {% for object in object_list %} - + {{ object }} @@ -54,10 +54,10 @@ {% if perms.projector.can_manage_projector %} - - + {% endif %} {% if perms.assignment.can_manage_assignment %} diff --git a/openslides/assignment/templates/assignment/slide.html b/openslides/assignment/templates/assignment/slide.html index fce79f415..39e633a04 100644 --- a/openslides/assignment/templates/assignment/slide.html +++ b/openslides/assignment/templates/assignment/slide.html @@ -2,20 +2,23 @@ {% load staticfiles %} {% load tags %} -{% if assignment.status != "fin" %} -{% endif %} -

{% trans "Election" %}: {{ assignment }}

+

{{ assignment }} +
+ + {% trans "Election" %} + +
+

{% if not assignment.candidates %}

{{ assignment.description|linebreaks }}
diff --git a/openslides/core/templatetags/tags.py b/openslides/core/templatetags/tags.py index 6dd6ac7a2..6e1f342fa 100644 --- a/openslides/core/templatetags/tags.py +++ b/openslides/core/templatetags/tags.py @@ -46,17 +46,21 @@ def model_url(object, link='view'): @register.filter -def absolute_url(model, link='detail'): +def absolute_url(model, link=None): """ Returns the absolute_url to a model. The 'link' argument decides which url will be returned. See get_absolute_url() in the model. Example: {{ motion|absolute_url:'delete' }} """ - try: - return model.get_absolute_url(link) - except ValueError: - return '' + if link is None: + url = model.get_absolute_url() + else: + try: + url = model.get_absolute_url(link) + except ValueError: + url = '' + return url @register.filter diff --git a/openslides/motion/static/styles/motion.css b/openslides/motion/static/styles/motion.css index 5bba51dbb..262fd5b0e 100644 --- a/openslides/motion/static/styles/motion.css +++ b/openslides/motion/static/styles/motion.css @@ -46,3 +46,6 @@ td.diff_header { margin-top: 5px; margin-bottom: 15px; } +#motion-vote-results img { + margin-top: -4px; +} diff --git a/openslides/motion/templates/motion/category_list.html b/openslides/motion/templates/motion/category_list.html index 924709948..88472c5ba 100644 --- a/openslides/motion/templates/motion/category_list.html +++ b/openslides/motion/templates/motion/category_list.html @@ -25,12 +25,12 @@ {% for category in category_list %} {{ category.prefix }} - {{ category }} + {{ category }} - - diff --git a/openslides/motion/templates/motion/motion_detail.html b/openslides/motion/templates/motion/motion_detail.html index 01ae8fe3f..ad51aac62 100644 --- a/openslides/motion/templates/motion/motion_detail.html +++ b/openslides/motion/templates/motion/motion_detail.html @@ -22,16 +22,15 @@ {% endif %} - + {% trans "Back to overview" %} PDF {% if perms.projector.can_manage_projector %} - - + + {% endif %} {% if perms.motion.can_manage_motion or perms.agenda.can_manage_agenda or allowed_actions.edit %} @@ -42,7 +41,7 @@