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. - Candidates are now sortable.
- Removed unused assignment config to publish winner election results only. - Removed unused assignment config to publish winner election results only.
- Number of ballots printed can now be set in config. - Number of ballots printed can now be set in config.
- Added inline edit field for a specific hint on ballot papers.
Users: Users:
- Added new matrix-interface for managing groups and their permissions. - Added new matrix-interface for managing groups and their permissions.

View File

@ -205,7 +205,8 @@ angular.module('OpenSlidesApp.assignments.site', [
'MajorityMethodChoices', 'MajorityMethodChoices',
'Config', 'Config',
'AssignmentPollDetailCtrlCache', 'AssignmentPollDetailCtrlCache',
function ($scope, MajorityMethodChoices, Config, AssignmentPollDetailCtrlCache) { 'AssignmentPoll',
function ($scope, MajorityMethodChoices, Config, AssignmentPollDetailCtrlCache, AssignmentPoll) {
// Define choices. // Define choices.
$scope.methodChoices = MajorityMethodChoices; $scope.methodChoices = MajorityMethodChoices;
// TODO: Get $scope.baseChoices from config_variables.py without copying them. // 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.recalculateMajorities($scope.method);
$scope.saveDescriptionChange = function (poll) {
AssignmentPoll.save(poll);
};
// Save current values to cache on destroy of this controller. // Save current values to cache on destroy of this controller.
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {
AssignmentPollDetailCtrlCache[$scope.poll.id] = { AssignmentPollDetailCtrlCache[$scope.poll.id] = {
@ -814,15 +819,6 @@ angular.module('OpenSlidesApp.assignments.site', [
label: gettextCatalog.getString('Casted ballots'), label: gettextCatalog.getString('Casted ballots'),
type: 'number' 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 }}"> index="$index" heading="{{ 'Ballot' | translate }} {{ assignment.polls.length - $index }}">
<div ng-controller="AssignmentPollDetailCtrl"> <div ng-controller="AssignmentPollDetailCtrl">
<!-- action buttons --> <!-- 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 --> <!-- delete -->
<a class="btn btn-danger btn-xs" <a class="btn btn-danger btn-xs"
ng-bootbox-confirm="{{ 'Are you sure you want to delete this ballot?' | translate }}" ng-bootbox-confirm="{{ 'Are you sure you want to delete this ballot?' | translate }}"
@ -142,7 +148,7 @@
<translate>Delete</translate> <translate>Delete</translate>
</a> </a>
</div> </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'". <!-- 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 "/". --> Otherwise the pdf url can't be open in same window; angular redirects to "/". -->
<!-- PDF --> <!-- PDF -->