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' %} - {%trans 'Apply' %} + {%trans 'Apply' %} diff --git a/openslides/agenda/templates/agenda/overview.html b/openslides/agenda/templates/agenda/overview.html index 977d862a0..67daa2b82 100644 --- a/openslides/agenda/templates/agenda/overview.html +++ b/openslides/agenda/templates/agenda/overview.html @@ -70,7 +70,7 @@ {% if perms.agenda.can_manage_agenda %} {% endif %} - + {% for item in items %} {% if not item.hidden or perms.agenda.can_manage_agenda %} @@ -124,7 +124,7 @@ {% endifequal %} {% endif %} - + {% if perms.agenda.can_manage_agenda %} diff --git a/openslides/application/models.py b/openslides/application/models.py index 5158fcf3f..dedd847ec 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -346,7 +346,7 @@ class Application(models.Model): raise AttributeError(name) raise AttributeError(name) - def gen_poll(self, user=None, pollcount=None): + def gen_poll(self, user=None): """ Generates a poll object for the application """ diff --git a/openslides/application/templates/application/edit.html b/openslides/application/templates/application/edit.html index 015174f02..7cfd67889 100644 --- a/openslides/application/templates/application/edit.html +++ b/openslides/application/templates/application/edit.html @@ -16,6 +16,9 @@ {%trans 'Save' %} + + {%trans 'Apply' %} + {%trans 'Cancel' %} diff --git a/openslides/application/templates/application/poll_view.html b/openslides/application/templates/application/poll_view.html index 75246d0c8..ed9f67e7e 100644 --- a/openslides/application/templates/application/poll_view.html +++ b/openslides/application/templates/application/poll_view.html @@ -14,40 +14,49 @@ {% block content %} {%trans "Application" %} #{{ poll.application.number }} - {%trans "Vote" %} - {{ poll.application.title }} + {{ poll.application.title }} - {% if perms.poll.can_manage_poll %} - {% csrf_token %} - - {%trans "Results" %}: {{ ballot }}. {%trans "Vote" %} - {%trans "Votes in favour" %}: - {{ options.0.form.yes.errors }}{{ options.0.form.yes }} - - {%trans "Votes against" %}: - {{ options.0.form.no.errors }}{{ options.0.form.no }} - - {%trans "Abstentions" %}: - {{ options.0.form.undesided.errors }}{{ options.0.form.undesided }} - - {%trans "Invalid votes" %}: - {{ form.invalid.errors }}{{ form.invalid }} - - {%trans "Votes cast" %}: - {{ form.votescast.errors }}{{ form.votescast }} - - - - {%trans 'Apply' %} + {%trans "Results of" %} {{ ballot }}. {%trans "Vote" %} + + {% csrf_token %} + + + {%trans "Option" %} + {%trans "Votes" %} + + + {%trans "Yes" %} + {{ options.0.form.yes.errors }}{{ options.0.form.yes }} + + + {%trans "No" %} + {{ options.0.form.no.errors }}{{ options.0.form.no }} + + + {%trans "Abstentions" %} + {{ options.0.form.undesided.errors }}{{ options.0.form.undesided }} + + + {%trans "Invalid votes" %} + {{ form.invalid.errors }}{{ form.invalid }} + + + {%trans "Votes cast" %} + {{ form.votescast.errors }}{{ form.votescast }} + + + + + {%trans 'Save' %} + + + {%trans 'Apply' %} + + + + {%trans 'Cancel' %} - - - - - - {%trans 'Back to application' %} - - - - - {% 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 @@ {%trans 'Save' %} + + {%trans 'Apply' %} + {%trans 'Cancel' %} diff --git a/openslides/assignment/templates/assignment/poll_view.html b/openslides/assignment/templates/assignment/poll_view.html index bd96cf983..33f6bd871 100644 --- a/openslides/assignment/templates/assignment/poll_view.html +++ b/openslides/assignment/templates/assignment/poll_view.html @@ -8,7 +8,7 @@ {% trans "Short description" %}: {{ poll.description }} {% csrf_token %} - + {%trans "Option" %} {% if poll.optiondecision %} @@ -20,7 +20,7 @@ {% endif %} {% for option in options %} - + {{ option }} {% if poll.optiondecision %} {{ option.form.yes.errors }}{{ option.form.yes }} @@ -31,31 +31,38 @@ {% endif %} {% endfor %} + + {% trans "Invalid votes" %} + {{ form.invalid.errors }}{{ form.invalid }} + + + {% trans "Votes cast" %} + {{ form.votescast.errors }}{{ form.votescast }} + - {% trans "Invalid votes" %}: - {{ form.invalid.errors }}{{ form.invalid }} - - {% trans "Votes cast" %}: - {{ form.votescast.errors }}{{ form.votescast }} - - {% if perms.poll.can_manage_poll %} + - - {%trans 'Apply' %} - - - - {%trans 'Back to election' %} - - {%trans 'Print ballot' %} - {% endif %} + + + + {%trans 'Save' %} + + + {%trans 'Apply' %} + + + + {%trans 'Cancel' %} + + + {% 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" %}
{%trans "Votes in favour" %}: - {{ options.0.form.yes.errors }}{{ options.0.form.yes }} -
{%trans "Votes against" %}: - {{ options.0.form.no.errors }}{{ options.0.form.no }} -
{%trans "Abstentions" %}: - {{ options.0.form.undesided.errors }}{{ options.0.form.undesided }} -
{%trans "Invalid votes" %}: - {{ form.invalid.errors }}{{ form.invalid }} -
{%trans "Votes cast" %}: - {{ form.votescast.errors }}{{ form.votescast }} -
- - {%trans 'Apply' %} + {%trans "Results of" %} {{ ballot }}. {%trans "Vote" %} + + {% csrf_token %} + + + {%trans "Option" %} + {%trans "Votes" %} + + + {%trans "Yes" %} + {{ options.0.form.yes.errors }}{{ options.0.form.yes }} + + + {%trans "No" %} + {{ options.0.form.no.errors }}{{ options.0.form.no }} + + + {%trans "Abstentions" %} + {{ options.0.form.undesided.errors }}{{ options.0.form.undesided }} + + + {%trans "Invalid votes" %} + {{ form.invalid.errors }}{{ form.invalid }} + + + {%trans "Votes cast" %} + {{ form.votescast.errors }}{{ form.votescast }} + + + + + {%trans 'Save' %} + + + {%trans 'Apply' %} + + + + {%trans 'Cancel' %} -
{%trans "Results of" %} {{ ballot }}. {%trans "Vote" %}
+ + {%trans 'Save' %} + + + {%trans 'Apply' %} + + + + {%trans 'Cancel' %} -
{% trans "Short description" %}: {{ poll.description }}
- - {%trans 'Apply' %} - - - - {%trans 'Back to election' %} - - {%trans 'Print ballot' %}
+ + {%trans 'Save' %} + + + {%trans 'Apply' %} + + + + {%trans 'Cancel' %} + + +