Inline editing for motion reason

This commit is contained in:
FinnStutzenstein 2017-08-18 11:40:00 +02:00
parent 14e38861c7
commit 0f6d2d431c
4 changed files with 44 additions and 7 deletions

View File

@ -36,6 +36,7 @@ Motions:
- Added config value for pagenumber alignment in PDF [#3327]. - Added config value for pagenumber alignment in PDF [#3327].
- Bugfix: Several bugfixes regarding splitting list items in - Bugfix: Several bugfixes regarding splitting list items in
change recommendations [#3288] change recommendations [#3288]
- Added inline Editing for motion reason [#3361].
Users: Users:
- User without permission to see users can now see agenda item speakers, - User without permission to see users can now see agenda item speakers,

View File

@ -1214,7 +1214,7 @@ angular.module('OpenSlidesApp.motions.site', [
$scope.setProjectionMode($scope.projectionModes[0]); $scope.setProjectionMode($scope.projectionModes[0]);
} }
if ($scope.change_recommendations.length > 0) { if ($scope.change_recommendations.length > 0) {
$scope.inlineEditing.disable(); $scope.disableMotionInlineEditing();
} }
}); });
$scope.$watch(function () { $scope.$watch(function () {
@ -1313,7 +1313,7 @@ angular.module('OpenSlidesApp.motions.site', [
// open edit dialog // open edit dialog
$scope.openDialog = function (motion) { $scope.openDialog = function (motion) {
if ($scope.inlineEditing.active) { if ($scope.inlineEditing.active) {
$scope.inlineEditing.disable(); $scope.disableMotionInlineEditing();
} }
ngDialog.open(MotionForm.getDialog(motion)); ngDialog.open(MotionForm.getDialog(motion));
}; };
@ -1428,6 +1428,7 @@ angular.module('OpenSlidesApp.motions.site', [
$scope.showVersion = function (version) { $scope.showVersion = function (version) {
$scope.version = version.id; $scope.version = version.id;
$scope.inlineEditing.setVersion(motion, version.id); $scope.inlineEditing.setVersion(motion, version.id);
$scope.reasonInlineEditing.setVersion(motion, version.id);
$scope.createChangeRecommendation.setVersion(motion, version.id); $scope.createChangeRecommendation.setVersion(motion, version.id);
}; };
// permit specific version // permit specific version
@ -1483,18 +1484,51 @@ angular.module('OpenSlidesApp.motions.site', [
Config.get('motions_allow_disable_versioning').value); Config.get('motions_allow_disable_versioning').value);
} }
); );
$scope.reasonInlineEditing = MotionInlineEditing.createInstance($scope, motion,
'reason-inline-editor', true,
function (obj) {
return motion.getReason($scope.version);
},
function (obj) {
motion.reason = obj.editor.getData();
motion.disable_versioning = (obj.trivialChange &&
Config.get('motions_allow_disable_versioning').value);
}
);
// Wrapper functions for $scope.inlineEditing, to warn other users. // Wrapper functions for $scope.inlineEditing, to warn other users.
var editingStoppedCallback; var editingStoppedCallback;
$scope.enableMotionInlineEditing = function () { $scope.enableMotionInlineEditing = function () {
editingStoppedCallback = EditingWarning.editingStarted('motion_update_' + motion.id); editingStoppedCallback = EditingWarning.editingStarted('motion_update_' + motion.id);
if ($scope.motion.getReason($scope.version)) {
$scope.reasonInlineEditing.enable();
}
$scope.inlineEditing.enable(); $scope.inlineEditing.enable();
}; };
$scope.disableMotionInlineEditing = function () { $scope.disableMotionInlineEditing = function () {
if (editingStoppedCallback) { if (editingStoppedCallback) {
editingStoppedCallback(); editingStoppedCallback();
} }
if ($scope.motion.getReason($scope.version)) {
$scope.reasonInlineEditing.disable();
}
$scope.inlineEditing.disable(); $scope.inlineEditing.disable();
}; };
$scope.textReasonSaveToolbarVisible = function () {
return ($scope.inlineEditing.changed && $scope.inlineEditing.active) ||
($scope.reasonInlineEditing.changed && $scope.reasonInlineEditing.active);
};
$scope.textReasonSave = function () {
if ($scope.motion.getReason($scope.version)) {
$scope.reasonInlineEditing.save();
}
$scope.inlineEditing.save();
};
$scope.textReasonRevert = function () {
if ($scope.motion.getReason($scope.version)) {
$scope.reasonInlineEditing.revert();
}
$scope.inlineEditing.revert();
};
$scope.commentsInlineEditing = MotionCommentsInlineEditing.createInstances($scope, motion); $scope.commentsInlineEditing = MotionCommentsInlineEditing.createInstances($scope, motion);
$scope.personalNoteInlineEditing = MotionInlineEditing.createInstance($scope, motion, $scope.personalNoteInlineEditing = MotionInlineEditing.createInstance($scope, motion,
'personal-note-inline-editor', false, 'personal-note-inline-editor', false,

View File

@ -482,7 +482,9 @@
<!-- reason --> <!-- reason -->
<div ng-if="motion.getReason(version) != ''"> <div ng-if="motion.getReason(version) != ''">
<h3 translate>Reason</h3> <h3 translate>Reason</h3>
<div ng-bind-html="motion.getReason(version) | trusted"></div> <div id="reason-inline-editor" ng-bind-html="motion.getReason(version) | trusted"
contenteditable="{{ reasonInlineEditing.isEditable }}">
</div>
</div> </div>
<!-- attachments --> <!-- attachments -->

View File

@ -4,12 +4,12 @@
class="motion-text motion-text-original line-numbers-{{ lineNumberMode }}" class="motion-text motion-text-original line-numbers-{{ lineNumberMode }}"
contenteditable="{{ inlineEditing.isEditable }}"> contenteditable="{{ inlineEditing.isEditable }}">
</div> </div>
<div class="motion-save-toolbar" ng-class="{ 'visible': (inlineEditing.changed && inlineEditing.active) }"> <div class="motion-save-toolbar" ng-class="{ 'visible': textReasonSaveToolbarVisible() }">
<div class="changed-hint" translate>The text has been changed.</div> <div class="changed-hint" translate>The text or reason have been changed.</div>
<button type="button" ng-click="inlineEditing.save()" class="btn btn-primary" translate> <button type="button" ng-click="textReasonSave()" class="btn btn-primary" translate>
Save Save
</button> </button>
<button type="button" ng-click="inlineEditing.revert()" class="btn btn-default" translate> <button type="button" ng-click="textReasonRevert()" class="btn btn-default" translate>
Revert Revert
</button> </button>
<label ng-if="motion.state.versioning && config('motions_allow_disable_versioning')"> <label ng-if="motion.state.versioning && config('motions_allow_disable_versioning')">