From 7b7f43b04a640c23dcfc636aee5fc421eea92206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20K=C3=B6cher?= Date: Thu, 26 Apr 2012 12:43:35 +0200 Subject: [PATCH] #97: Countdown: move countdown config input field from config tab to portlet --- openslides/agenda/forms.py | 3 +- openslides/agenda/views.py | 26 +++++----- .../static/images/icons/document-save.png | Bin 0 -> 563 bytes .../static/images/icons/spin-down.png | Bin 0 -> 269 bytes .../projector/static/images/icons/spin-up.png | Bin 0 -> 255 bytes .../static/javascript/projector-control.js | 23 ++++++++- .../static/styles/projector-control.css | 29 +++++++++++ .../templates/projector/control.html | 45 ++++++++++++++---- openslides/projector/urls.py | 3 ++ openslides/projector/views.py | 10 ++++ 10 files changed, 115 insertions(+), 24 deletions(-) create mode 100644 openslides/projector/static/images/icons/document-save.png create mode 100644 openslides/projector/static/images/icons/spin-down.png create mode 100644 openslides/projector/static/images/icons/spin-up.png diff --git a/openslides/agenda/forms.py b/openslides/agenda/forms.py index b147ce2a2..e67f44f29 100644 --- a/openslides/agenda/forms.py +++ b/openslides/agenda/forms.py @@ -44,4 +44,5 @@ class ItemOrderForm(Form, CssClassMixin): class ConfigForm(Form, CssClassMixin): - agenda_countdown_time = IntegerField(widget=TextInput(attrs={'class':'small-input'}),label=_("Countdown (in seconds)"),initial=60, min_value=0) + pass + diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index 133065fb2..64e63afcf 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -167,18 +167,20 @@ class AgendaPDF(PDFView): story.append(Paragraph(item.get_title(), stylesheet['Item'])) -class Config(FormView): - permission_required = 'config.can_manage_config' - form_class = ConfigForm - template_name = 'agenda/config.html' - - def get_initial(self): - return {'agenda_countdown_time': config['agenda_countdown_time']} - - def form_valid(self, form): - config['agenda_countdown_time'] = form.cleaned_data['agenda_countdown_time'] - messages.success(self.request, _('Agenda settings successfully saved.')) - return super(Config, self).form_valid(form) +# +# rene: empty for now so comment it out to keep it from appearing in the settings +# +#class Config(FormView): +# permission_required = 'config.can_manage_config' +# form_class = ConfigForm +# template_name = 'agenda/config.html' +# +# def get_initial(self): +# return {} +# +# def form_valid(self, form): +# messages.success(self.request, _('Agenda settings successfully saved.')) +# return super(Config, self).form_valid(form) def register_tab(request): diff --git a/openslides/projector/static/images/icons/document-save.png b/openslides/projector/static/images/icons/document-save.png new file mode 100644 index 0000000000000000000000000000000000000000..8072aea3268164eb2028a0cebfe44da82b4f4aca GIT binary patch literal 563 zcmV-30?hr1P)XvKK@k7Ytwo{YB(9F? z;2_0Ku;{F~yQsL?!9iy?1;;|c4%SjZ%{70TwwHKcBH=J-%EN&+{;d zhN(E7P<- zOhP?!y}wyJm`;b*`kqJvqBiX|nL~L2fd*Ux1d!eYF6Tbg5P<9ZC&&uF5~UDVJ~Kya z$B9GKW9yGCk1)gXRIvtRXipPk@<6(R{ z10;&Qkze=csdPHpgO1qUX}3Wtm&>>~JBMXkI4Be#D>XTZ+DDB(A$cT#*xhj)kQiey zO%sM;K-YE1@`TY9(UZv}-m29|6TcYK$LKUNox!$kO4I`&Fl}aA7Py>1;e44jn~%EA z#v7jv1002ovPDHLkV1jI` B^11*3 literal 0 HcmV?d00001 diff --git a/openslides/projector/static/images/icons/spin-down.png b/openslides/projector/static/images/icons/spin-down.png new file mode 100644 index 0000000000000000000000000000000000000000..e54993882a90d3e1ad314a48cb7b4c4e579bacf9 GIT binary patch literal 269 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~c!NS16s9VwA1>`Um2e~^jtUD+363Agn@^*J& z_}|`tWO>_3{Xdb-9@Oh_kcxYaaac@_i)|A%^oz&#R{@rd5 z-LWz8Xsei}W^kM6giROH4$d%jcRTaq(Z2PE&d#uUbe6l_*=FOW4~$ovQ+^7FT#x{| Om%-E3&t;ucLK6TrOJ~;r literal 0 HcmV?d00001 diff --git a/openslides/projector/static/images/icons/spin-up.png b/openslides/projector/static/images/icons/spin-up.png new file mode 100644 index 0000000000000000000000000000000000000000..7830c52a7061261624fed981684a7cb5b6bf81fc GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~c!2%?s>bJ`PDaPU;cPEB*=VV?2IZR33?k)`f z+xyS#2l6-zJR*yMDt3b~qt%~~nCIJLySC#hNjg_=EG977~7*Pb!t zV+>?qxcFUsV`od3Z@}*6sFyN%3kq1&1K+8Z@GS@sVC@XreXWjFQPA+L$z;yY9K0)6 z6ixSVX}vVr%3I*hoH<{41+N}_lNN_>x4>uzT9*CbmizRx0S13 vW<38@%i)&BrJK8Q+Yi|kqy3zpU+D9%Q&QM+gwx;-&^ZjAu6{1-oD!M= 0) ? count - 1 : count)); + }); + + $('.projector_countdown_spinup').click(function(event) { + event.preventDefault(); + var count = parseInt($( "#countdown_time" ).val()); + + $( "#countdown_time" ).val(count + 1); + }); + $('.countdown_visible_link').click(function(event) { event.preventDefault(); var link = $(this); diff --git a/openslides/projector/static/styles/projector-control.css b/openslides/projector/static/styles/projector-control.css index 114655465..05320ad2a 100644 --- a/openslides/projector/static/styles/projector-control.css +++ b/openslides/projector/static/styles/projector-control.css @@ -38,6 +38,35 @@ visibility: hidden; } +/*.projector_countdown_spinval {*/ +#countdown_time { + width: 40px; + height: 16px; +} + +.projector_countdown_spinbox { + height: 16px; + width: auto; + position: relative; + display: inline-block; +} + +.projector_countdown_spinup { + position: absolute; + top: 0px; + left: 35px; +} + +.projector_countdown_spindown { + position: absolute; + top: 8px; + left: 35px; +} + +.projector_countdown_btn { + margin-top: auto; +} + /* iframe */ #iframe { -ms-zoom: 0.25; diff --git a/openslides/projector/templates/projector/control.html b/openslides/projector/templates/projector/control.html index 428d74a58..ae7823322 100644 --- a/openslides/projector/templates/projector/control.html +++ b/openslides/projector/templates/projector/control.html @@ -25,6 +25,17 @@ return true; }; + function spinCount(delta) { + var count = parseInt($( "#countdown_time" ).val()); + + if (count + delta < 0) { + delta = 0; + } + + $( "#countdown_time" ).val(count + delta); + return false; + }; + $(function() { $( ".column" ).sortable({ connectWith: ".column" @@ -132,16 +143,30 @@ {# Countdown #} {% if overlay.def_name == "Countdown" %} | - {{countdown_time}}{% trans "sec" %} - - - - - - - - - + + + + + + + + + {% trans "sec" %} +   + + + +      + + + + + + + + + + {% endif %} {% if overlay.def_name == "Message" %}
{% csrf_token %} diff --git a/openslides/projector/urls.py b/openslides/projector/urls.py index cd30af47b..3ea30144a 100644 --- a/openslides/projector/urls.py +++ b/openslides/projector/urls.py @@ -85,4 +85,7 @@ urlpatterns = patterns('projector.views', url(r'^countdown/stop/$', 'projector_countdown', {'command': 'stop'}, name='countdown_stop'), + + url(r'^countdown/set-default/$', 'projector_countdown', {'command': 'set_default'}, + name='countdown_set_default'), ) diff --git a/openslides/projector/views.py b/openslides/projector/views.py index 6e72267d7..6cde356c8 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -221,6 +221,16 @@ def projector_countdown(request, command): config['countdown_pause_stamp'] = time() config['countdown_state'] = 'paused' + elif command == 'set_default': + try: + config['agenda_countdown_time'] = int(request.GET['countdown_time']) + + except ValueError: + pass + + except AttributeError: + pass + if request.is_ajax(): if command == "show": link = reverse('countdown_close')