diff --git a/openslides/assignments/static/js/assignments/site.js b/openslides/assignments/static/js/assignments/site.js index 0a231361a..456ad18aa 100644 --- a/openslides/assignments/static/js/assignments/site.js +++ b/openslides/assignments/static/js/assignments/site.js @@ -136,40 +136,6 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) } ]) -// Provide generic assignmentpoll form fields for create and update view -.factory('AssignmentPollFormFieldFactory', [ - 'gettextCatalog', - function (gettextCatalog) { - return { - getFormFields: function () { - return [ - { - key: 'description', - type: 'input', - templateOptions: { - label: gettextCatalog.getString('Comment on the ballot paper') - } - }, - { - key: 'yes', - type: 'input', - templateOptions: { - label: gettextCatalog.getString('Yes'), - type: 'number', - required: true - } - }, - { - key: 'poll_description_default', - type: 'input', - templateOptions: { - label: gettextCatalog.getString('Default comment on the ballot paper') - } - }]; - } - } - } -]) .controller('AssignmentListCtrl', [ '$scope', 'ngDialog', @@ -340,6 +306,8 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) template: 'static/templates/assignments/assignmentpoll-form.html', controller: 'AssignmentPollUpdateCtrl', className: 'ngdialog-theme-default', + closeByEscape: false, + closeByDocument: false, resolve: { assignmentpoll: function (AssignmentPoll) { return AssignmentPoll.find(poll.id); @@ -443,6 +411,8 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) $scope.model = assignmentpoll; $scope.ballot = ballot; $scope.formFields = []; + $scope.alert = {}; + // add dynamic form fields assignmentpoll.options.forEach(function(option) { if (assignmentpoll.yesnoabstain) { @@ -528,9 +498,7 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) } ); - - - // save assignment + // save assignmentpoll $scope.save = function (poll) { var votes = []; if (assignmentpoll.yesnoabstain) { @@ -556,8 +524,16 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) votescast: poll.votescast }) .then(function(success) { + $scope.alert.show = false; $scope.closeThisDialog(); }) + .catch(function(error) { + var message = ''; + for (var e in error.data) { + message += e + ': ' + error.data[e] + ' '; + } + $scope.alert = { type: 'danger', msg: message, show: true }; + }); }; } ]); diff --git a/openslides/assignments/static/templates/assignments/assignmentpoll-form.html b/openslides/assignments/static/templates/assignments/assignmentpoll-form.html index 867013e21..36c7a61f9 100644 --- a/openslides/assignments/static/templates/assignments/assignmentpoll-form.html +++ b/openslides/assignments/static/templates/assignments/assignmentpoll-form.html @@ -1,8 +1,17 @@

Ballot {{ ballot }}

-
+ + {{ alert.msg }} + + +

+ Special values: + -1 = majority + -2 = undocumented + + - + + + + +

+ +

Category

+ {{ motion.category.name }} + + +

Tags

+ + {{ tag.name }}{{$last ? '' : ', '}} + + + +

State

+ + {{ motion.state.name | translate }} + +
+ + +
+
+
+

Voting result

+
    +
  1. + Vote + + + + + +
    + + + + + + + + +
    + + + Yes: + {{ poll.yes }} {{ poll.getYesPercent() }} +
    + +
    + +
    + + + No: + {{ poll.no }} {{ poll.getNoPercent() }} +
    + +
    + +
    + + + Abstain: + {{ poll.abstain }} {{ poll.getAbstainPercent() }} +
    + +
    + +
    + + + Valid votes: + {{ poll.votesvalid }} {{ poll.getVotesValidPercent() }} + +
    + + + Invalid votes: + {{ poll.votesinvalid }} {{ poll.getVotesInvalidPercent() }} + +
    + + + Votes cast: + {{ poll.votescast }} {{ poll.getVotesCastPercent() }} +
- - - - -
+ +
-
- -

Category

- {{ motion.category.name }} - - -

Tags

- - {{ tag.name }}{{$last ? '' : ', '}} - - - -

State

- - {{ motion.state.name | translate }} - -
- - -
-
-
-

Voting result

-
    -
  1. - Vote - - -
    - -

    - Special values:
    - -1 = majority
    - -2 = undocumented -

    - - {{alert.msg}} - - -
    -
    - -
    - -
    -
    - -
    - -
    -
    - -
    - -
    -
    - -
    - -
    -
    - -
    - -
    -
    - -
    - -
    - - -
    - -
    -
    - - - - - - - - -
    - - - Yes: - {{ poll.yes }} {{ poll.getYesPercent() }} -
    - -
    - -
    - - - No: - {{ poll.no }} {{ poll.getNoPercent() }} -
    - -
    - -
    - - - Abstain: - {{ poll.abstain }} {{ poll.getAbstainPercent() }} -
    - -
    - -
    - - - Valid votes: - {{ poll.votesvalid }} {{ poll.getVotesValidPercent() }} - -
    - - - Invalid votes: - {{ poll.votesinvalid }} {{ poll.getVotesInvalidPercent() }} - -
    - - - Votes cast: - {{ poll.votescast }} {{ poll.getVotesCastPercent() }} -
    -
- -
-
-