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