Fixing order for assignment poll form and translation for slide (fixes #3160, fixes #3161)

This commit is contained in:
FinnStutzenstein 2017-03-28 09:41:16 +02:00
parent 40c6957b21
commit 72ceac3510
2 changed files with 12 additions and 27 deletions

View File

@ -742,27 +742,11 @@ angular.module('OpenSlidesApp.assignments.site', [
options.forEach(function(option) { options.forEach(function(option) {
var defaultValue; var defaultValue;
if (assignmentpoll.pollmethod == 'yna' || assignmentpoll.pollmethod == 'yn') { if (assignmentpoll.pollmethod == 'yna' || assignmentpoll.pollmethod == 'yn') {
if (assignmentpoll.pollmethod == 'yna') { defaultValue = {};
defaultValue = { _.forEach(option.votes, function (vote) {
'yes': '', defaultValue[vote.value.toLowerCase()] = vote.weight;
'no': '', });
'abstain': ''
};
}
else {
defaultValue = {
'yes': '',
'no': ''
};
}
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( $scope.formFields.push(
{ {
noFormControl: true, noFormControl: true,
@ -787,7 +771,8 @@ angular.module('OpenSlidesApp.assignments.site', [
required: true required: true
}, },
defaultValue: defaultValue.no defaultValue: defaultValue.no
}); }
);
if (assignmentpoll.pollmethod == 'yna'){ if (assignmentpoll.pollmethod == 'yna'){
$scope.formFields.push( $scope.formFields.push(
{ {
@ -801,7 +786,7 @@ angular.module('OpenSlidesApp.assignments.site', [
defaultValue: defaultValue.abstain defaultValue: defaultValue.abstain
}); });
} }
} else { } else { // votes method
if (option.votes.length) { if (option.votes.length) {
defaultValue = option.votes[0].weight; defaultValue = option.votes[0].weight;
} }

View File

@ -48,12 +48,12 @@
<div ng-init="votes = option.getVotes()"> <div ng-init="votes = option.getVotes()">
<div ng-show="poll.pollmethod == 'yna' || poll.pollmethod == 'yn'"> <div ng-show="poll.pollmethod == 'yna' || poll.pollmethod == 'yn'">
<span ng-show="poll.pollmethod == 'yna'"> <span ng-show="poll.pollmethod == 'yna'">
{{ votes[0].label }}: {{ votes[0].value }} · {{ votes[0].label | translate }}: {{ votes[0].value }} ·
{{ votes[1].label }}: {{ votes[1].value }} · {{ votes[1].label | translate }}: {{ votes[1].value }} ·
{{ votes[2].label }}: {{ votes[2].value }} </span> {{ votes[2].label | translate }}: {{ votes[2].value }} </span>
<span ng-show="poll.pollmethod == 'yn'"> <span ng-show="poll.pollmethod == 'yn'">
{{ votes[0].label }}: {{ votes[0].value }} · {{ votes[0].label | translate }}: {{ votes[0].value }} ·
{{ votes[1].label }}: {{ votes[1].value }}</span> {{ votes[1].label | translate }}: {{ votes[1].value }}</span>
<uib-progress ng-if="votes[0].percentNumber>=0"> <uib-progress ng-if="votes[0].percentNumber>=0">
<uib-bar value="votes[0].percentNumber" type="success"> <uib-bar value="votes[0].percentNumber" type="success">
<span ng-hide="votes[0].percentNumber < 5">{{votes[0].percentNumber}} %</span> <span ng-hide="votes[0].percentNumber < 5">{{votes[0].percentNumber}} %</span>