From 8ef3d485fe684048f1895e64e847244a595f2640 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 3 Sep 2011 14:30:56 +0200 Subject: [PATCH 1/4] Exluded weight field from item forms. --- openslides/agenda/forms.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openslides/agenda/forms.py b/openslides/agenda/forms.py index db33f8bbe..530a7fa80 100644 --- a/openslides/agenda/forms.py +++ b/openslides/agenda/forms.py @@ -23,7 +23,7 @@ class ItemFormText(ModelForm): parent = ModelChoiceField(queryset=items, label=_("Parent item"), required=False) class Meta: model = ItemText - exclude = ('closed') + exclude = ('closed', 'weight') class ItemFormApplication(ModelForm): @@ -34,7 +34,7 @@ class ItemFormApplication(ModelForm): class Meta: model = ItemApplication - exclude = ('closed') + exclude = ('closed', 'weight') class ItemFormPoll(ModelForm): @@ -45,7 +45,7 @@ class ItemFormPoll(ModelForm): class Meta: model = ItemPoll - exclude = ('closed') + exclude = ('closed', 'weight') class ItemFormAssignment(ModelForm): @@ -56,7 +56,7 @@ class ItemFormAssignment(ModelForm): class Meta: model = ItemAssignment - exclude = ('closed') + exclude = ('closed', 'weight') def genweightchoices(): From a874e327ace73dcb9b51afe9caf55c1336ce459a Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 3 Sep 2011 14:31:33 +0200 Subject: [PATCH 2/4] Fixed style. --- openslides/assignment/templates/assignment/view.html | 4 ++-- openslides/static/styles/base.css | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openslides/assignment/templates/assignment/view.html b/openslides/assignment/templates/assignment/view.html index 3a22b53ca..c91786831 100644 --- a/openslides/assignment/templates/assignment/view.html +++ b/openslides/assignment/templates/assignment/view.html @@ -173,7 +173,7 @@ {%trans 'Invalid votes' %} {% for p in polls %} - {{ p.votesinvalid }} + {{ p.votesinvalid }} {% endfor %} {% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %} @@ -182,7 +182,7 @@ {%trans 'Votes cast' %} {% for p in polls %} - {{ p.votescast }} + {{ p.votescast }} {% endfor %} {% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %} diff --git a/openslides/static/styles/base.css b/openslides/static/styles/base.css index 311bd0a16..40d225a2c 100644 --- a/openslides/static/styles/base.css +++ b/openslides/static/styles/base.css @@ -344,7 +344,7 @@ button .cancel{ button .ok{ background:url(../images/icons/dialog-ok-apply.png) no-repeat 0px 0px; } -button .ok-blue{ +button .ok-blue, button .apply{ background:url(../images/icons/dialog-ok.png) no-repeat 0px 0px; } button .edit{ From 7c866e11e4bd8ed6a54efba7c3a2922706575f45 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 3 Sep 2011 14:36:01 +0200 Subject: [PATCH 3/4] Removed ItemPoll and ItemFormPoll. --- openslides/agenda/forms.py | 14 +------------- openslides/agenda/views.py | 6 ------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/openslides/agenda/forms.py b/openslides/agenda/forms.py index 530a7fa80..69f761e75 100644 --- a/openslides/agenda/forms.py +++ b/openslides/agenda/forms.py @@ -13,7 +13,7 @@ from django.forms import Form, ModelForm, IntegerField, ChoiceField, \ ModelChoiceField, HiddenInput, Select from django.utils.translation import ugettext as _ -from openslides.agenda.models import Item, ItemText, ItemApplication, ItemPoll, \ +from openslides.agenda.models import Item, ItemText, ItemApplication, \ ItemAssignment class ItemFormText(ModelForm): @@ -37,17 +37,6 @@ class ItemFormApplication(ModelForm): exclude = ('closed', 'weight') -class ItemFormPoll(ModelForm): - error_css_class = 'error' - required_css_class = 'required' - items = Item.objects.all().filter(parent=None).order_by('weight') - parent = ModelChoiceField(queryset=items, label=_("Parent item"), required=False) - - class Meta: - model = ItemPoll - exclude = ('closed', 'weight') - - class ItemFormAssignment(ModelForm): error_css_class = 'error' required_css_class = 'required' @@ -77,6 +66,5 @@ class ElementOrderForm(Form): MODELFORM = { 'ItemText': ItemFormText, 'ItemApplication': ItemFormApplication, - 'ItemPoll': ItemFormPoll, 'ItemAssignment': ItemFormAssignment, } diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index 7b0ccb6fe..f7e8d69be 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -234,12 +234,6 @@ def edit(request, item_id=None, form='ItemText', default=None): 'application': application, 'title': application.title, } - elif form == "ItemPoll": - poll = Poll.objects.get(pk=default) - initial = { - 'poll': poll, - 'title': poll.title, - } if item_id is None: form = MODELFORM[form](initial=initial) From 021fb27833b5c8005d646e022d2c849cc7a31283 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 3 Sep 2011 16:20:10 +0200 Subject: [PATCH 4/4] Added apply buttons. Some style changes. Fix permissions. --- openslides/agenda/templates/agenda/edit.html | 2 +- .../agenda/templates/agenda/overview.html | 4 +- openslides/application/models.py | 2 +- .../templates/application/edit.html | 3 + .../templates/application/poll_view.html | 77 +++++++++++-------- openslides/application/views.py | 14 ++-- .../assignment/templates/assignment/edit.html | 3 + .../templates/assignment/poll_view.html | 43 ++++++----- openslides/assignment/views.py | 5 +- openslides/static/styles/base.css | 3 +- openslides/templates/403.html | 4 - openslides/templates/404.html | 4 - openslides/templates/500.html | 4 - 13 files changed, 92 insertions(+), 76 deletions(-) diff --git a/openslides/agenda/templates/agenda/edit.html b/openslides/agenda/templates/agenda/edit.html index 190665d1a..6eeca7a33 100644 --- a/openslides/agenda/templates/agenda/edit.html +++ b/openslides/agenda/templates/agenda/edit.html @@ -27,7 +27,7 @@ {%trans 'Save' %} + + + + - - -

-
- - - - - {% endif %} + + + {% endblock %} diff --git a/openslides/application/views.py b/openslides/application/views.py index 8053ce6da..340d7c621 100644 --- a/openslides/application/views.py +++ b/openslides/application/views.py @@ -287,12 +287,11 @@ def gen_poll(request, application_id): gen a poll for this application. """ try: - count = Poll.objects.filter(application=application_id).count() - Application.objects.get(pk=application_id).gen_poll(user=request.user, pollcount=count+1) - messages.success(request, _("New poll was successfully created.") ) + poll = Application.objects.get(pk=application_id).gen_poll(user=request.user) + messages.success(request, _("New vote was successfully created.") ) except Application.DoesNotExist: pass - return redirect(reverse('application_view', args=[application_id])) + return redirect(reverse('application_poll_view', args=[poll.id])) @permission_required('application.can_manage_application') @@ -311,7 +310,7 @@ def delete_poll(request, poll_id): return redirect(reverse('application_view', args=[application.id])) -@permission_required('application.can_view_poll') +@permission_required('application.can_manage_application') @template('application/poll_view.html') def view_poll(request, poll_id): """ @@ -320,7 +319,7 @@ def view_poll(request, poll_id): poll = Poll.objects.get(pk=poll_id) ballot = poll.ballot options = poll.options - if request.user.has_perm('application.can_manage_applications'): + if request.user.has_perm('application.can_manage_application'): if request.method == 'POST': form = PollForm(request.POST, prefix="poll") if form.is_valid(): @@ -337,6 +336,9 @@ def view_poll(request, poll_id): option.voteundesided = option.form. \ cleaned_data['undesided'] or 0 option.save() + messages.success(request, _("Votes are successfully saved.") ) + if not 'apply' in request.POST: + return redirect(reverse('application_view', args=[poll.application.id])) else: form = PollForm(initial={'invalid': poll.votesinvalid, 'votescast': poll.votescast}, prefix="poll") for option in options: diff --git a/openslides/assignment/templates/assignment/edit.html b/openslides/assignment/templates/assignment/edit.html index 08a614377..b076aa02a 100644 --- a/openslides/assignment/templates/assignment/edit.html +++ b/openslides/assignment/templates/assignment/edit.html @@ -14,6 +14,9 @@ + - - -

- {% endif %} + +

+ + + + + +

{% endblock %} diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 4d7873769..4a41cae92 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -108,6 +108,7 @@ def edit(request, assignment_id=None): messages.success(request, _('New election was successfully created.')) else: messages.success(request, _('Election was successfully modified.')) + if not 'apply' in request.POST: return redirect(reverse("assignment_overview")) else: form = AssignmentForm(instance=assignment) @@ -188,7 +189,7 @@ def gen_poll(request, assignment_id): return redirect(reverse('assignment_poll_view', args=[poll.id])) -@permission_required('assignment.can_view_assignment') +@permission_required('assignment.can_manage_assignment') @template('assignment/poll_view.html') def poll_view(request, poll_id): poll = Poll.objects.get(pk=poll_id) @@ -214,6 +215,8 @@ def poll_view(request, poll_id): success = success + 1 if success == options.count(): messages.success(request, _("Votes are successfully saved.") ) + if not 'apply' in request.POST: + return redirect(reverse('assignment_view', args=[assignment.id])) else: form = PollForm(initial={'invalid': poll.votesinvalid, 'votescast': poll.votescast}, prefix="poll") for option in options: diff --git a/openslides/static/styles/base.css b/openslides/static/styles/base.css index 40d225a2c..d5e3f3540 100644 --- a/openslides/static/styles/base.css +++ b/openslides/static/styles/base.css @@ -252,6 +252,7 @@ table a.table_edit { } tr.total td { border-top: 1px solid #333333; + background-color: #e3e3e3; } @@ -411,7 +412,7 @@ button .stop{ .errorlist { color:#DA3939; - font-size:10px; + font-size:9px; font-style:italic; height:16px; padding:0; diff --git a/openslides/templates/403.html b/openslides/templates/403.html index ebd1bb19e..99ea3fbdc 100644 --- a/openslides/templates/403.html +++ b/openslides/templates/403.html @@ -15,10 +15,6 @@
  • {%trans "Elections" %}
  • {% endif %} - {% if perms.poll.can_view_poll or perms.poll.can_manage_poll %} -
  • - {%trans "Polls" %}
  • - {% endif %} {% if perms.participant.can_view_participants or perms.participant.can_manage_participants %}
  • {%trans "Participants" %}
  • diff --git a/openslides/templates/404.html b/openslides/templates/404.html index 972b12820..207553df0 100644 --- a/openslides/templates/404.html +++ b/openslides/templates/404.html @@ -15,10 +15,6 @@
  • {%trans "Elections" %}
  • {% endif %} - {% if perms.poll.can_view_poll or perms.poll.can_manage_poll %} -
  • - {%trans "Polls" %}
  • - {% endif %} {% if perms.participant.can_view_participants or perms.participant.can_manage_participants %}
  • {%trans "Participants" %}
  • diff --git a/openslides/templates/500.html b/openslides/templates/500.html index 9c64131d7..fdb3fafc4 100644 --- a/openslides/templates/500.html +++ b/openslides/templates/500.html @@ -15,10 +15,6 @@
  • {%trans "Elections" %}
  • {% endif %} - {% if perms.poll.can_view_poll or perms.poll.can_manage_poll %} -
  • - {%trans "Polls" %}
  • - {% endif %} {% if perms.participant.can_view_participants or perms.participant.can_manage_participants %}
  • {%trans "Participants" %}