Merge pull request #2937 from FinnStutzenstein/Issue2560

Inline edit the ballot description (closes #2560)
This commit is contained in:
Emanuel Schütze 2017-02-07 12:00:56 +01:00 committed by GitHub
commit eb0d34d212
3 changed files with 15 additions and 12 deletions

View File

@ -76,6 +76,7 @@ Elections:
- Candidates are now sortable.
- Removed unused assignment config to publish winner election results only.
- Number of ballots printed can now be set in config.
- Added inline edit field for a specific hint on ballot papers.
Users:
- Added new matrix-interface for managing groups and their permissions.

View File

@ -205,7 +205,8 @@ angular.module('OpenSlidesApp.assignments.site', [
'MajorityMethodChoices',
'Config',
'AssignmentPollDetailCtrlCache',
function ($scope, MajorityMethodChoices, Config, AssignmentPollDetailCtrlCache) {
'AssignmentPoll',
function ($scope, MajorityMethodChoices, Config, AssignmentPollDetailCtrlCache, AssignmentPoll) {
// Define choices.
$scope.methodChoices = MajorityMethodChoices;
// TODO: Get $scope.baseChoices from config_variables.py without copying them.
@ -228,6 +229,10 @@ angular.module('OpenSlidesApp.assignments.site', [
};
$scope.recalculateMajorities($scope.method);
$scope.saveDescriptionChange = function (poll) {
AssignmentPoll.save(poll);
};
// Save current values to cache on destroy of this controller.
$scope.$on('$destroy', function() {
AssignmentPollDetailCtrlCache[$scope.poll.id] = {
@ -814,15 +819,6 @@ angular.module('OpenSlidesApp.assignments.site', [
label: gettextCatalog.getString('Casted ballots'),
type: 'number'
}
},
// TODO: update description in separat request
// (without vote result values)
{
key: 'description',
type: 'input',
templateOptions: {
label: gettextCatalog.getString('Comment on the ballot paper')
}
}
);

View File

@ -133,7 +133,13 @@
index="$index" heading="{{ 'Ballot' | translate }} {{ assignment.polls.length - $index }}">
<div ng-controller="AssignmentPollDetailCtrl">
<!-- action buttons -->
<div class="pull-right">
<div class="pull-right" os-perms="assignments.can_manage">
<span class="spacer-right" editable-text="poll.description" onaftersave="saveDescriptionChange(poll)"
uib-tooltip="{{ 'Hint on the ballot paper.' | translate }}">
<span ng-if="!poll.description" translate>Set hint for ballot paper ...</span>
<span ng-if="poll.description">{{ poll.description }}</span>
<i class="fa fa-pencil"></i>
</span>
<!-- delete -->
<a class="btn btn-danger btn-xs"
ng-bootbox-confirm="{{ 'Are you sure you want to delete this ballot?' | translate }}"
@ -142,7 +148,7 @@
<translate>Delete</translate>
</a>
</div>
<div os-perms="assignments.can_manage" class="spacer " role="group">
<div os-perms="assignments.can_manage" class="spacer" role="group">
<!-- angular requires to open the link in new tab with "target='_blank'".
Otherwise the pdf url can't be open in same window; angular redirects to "/". -->
<!-- PDF -->