From 72ceac35101fb99011769c2b0a8c3d357a6bd521 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Tue, 28 Mar 2017 09:41:16 +0200 Subject: [PATCH] Fixing order for assignment poll form and translation for slide (fixes #3160, fixes #3161) --- .../assignments/static/js/assignments/site.js | 29 +++++-------------- .../assignments/slide_assignment.html | 10 +++---- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/openslides/assignments/static/js/assignments/site.js b/openslides/assignments/static/js/assignments/site.js index 80fc9003a..1a5416af6 100644 --- a/openslides/assignments/static/js/assignments/site.js +++ b/openslides/assignments/static/js/assignments/site.js @@ -742,27 +742,11 @@ angular.module('OpenSlidesApp.assignments.site', [ options.forEach(function(option) { var defaultValue; if (assignmentpoll.pollmethod == 'yna' || assignmentpoll.pollmethod == 'yn') { - if (assignmentpoll.pollmethod == 'yna') { - defaultValue = { - 'yes': '', - 'no': '', - 'abstain': '' - }; - } - else { - defaultValue = { - 'yes': '', - 'no': '' - }; - } + defaultValue = {}; + _.forEach(option.votes, function (vote) { + defaultValue[vote.value.toLowerCase()] = vote.weight; + }); - if (option.votes.length) { - defaultValue.yes = option.votes[0].weight; - defaultValue.no = option.votes[1].weight; - if (assignmentpoll.pollmethod == 'yna'){ - defaultValue.abstain = option.votes[2].weight; - } - } $scope.formFields.push( { noFormControl: true, @@ -787,7 +771,8 @@ angular.module('OpenSlidesApp.assignments.site', [ required: true }, defaultValue: defaultValue.no - }); + } + ); if (assignmentpoll.pollmethod == 'yna'){ $scope.formFields.push( { @@ -801,7 +786,7 @@ angular.module('OpenSlidesApp.assignments.site', [ defaultValue: defaultValue.abstain }); } - } else { + } else { // votes method if (option.votes.length) { defaultValue = option.votes[0].weight; } diff --git a/openslides/assignments/static/templates/assignments/slide_assignment.html b/openslides/assignments/static/templates/assignments/slide_assignment.html index 7882302dd..082afbe32 100644 --- a/openslides/assignments/static/templates/assignments/slide_assignment.html +++ b/openslides/assignments/static/templates/assignments/slide_assignment.html @@ -48,12 +48,12 @@
- {{ votes[0].label }}: {{ votes[0].value }} · - {{ votes[1].label }}: {{ votes[1].value }} · - {{ votes[2].label }}: {{ votes[2].value }} + {{ votes[0].label | translate }}: {{ votes[0].value }} · + {{ votes[1].label | translate }}: {{ votes[1].value }} · + {{ votes[2].label | translate }}: {{ votes[2].value }} - {{ votes[0].label }}: {{ votes[0].value }} · - {{ votes[1].label }}: {{ votes[1].value }} + {{ votes[0].label | translate }}: {{ votes[0].value }} · + {{ votes[1].label | translate }}: {{ votes[1].value }} {{votes[0].percentNumber}} %