Inline edit the ballot description (closes #2560)

This commit is contained in:
FinnStutzenstein 2017-02-06 15:55:32 +01:00
parent 12b50a0d68
commit 38279f4895
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 }}"