Optimized template and translation for majority feature.
This commit is contained in:
parent
45aa4146da
commit
7ada65a628
@ -191,8 +191,8 @@ def get_config_variables():
|
||||
name='motions_poll_default_majority_method',
|
||||
default_value='simple_majority',
|
||||
input_type='majorityMethod',
|
||||
label='Method for majority tests',
|
||||
help_text='Default method to determine whether a motion is successful.',
|
||||
label='Required majority',
|
||||
help_text='Default method to check whether a motion has reached the required majority.',
|
||||
weight=357,
|
||||
group='Motions',
|
||||
subgroup='Voting and ballot papers')
|
||||
|
@ -1643,6 +1643,12 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
gettext('All valid ballots');
|
||||
gettext('All casted ballots');
|
||||
gettext('Disabled (no percents)');
|
||||
gettext('Required majority');
|
||||
gettext('Default method to check whether a motion has reached the required majority.');
|
||||
gettext('Simple majority');
|
||||
gettext('Two-thirds majority');
|
||||
gettext('Three-quarters majority');
|
||||
gettext('Disabled');
|
||||
gettext('Number of ballot papers (selection)');
|
||||
gettext('Number of all delegates');
|
||||
gettext('Number of all participants');
|
||||
|
@ -182,7 +182,7 @@
|
||||
</button>
|
||||
|
||||
<!-- Print poll PDF -->
|
||||
<a ng-click="makePollPDF()" class="btn btn-default btn-xs"
|
||||
<a os-perms="motions.can_manage" ng-click="makePollPDF()" class="btn btn-default btn-xs"
|
||||
title="{{ 'Print ballot paper' | translate }}">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</a>
|
||||
@ -191,17 +191,11 @@
|
||||
<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">
|
||||
<input type="checkbox" ng-model="isMajorityCalculation">
|
||||
<span translate>Calculate majority</span>
|
||||
<a href="#" ng-click="isMajorityDetails = !isMajorityDetails">
|
||||
<i class="fa toggle-icon" ng-class="isMajorityDetails ? 'fa-angle-up' : 'fa-angle-down'"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div uib-collapse="!isMajorityDetails" ng-cloak>
|
||||
<div class="input-group">
|
||||
<span translate>Majority method:</span>
|
||||
<select ng-model="method" ng-options="option.value as option.display_name for option in methodChoices" />
|
||||
<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 for option in methodChoices" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -272,17 +266,15 @@
|
||||
{{ votesCast.value }} {{ votesCast.percentStr }}
|
||||
</span>
|
||||
<!-- majority calculation -->
|
||||
<tr ng-if="isMajorityCalculation">
|
||||
<tr os-perms="motions.can_manage" ng-hide="method == 'disabled'">
|
||||
<td class="icon">
|
||||
<td>
|
||||
<span class="text-warning" ng-if="isReached() === undefined" translate>Calculation impossible</span>
|
||||
<span class="text-success" ng-if="isReached() >= 0">
|
||||
<translate>Quorum reached,</translate>
|
||||
{{ isReached() }} <translate>votes more than needed.</translate>
|
||||
<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,</translate>
|
||||
{{ -(isReached()) }} <translate>votes missing.</translate>
|
||||
<span class="text-danger" ng-if="isReached() < 0" translate>
|
||||
Quorum not reached, {{ -(isReached()) }} <translate>votes missing.
|
||||
</span>
|
||||
</table>
|
||||
</ol>
|
||||
|
@ -8,6 +8,7 @@ angular.module('OpenSlidesApp.poll.majority', [])
|
||||
{'value': 'simple_majority', 'display_name': 'Simple majority'},
|
||||
{'value': 'two-thirds_majority', 'display_name': 'Two-thirds majority'},
|
||||
{'value': 'three-quarters_majority', 'display_name': 'Three-quarters majority'},
|
||||
{'value': 'disabled', 'display_name': 'Disabled'},
|
||||
])
|
||||
|
||||
.factory('MajorityMethods', [
|
||||
@ -30,6 +31,9 @@ angular.module('OpenSlidesApp.poll.majority', [])
|
||||
}
|
||||
return result;
|
||||
},
|
||||
'disabled': function () {
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
}
|
||||
])
|
||||
|
@ -143,5 +143,5 @@ class TestConfigDBQueries(TestCase):
|
||||
|
||||
TODO: The last 57 requests are a bug.
|
||||
"""
|
||||
with self.assertNumQueries(60):
|
||||
with self.assertNumQueries(61):
|
||||
self.client.get(reverse('config-list'))
|
||||
|
Loading…
Reference in New Issue
Block a user