Template fixes.

- Improved motion majority calculation form.
- Show special values without percentage.
- Fix JS errors.
This commit is contained in:
Emanuel Schütze 2016-11-08 12:12:17 +01:00
parent 2824a6b3d2
commit 92a9a36188
4 changed files with 45 additions and 28 deletions

View File

@ -102,6 +102,11 @@ angular.module('OpenSlidesApp.motions', [
}
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
var config = Config.get('motions_poll_100_percent_base').value;
var percentStr;
@ -292,16 +297,20 @@ angular.module('OpenSlidesApp.motions', [
// full state name - optional with custom state name extension
// depended by state and provided by a custom comment field
getStateName: function () {
var name = '';
var additionalName = '';
if (this.state.show_state_extension_field) {
// check motion comment fields for flag 'forState'
var fields = Config.get('motions_comments').value;
var index = _.findIndex(fields, ['forState', true]);
if (index > -1) {
additionalName = ' ' + this.comments[index];
if (this.state) {
name = gettextCatalog.getString(this.state.name);
if (this.state.show_state_extension_field) {
// check motion comment fields for flag 'forState'
var fields = Config.get('motions_comments').value;
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
// depended by state and provided by a custom comment field

View File

@ -221,15 +221,6 @@
<!-- Template hook for motion poll buttons -->
<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 -->
<div ng-show="poll.has_votes" class="pollresults">
<table class="table">
@ -296,19 +287,36 @@
<span class="result_value">
{{ votesCast.value }} {{ votesCast.percentStr }}
</span>
<!-- majority calculation -->
<tr os-perms="motions.can_manage" ng-hide="method == 'disabled'">
<td class="icon">
<tr>
<td>
<span class="text-warning" ng-if="isReached() === undefined" translate>Calculation impossible</span>
<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>
<td>
<div os-perms="motions.can_manage"
ng-hide="config('motions_poll_default_majority_method') == 'disabled' ||
isReached() === undefined" 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>
<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>
</ol>
<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>
<translate>New vote</translate>

View File

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

View File

@ -101,7 +101,7 @@ angular.module('OpenSlidesApp.users', [])
firstName = _.trim(this.first_name),
lastName = _.trim(this.last_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) {
name += [lastName, firstName].join(', ');
} else {