Skip to content

Commit

Permalink
fix(calendar): Add confirmation box when dismissing calendar event ed…
Browse files Browse the repository at this point in the history
…ition with background click, only if the event is in edition. Fixes #5585
  • Loading branch information
WoodySlum committed Mar 27, 2023
1 parent bb4a88b commit 65d4c5c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion UI/WebServerResources/js/Scheduler.services.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion UI/WebServerResources/js/Scheduler.services.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions UI/WebServerResources/js/Scheduler/CalendarListController.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,26 @@
// UI/Templates/SchedulerUI/UIxTaskEditorTemplate.wox
var templateUrl = 'UIx' + type.capitalize() + 'EditorTemplate';

if (vm.isComponentOpened) { // Prevent opening a new modal if there is already one opened (multiple clicks)
return;
}

// TODO: Improve Angular implementation
var originalCancel = $mdDialog.cancel;
var originalDataHash = eventHash(component);
vm.isComponentOpened = true;

$mdDialog.cancel = () => {
var newDataHash = eventHash(component);

if (originalDataHash === newDataHash) {
originalCancel();
$mdDialog.cancel = originalCancel;
vm.isComponentOpened = false;
} else if (confirm(l('You have modified data unsaved. Do you want to close popup and loose data ?'))) {
originalCancel();
$mdDialog.cancel = originalCancel;
vm.isComponentOpened = false;
}
};

Expand Down

0 comments on commit 65d4c5c

Please sign in to comment.