From 0f6d2d431cdb00f4d63792ebdd0c839ca93ca7c3 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Fri, 18 Aug 2017 11:40:00 +0200 Subject: [PATCH] Inline editing for motion reason --- CHANGELOG | 1 + openslides/motions/static/js/motions/site.js | 38 ++++++++++++++++++- .../templates/motions/motion-detail.html | 4 +- .../motions/motion-detail/view-original.html | 8 ++-- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 311af3106..93ac59357 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -36,6 +36,7 @@ Motions: - Added config value for pagenumber alignment in PDF [#3327]. - Bugfix: Several bugfixes regarding splitting list items in change recommendations [#3288] +- Added inline Editing for motion reason [#3361]. Users: - User without permission to see users can now see agenda item speakers, diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index b60cd3717..f6bb8403d 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -1214,7 +1214,7 @@ angular.module('OpenSlidesApp.motions.site', [ $scope.setProjectionMode($scope.projectionModes[0]); } if ($scope.change_recommendations.length > 0) { - $scope.inlineEditing.disable(); + $scope.disableMotionInlineEditing(); } }); $scope.$watch(function () { @@ -1313,7 +1313,7 @@ angular.module('OpenSlidesApp.motions.site', [ // open edit dialog $scope.openDialog = function (motion) { if ($scope.inlineEditing.active) { - $scope.inlineEditing.disable(); + $scope.disableMotionInlineEditing(); } ngDialog.open(MotionForm.getDialog(motion)); }; @@ -1428,6 +1428,7 @@ angular.module('OpenSlidesApp.motions.site', [ $scope.showVersion = function (version) { $scope.version = version.id; $scope.inlineEditing.setVersion(motion, version.id); + $scope.reasonInlineEditing.setVersion(motion, version.id); $scope.createChangeRecommendation.setVersion(motion, version.id); }; // permit specific version @@ -1483,18 +1484,51 @@ angular.module('OpenSlidesApp.motions.site', [ 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. var editingStoppedCallback; $scope.enableMotionInlineEditing = function () { editingStoppedCallback = EditingWarning.editingStarted('motion_update_' + motion.id); + if ($scope.motion.getReason($scope.version)) { + $scope.reasonInlineEditing.enable(); + } $scope.inlineEditing.enable(); }; $scope.disableMotionInlineEditing = function () { if (editingStoppedCallback) { editingStoppedCallback(); } + if ($scope.motion.getReason($scope.version)) { + $scope.reasonInlineEditing.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.personalNoteInlineEditing = MotionInlineEditing.createInstance($scope, motion, 'personal-note-inline-editor', false, diff --git a/openslides/motions/static/templates/motions/motion-detail.html b/openslides/motions/static/templates/motions/motion-detail.html index a04d3d7c2..4419aae11 100644 --- a/openslides/motions/static/templates/motions/motion-detail.html +++ b/openslides/motions/static/templates/motions/motion-detail.html @@ -482,7 +482,9 @@

Reason

-
+
+
diff --git a/openslides/motions/static/templates/motions/motion-detail/view-original.html b/openslides/motions/static/templates/motions/motion-detail/view-original.html index 71562463e..1fa945561 100644 --- a/openslides/motions/static/templates/motions/motion-detail/view-original.html +++ b/openslides/motions/static/templates/motions/motion-detail/view-original.html @@ -4,12 +4,12 @@ class="motion-text motion-text-original line-numbers-{{ lineNumberMode }}" contenteditable="{{ inlineEditing.isEditable }}"> -
-
The text has been changed.
- -