diff --git a/openslides/agenda/templates/agenda/item_slide.html b/openslides/agenda/templates/agenda/item_slide.html index f8fc53c8d..296fec8b2 100644 --- a/openslides/agenda/templates/agenda/item_slide.html +++ b/openslides/agenda/templates/agenda/item_slide.html @@ -5,6 +5,8 @@
-{% if item.text %} - {{ item.text|safe|linebreaks }} -{% endif %} +
+ {% if item.text %} + {{ 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 97bfb329e..c6960681d 100644 --- a/openslides/agenda/templates/agenda/item_slide_list_of_speaker.html +++ b/openslides/agenda/templates/agenda/item_slide_list_of_speaker.html @@ -21,7 +21,7 @@ {% if item.speaker_list_closed %}({% trans 'closed' %}){% endif %} -

+

{% if list_of_speakers %}
diff --git a/openslides/assignment/templates/assignment/slide.html b/openslides/assignment/templates/assignment/slide.html index 93ffc00c1..70cc54c36 100644 --- a/openslides/assignment/templates/assignment/slide.html +++ b/openslides/assignment/templates/assignment/slide.html @@ -19,92 +19,94 @@
-{% if not assignment.candidates %} -

-

{{ assignment.description|linebreaks }}
-

-{% endif %} +
+ {% if not assignment.candidates %} +

+

{{ assignment.description|linebreaks }}
+

+ {% endif %} -{% if assignment.candidates and assignment.status != "fin" %} -

{% trans "Candidates" %}

-
    - {% for candidate in assignment.candidates %} -
  1. {{ candidate }}
  2. - {% empty %} -
  3. - {% trans "No candidates available." %} -
  4. - {% endfor %} -
-


-{% endif %} + {% if assignment.candidates and assignment.status != "fin" %} +

{% trans "Candidates" %}

+
    + {% for candidate in assignment.candidates %} +
  1. {{ candidate }}
  2. + {% empty %} +
  3. + {% trans "No candidates available." %} +
  4. + {% endfor %} +
+


+ {% endif %} -{% if polls.exists %} -

{% trans "Election results" %}

- - - - {% for poll in polls %} - - {% endfor %} - - {% for candidate, poll_list in vote_results.items %} + {% if polls.exists %} +

{% trans "Election results" %}

+
{% trans "Candidates" %} - {{ poll.get_ballot }}. {% trans "ballot" %} -
- - {% for vote in poll_list %} - + {% for poll in polls %} + + {% endfor %} + + {% for candidate, poll_list in vote_results.items %} + + + {% for vote in poll_list %} + + + {% endfor %} + {% endfor %} - - {% endfor %} - - - {% for poll in polls %} - + + + {% for poll in polls %} + - {% endfor %} - - - - {% for poll in polls %} - + + - {% endfor %} - -
- {% if candidate in assignment.elected %} - - - - {% endif %} - {{ candidate }} - - {% if not "assignment_publish_winner_results_only"|get_config or candidate in assignment.elected %} - {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} - {{ vote.Yes }}
- {{ vote.No }}
- {{ vote.Abstain }}
- {% elif 'Votes' in vote %} - {{ vote.Votes }} - {% elif vote == None %} - {% trans 'was not a
candidate'%} +
{% trans "Candidates" %} + {{ poll.get_ballot }}. {% trans "ballot" %} +
+ {% if candidate in assignment.elected %} + + + + {% endif %} + {{ candidate }} + + {% if not "assignment_publish_winner_results_only"|get_config or candidate in assignment.elected %} + {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} + {{ vote.Yes }}
+ {{ vote.No }}
+ {{ vote.Abstain }}
+ {% elif 'Votes' in vote %} + {{ vote.Votes }} + {% elif vote == None %} + {% trans 'was not a
candidate'%} + {% else %} +   + {% endif %} {% else %}   {% endif %} - {% else %} -   - {% endif %} -
{% trans 'Invalid votes' %} - {% if poll.has_votes %} - - {{ poll.print_votesinvalid }} - {% endif %} -
{% trans 'Invalid votes' %} + {% if poll.has_votes %} + + {{ poll.print_votesinvalid }} + {% endif %} +
- {% trans 'Votes cast' %} - - {% if poll.has_votes %} - - {{ poll.print_votescast }} - {% endif %} + {% endfor %} +
+ {% trans 'Votes cast' %}
-{% endif %} + {% for poll in polls %} + + {% if poll.has_votes %} + + {{ poll.print_votescast }} + {% endif %} + + {% endfor %} + + + {% endif %} +
diff --git a/openslides/motion/templates/motion/slide.html b/openslides/motion/templates/motion/slide.html index 18faa9671..7271091be 100644 --- a/openslides/motion/templates/motion/slide.html +++ b/openslides/motion/templates/motion/slide.html @@ -61,11 +61,11 @@
-

+

{{ motion.active_version.text|safe }}
{% if motion.active_version.reason %}

{% trans "Reason" %}:

{{ motion.active_version.reason|safe }}
{% endif %} -

+
diff --git a/openslides/projector/api.py b/openslides/projector/api.py index 6e818b2b6..0abc14650 100644 --- a/openslides/projector/api.py +++ b/openslides/projector/api.py @@ -65,6 +65,16 @@ def update_projector_overlay(overlay): ProjectorSocketHandler.send_updates({'overlays': overlay_dict}) +def call_on_projector(calls): + """ + Sends data to the projector. + """ + projector_js_cache = config['projector_js_cache'] + projector_js_cache.update(calls) + config['projector_js_cache'] = projector_js_cache + ProjectorSocketHandler.send_updates(json.dumps({'calls': calls})) + + def get_projector_content(slide_dict=None): """ Returns the HTML-Content block of the projector. diff --git a/openslides/projector/signals.py b/openslides/projector/signals.py index b683d4945..65ffed53e 100644 --- a/openslides/projector/signals.py +++ b/openslides/projector/signals.py @@ -55,14 +55,18 @@ def config_variables(sender, **kwargs): name='countdown_state', default_value='inactive') - bigger = ConfigVariable( - name='bigger', + projector_scale = ConfigVariable( + name='projector_scale', default_value=100) - projector_up = ConfigVariable( - name='up', + projector_scroll = ConfigVariable( + name='projector_scroll', default_value=0) + projector_js_cache = ConfigVariable( + name='projector_js_cache', + default_value={}) + projector_active_overlays = ConfigVariable( name='projector_active_overlays', default_value=[]) @@ -71,7 +75,8 @@ def config_variables(sender, **kwargs): title='No title here', url='bar', required_permission=None, variables=( projector, projector_message, countdown_time, countdown_start_stamp, countdown_pause_stamp, - countdown_state, bigger, projector_up, projector_active_overlays)) + countdown_state, projector_scale, projector_scroll, + projector_active_overlays, projector_js_cache)) @receiver(projector_overlays, dispatch_uid="projector_countdown") diff --git a/openslides/projector/static/javascript/projector.js b/openslides/projector/static/javascript/projector.js index 09ad3920d..16dd75190 100644 --- a/openslides/projector/static/javascript/projector.js +++ b/openslides/projector/static/javascript/projector.js @@ -6,6 +6,7 @@ */ $(document).ready(function() { + $('#content .scroll').wrap('
'); if ($('#content.reload').length > 0) { updater.start(); } @@ -23,8 +24,17 @@ var projector = { } }, + scroll: function(value) { + $('#content .scroll').css('margin-top', value + 'em') + }, + + scale: function(value) { + $('#content').css('font-size', value + '%'); + $('#content #sidebar').css('font-size', '18px'); + }, + update_data: function(data) { - $.each(data, function (key, value) { + $.each(data, function (key, value) { if (key === 'load_file') projector.load_file(value); else @@ -48,20 +58,29 @@ var updater = { }, updateProjector: function(data) { - $('#content').html(data.content); - var overlays = data.overlays; - $.each(overlays, function (key, value) { - var overlay = $('#overlays #overlay_' + key) - if (!value) - overlay.remove(); - else { - if (overlay.length) { - overlay.html(value.html) - } else { - $('#overlays').append(value.html); + if (data.content) { + $('#content').html(data.content); + $('#content .scroll').wrap('
'); + } + if (data.overlays) { + $.each(data.overlays, function (key, value) { + var overlay = $('#overlays #overlay_' + key) + if (!value) + overlay.remove(); + else { + if (overlay.length) { + overlay.html(value.html) + } else { + $('#overlays').append(value.html); + } + projector.update_data(value.javascript); } - projector.update_data(value.javascript); - } - }); + }); + } + if (data.calls) { + $.each(data.calls, function (call, argument) { + projector[call](argument); + }); + } } }; diff --git a/openslides/projector/static/styles/projector.css b/openslides/projector/static/styles/projector.css index f67467e29..8336e2afa 100644 --- a/openslides/projector/static/styles/projector.css +++ b/openslides/projector/static/styles/projector.css @@ -86,6 +86,13 @@ body{ top: 150px; right: 40px; z-index: -1; + transition: all 2s; +} +#content .scroll { + transition: margin 2s; +} +#content .scrollwrapper { + overflow: hidden; } h1 { font-size: 45px !important; diff --git a/openslides/projector/templates/projector.html b/openslides/projector/templates/projector.html index 8f57a347d..357717e3f 100644 --- a/openslides/projector/templates/projector.html +++ b/openslides/projector/templates/projector.html @@ -40,6 +40,9 @@ {% for js in overlay_js %} projector.update_data({{ js|safe }}); {% endfor %} + {% for key, value in calls.items %} + projector.{{ key }}({{ value }}); + {% endfor %} diff --git a/openslides/projector/templates/projector/projectorslide_slide.html b/openslides/projector/templates/projector/projectorslide_slide.html new file mode 100644 index 000000000..f3ac1438f --- /dev/null +++ b/openslides/projector/templates/projector/projectorslide_slide.html @@ -0,0 +1,9 @@ +{% load i18n %} + +

{{ slide.title }}

+ +
+ {% if slide.text %} + {{ slide.text|safe|linebreaks }} + {% endif %} +
diff --git a/openslides/projector/templates/projector/slide_projectorslide.html b/openslides/projector/templates/projector/slide_projectorslide.html deleted file mode 100644 index 6414bfa93..000000000 --- a/openslides/projector/templates/projector/slide_projectorslide.html +++ /dev/null @@ -1,7 +0,0 @@ -{% load i18n %} - -

{{ slide.title }}

- -{% if slide.text %} - {{ slide.text|safe|linebreaks }} -{% endif %} diff --git a/openslides/projector/urls.py b/openslides/projector/urls.py index e8868f07a..bb5e4d860 100644 --- a/openslides/projector/urls.py +++ b/openslides/projector/urls.py @@ -58,47 +58,47 @@ urlpatterns = patterns( name='customslide_delete'), url(r'^bigger/$', - views.ProjectorEdit.as_view(), + views.ProjectorControllView.as_view(), {'direction': 'bigger'}, name='projector_bigger'), url(r'^smaller/$', - views.ProjectorEdit.as_view(), + views.ProjectorControllView.as_view(), {'direction': 'smaller'}, name='projector_smaller'), url(r'^up/$', - views.ProjectorEdit.as_view(), + views.ProjectorControllView.as_view(), {'direction': 'up'}, name='projector_up'), url(r'^down/$', - views.ProjectorEdit.as_view(), + views.ProjectorControllView.as_view(), {'direction': 'down'}, name='projector_down'), url(r'^clean/$', - views.ProjectorEdit.as_view(), + views.ProjectorControllView.as_view(), {'direction': 'clean'}, name='projector_clean'), url(r'^countdown/reset/$', - views.CountdownEdit.as_view(), + views.CountdownControllView.as_view(), {'command': 'reset'}, name='countdown_reset'), url(r'^countdown/start/$', - views.CountdownEdit.as_view(), + views.CountdownControllView.as_view(), {'command': 'start'}, name='countdown_start'), url(r'^countdown/stop/$', - views.CountdownEdit.as_view(), + views.CountdownControllView.as_view(), {'command': 'stop'}, name='countdown_stop'), url(r'^countdown/set-default/$', - views.CountdownEdit.as_view(), + views.CountdownControllView.as_view(), {'command': 'set-default'}, name='countdown_set_default'), diff --git a/openslides/projector/views.py b/openslides/projector/views.py index af7db6026..1d1af58f4 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -22,8 +22,8 @@ from openslides.utils.template import Tab from openslides.utils.views import (AjaxMixin, CreateView, DeleteView, RedirectView, TemplateView, UpdateView) -from .api import (get_active_slide, get_all_widgets, get_overlays, - get_projector_content, get_projector_overlays, +from .api import (call_on_projector, get_active_slide, get_all_widgets, + get_overlays, get_projector_content, get_projector_overlays, get_projector_overlays_js, reset_countdown, set_active_slide, start_countdown, stop_countdown, update_projector_overlay) from .forms import SelectWidgetsForm @@ -64,8 +64,8 @@ class Projector(TemplateView): 'content': get_projector_content(), 'overlays': get_projector_overlays(), 'overlay_js': get_projector_overlays_js(), - 'reload': True}) - + 'reload': True, + 'calls': config['projector_js_cache']}) # For the Preview else: kwargs.update({ @@ -85,8 +85,8 @@ class ActivateView(RedirectView): def pre_redirect(self, request, *args, **kwargs): set_active_slide(kwargs['callback'], kwargs=dict(request.GET.items())) - config['up'] = 0 - config['bigger'] = 100 + config['projector_scroll'] = config.get_default('projector_scroll') + config['projector_scale'] = config.get_default('projector_scale') class SelectWidgetsView(TemplateView): @@ -133,7 +133,7 @@ class SelectWidgetsView(TemplateView): return redirect(reverse('dashboard')) -class ProjectorEdit(RedirectView): +class ProjectorControllView(RedirectView): """ Scale or scroll the projector. """ @@ -144,20 +144,23 @@ class ProjectorEdit(RedirectView): def pre_redirect(self, request, *args, **kwargs): direction = kwargs['direction'] if direction == 'bigger': - config['bigger'] = int(config['bigger']) + 20 + config['projector_scale'] = int(config['projector_scale']) + 20 elif direction == 'smaller': - config['bigger'] = int(config['bigger']) - 20 + config['projector_scale'] = int(config['projector_scale']) - 20 elif direction == 'down': - config['up'] = int(config['up']) - 5 + config['projector_scroll'] = int(config['projector_scroll']) - 5 elif direction == 'up': - if config['up'] < 0: - config['up'] = int(config['up']) + 5 + if config['projector_scroll'] < 0: + config['projector_scroll'] = int(config['projector_scroll']) + 5 elif direction == 'clean': - config['up'] = config.get_default('up') - config['bigger'] = config.get_default('bigger') + config['projector_scroll'] = config.get_default('projector_scroll') + config['projector_scale'] = config.get_default('projector_scale') + + call_on_projector({'scroll': config['projector_scroll'], + 'scale': config['projector_scale']}) -class CountdownEdit(RedirectView): +class CountdownControllView(RedirectView): """ Start, stop or reset the countdown. """ diff --git a/openslides/utils/tornado_webserver.py b/openslides/utils/tornado_webserver.py index b3bc3b305..a05e7e336 100644 --- a/openslides/utils/tornado_webserver.py +++ b/openslides/utils/tornado_webserver.py @@ -57,9 +57,9 @@ class ProjectorSocketHandler(WebSocketHandler): ProjectorSocketHandler.waiters.remove(self) @classmethod - def send_updates(cls, slide): + def send_updates(cls, data): for waiter in cls.waiters: - waiter.write_message(slide) + waiter.write_message(data) def run_tornado(addr, port, reload=False):