Merge pull request #2598 from emanuelschuetze/template-fixes

Template fixes.
This commit is contained in:
Norman Jäckel 2016-11-08 14:45:28 +01:00 committed by GitHub
commit 30fd55409b
4 changed files with 45 additions and 28 deletions

View File

@ -102,6 +102,11 @@ angular.module('OpenSlidesApp.motions', [
} }
break; break;
} }
// 100% base impossible if at leat one value has set an
// speacial value (-1 or -2).
if (this.yes < 0 || this.no < 0 || this.abstain < 0) {
impossible = true;
}
// calculate percent value // calculate percent value
var config = Config.get('motions_poll_100_percent_base').value; var config = Config.get('motions_poll_100_percent_base').value;
var percentStr; var percentStr;
@ -292,16 +297,20 @@ angular.module('OpenSlidesApp.motions', [
// full state name - optional with custom state name extension // full state name - optional with custom state name extension
// depended by state and provided by a custom comment field // depended by state and provided by a custom comment field
getStateName: function () { getStateName: function () {
var name = '';
var additionalName = ''; var additionalName = '';
if (this.state.show_state_extension_field) { if (this.state) {
// check motion comment fields for flag 'forState' name = gettextCatalog.getString(this.state.name);
var fields = Config.get('motions_comments').value; if (this.state.show_state_extension_field) {
var index = _.findIndex(fields, ['forState', true]); // check motion comment fields for flag 'forState'
if (index > -1) { var fields = Config.get('motions_comments').value;
additionalName = ' ' + this.comments[index]; var index = _.findIndex(fields, ['forState', true]);
if (index > -1) {
additionalName = ' ' + this.comments[index];
}
} }
} }
return gettextCatalog.getString(this.state.name) + additionalName; return name + additionalName;
}, },
// full recommendation string - optional with custom recommendationextension // full recommendation string - optional with custom recommendationextension
// depended by state and provided by a custom comment field // depended by state and provided by a custom comment field

View File

@ -221,15 +221,6 @@
<!-- Template hook for motion poll buttons --> <!-- Template hook for motion poll buttons -->
<template-hook hook-name="motionPollSmallButtons"></template-hook> <template-hook hook-name="motionPollSmallButtons"></template-hook>
<!-- Settings for majority calculations -->
<div os-perms="motions.can_manage" ng-hide="config('motions_poll_default_majority_method') == 'disabled'" ng-cloak>
<div class="input-group">
<span><translate>Required majority</translate>: </span>
<select ng-init="config('motions_poll_default_majority_method')" ng-model="$parent.method"
ng-options="option.value as option.display_name | translate for option in methodChoices" />
</div>
</div>
<!-- Poll results --> <!-- Poll results -->
<div ng-show="poll.has_votes" class="pollresults"> <div ng-show="poll.has_votes" class="pollresults">
<table class="table"> <table class="table">
@ -296,19 +287,36 @@
<span class="result_value"> <span class="result_value">
{{ votesCast.value }} {{ votesCast.percentStr }} {{ votesCast.value }} {{ votesCast.percentStr }}
</span> </span>
<!-- majority calculation --> <!-- majority calculation -->
<tr os-perms="motions.can_manage" ng-hide="method == 'disabled'"> <tr>
<td class="icon">
<td> <td>
<span class="text-warning" ng-if="isReached() === undefined" translate>Calculation impossible</span> <td>
<span class="text-success" ng-if="isReached() >= 0" translate> <div os-perms="motions.can_manage"
Quorum reached, {{ isReached() }} votes more than needed. ng-hide="config('motions_poll_default_majority_method') == 'disabled' ||
</span> isReached() === undefined" ng-cloak>
<span class="text-danger" ng-if="isReached() < 0" translate> <div class="input-group">
Quorum not reached, {{ -(isReached()) }} votes missing. <span><translate>Required majority</translate>: </span>
</span> <select ng-init="config('motions_poll_default_majority_method')"
ng-model="$parent.method"
ng-options="option.value as option.display_name | translate for option in methodChoices">
</div>
</div>
<tr>
<td>
<td>
<div os-perms="motions.can_manage">
<span class="text-success" ng-if="isReached() >= 0" translate>
Quorum reached, {{ isReached() }} votes more than needed.
</span>
<span class="text-danger" ng-if="isReached() < 0" translate>
Quorum not reached, {{ -(isReached()) }} votes missing.
</span>
</div>
</table> </table>
</ol> </ol>
<button ng-if="motion.isAllowed('create_poll')" ng-click="create_poll()" class="btn btn-default btn-sm"> <button ng-if="motion.isAllowed('create_poll')" ng-click="create_poll()" class="btn btn-default btn-sm">
<i class="fa fa-bar-chart fa-lg"></i> <i class="fa fa-bar-chart fa-lg"></i>
<translate>New vote</translate> <translate>New vote</translate>

View File

@ -28,7 +28,7 @@
<span class="result_value"> <span class="result_value">
{{ voteYes.value }} {{ voteYes.percentStr }} {{ voteYes.value }} {{ voteYes.percentStr }}
</span> </span>
<div ng-if="voteYes.percentNumber >= 0"> <div ng-if="voteYes.percentNumber">
<uib-progressbar value="voteYes.percentNumber" type="success"></uib-progressbar> <uib-progressbar value="voteYes.percentNumber" type="success"></uib-progressbar>
</div> </div>
<!-- no --> <!-- no -->
@ -40,7 +40,7 @@
<span class="result_value" > <span class="result_value" >
{{ voteNo.value }} {{ voteNo.percentStr }} {{ voteNo.value }} {{ voteNo.percentStr }}
</span> </span>
<div ng-if="voteNo.percentNumber >= 0"> <div ng-if="voteNo.percentNumber">
<uib-progressbar value="voteNo.percentNumber" type="danger"></uib-progressbar> <uib-progressbar value="voteNo.percentNumber" type="danger"></uib-progressbar>
</div> </div>
<!-- abstain --> <!-- abstain -->

View File

@ -101,7 +101,7 @@ angular.module('OpenSlidesApp.users', [])
firstName = _.trim(this.first_name), firstName = _.trim(this.first_name),
lastName = _.trim(this.last_name), lastName = _.trim(this.last_name),
name = ''; name = '';
if (Config.get('users_sort_by').value == 'lastName') { if (Config.get('users_sort_by') && Config.get('users_sort_by').value == 'lastName') {
if (lastName && firstName) { if (lastName && firstName) {
name += [lastName, firstName].join(', '); name += [lastName, firstName].join(', ');
} else { } else {