Merge pull request #3261 from FinnStutzenstein/NotifyWithInlineEditing
Also notify users when they inline edit a motion
This commit is contained in:
commit
76918c47a4
@ -422,7 +422,7 @@ img {
|
||||
color: black;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
z-index: 10000;
|
||||
z-index: 1000001;
|
||||
display: none;
|
||||
border: 1px solid #d3d3d3;
|
||||
margin-left: -150px;
|
||||
|
@ -583,10 +583,10 @@ angular.module('OpenSlidesApp.core.site', [
|
||||
|
||||
/* This Factory could be used in any dialog, if the user should be warned, if another user
|
||||
* also has this dialog open. Use it like in this example in any dialog controller:
|
||||
var dialogClosedCallback = DialogEditingWarning.dialogOpened('dialog_name' + item.id);
|
||||
$scope.$on('$destroy', dialogClosedCallback);
|
||||
var editingStoppedCallback = EditingWarning.editingStarted('editing_name' + item.id);
|
||||
$scope.$on('$destroy', editingStoppedCallback);
|
||||
*/
|
||||
.factory('DialogEditingWarning', [
|
||||
.factory('EditingWarning', [
|
||||
'operator',
|
||||
'gettextCatalog',
|
||||
'Notify',
|
||||
@ -595,7 +595,7 @@ angular.module('OpenSlidesApp.core.site', [
|
||||
return {
|
||||
// This returns the callback function that the controller should call, if
|
||||
// the dialog got closed by the user. Provide a unique dialog name.
|
||||
dialogOpened: function (dialogName) {
|
||||
editingStarted: function (dialogName) {
|
||||
// List of active editors
|
||||
var editorNames = [];
|
||||
var messagingId = dialogName + 'EditingWarning';
|
||||
|
@ -1191,10 +1191,12 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
'ProjectionDefault',
|
||||
'MotionBlock',
|
||||
'MotionPdfExport',
|
||||
'EditingWarning',
|
||||
function($scope, $http, $timeout, operator, ngDialog, gettextCatalog, MotionForm,
|
||||
ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation,
|
||||
Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motionId, MotionInlineEditing,
|
||||
MotionCommentsInlineEditing, Projector, ProjectionDefault, MotionBlock, MotionPdfExport) {
|
||||
MotionCommentsInlineEditing, Projector, ProjectionDefault, MotionBlock, MotionPdfExport,
|
||||
EditingWarning) {
|
||||
var motion = Motion.get(motionId);
|
||||
Category.bindAll({}, $scope, 'categories');
|
||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||
@ -1490,6 +1492,18 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
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);
|
||||
$scope.inlineEditing.enable();
|
||||
};
|
||||
$scope.disableMotionInlineEditing = function () {
|
||||
if (editingStoppedCallback) {
|
||||
editingStoppedCallback();
|
||||
}
|
||||
$scope.inlineEditing.disable();
|
||||
};
|
||||
$scope.commentsInlineEditing = MotionCommentsInlineEditing.createInstances($scope, motion);
|
||||
$scope.personalNoteInlineEditing = MotionInlineEditing.createInstance($scope, motion,
|
||||
'personal-note-inline-editor', false,
|
||||
@ -1693,9 +1707,9 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
'AgendaUpdate',
|
||||
'motionId',
|
||||
'ErrorMessage',
|
||||
'DialogEditingWarning',
|
||||
'EditingWarning',
|
||||
function($scope, $state, Motion, Category, Config, Mediafile, MotionForm,
|
||||
Tag, User, Workflow, Agenda, AgendaUpdate, motionId, ErrorMessage, DialogEditingWarning) {
|
||||
Tag, User, Workflow, Agenda, AgendaUpdate, motionId, ErrorMessage, EditingWarning) {
|
||||
Category.bindAll({}, $scope, 'categories');
|
||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||
Tag.bindAll({}, $scope, 'tags');
|
||||
@ -1751,8 +1765,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
}
|
||||
|
||||
// Displaying a warning, if other users edit this motion too
|
||||
var dialogClosedCallback = DialogEditingWarning.dialogOpened('motion_update_dialog_' + motionId);
|
||||
$scope.$on('$destroy', dialogClosedCallback);
|
||||
var editingStoppedCallback = EditingWarning.editingStarted('motion_update_' + motionId);
|
||||
$scope.$on('$destroy', editingStoppedCallback);
|
||||
|
||||
// Save motion
|
||||
$scope.save = function (motion, gotoDetailView) {
|
||||
|
@ -2,12 +2,12 @@
|
||||
<!-- inline editing -->
|
||||
<div class="pull-right inline-editing-activator"
|
||||
ng-if="motion.isAllowed('update') && version == motion.getVersion(-1).id && viewChangeRecommendations.mode == 'original'">
|
||||
<button ng-if="!inlineEditing.active && change_recommendations.length == 0" ng-click="inlineEditing.enable()"
|
||||
<button ng-if="!inlineEditing.active && change_recommendations.length == 0" ng-click="enableMotionInlineEditing()"
|
||||
class="btn btn-sm btn-default">
|
||||
<i class="fa fa-pencil-square-o"></i>
|
||||
<translate>Inline editing</translate>
|
||||
</button>
|
||||
<button ng-if="inlineEditing.active && change_recommendations.length == 0" ng-click="inlineEditing.disable()"
|
||||
<button ng-if="inlineEditing.active && change_recommendations.length == 0" ng-click="disableMotionInlineEditing()"
|
||||
class="btn btn-sm btn-default">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
<translate>Inline editing</translate>
|
||||
|
Loading…
Reference in New Issue
Block a user