mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-28 17:57:38 +00:00
fix(calendar): Add confirmation box when dismissing calendar event edition with background click, only if the event is in edition. Fixes #5585.
This commit is contained in:
@@ -191,6 +191,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
function eventHash(data) {
|
||||
var hash = 0, i, chr, json;
|
||||
json = JSON.stringify({
|
||||
type: data.type,
|
||||
status: data.status,
|
||||
selected: data.selected,
|
||||
repeat: data.repeat,
|
||||
pid: data.pid,
|
||||
destinationCalendar: data.destinationCalendar,
|
||||
delta: data.delta,
|
||||
classification: data.classification,
|
||||
isNew: data.isNew,
|
||||
categories: data.categories,
|
||||
alarm: data.alarm,
|
||||
type: data.type,
|
||||
summary: data.summary,
|
||||
status: data.status,
|
||||
organizer: data.organizer,
|
||||
location: data.location,
|
||||
isAllDay: data.isAllDay,
|
||||
comment: data.comment,
|
||||
attendees: data.attendees
|
||||
});
|
||||
|
||||
if (json.length === 0) return hash;
|
||||
for (i = 0; i < json.length; i++) {
|
||||
chr = json.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash |= 0;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
function newComponent($event, type, baseComponent) {
|
||||
var component;
|
||||
|
||||
@@ -206,6 +240,23 @@
|
||||
// UI/Templates/SchedulerUI/UIxAppointmentEditorTemplate.wox or
|
||||
// UI/Templates/SchedulerUI/UIxTaskEditorTemplate.wox
|
||||
var templateUrl = 'UIx' + type.capitalize() + 'EditorTemplate';
|
||||
|
||||
// TODO: Improve Angular implementation
|
||||
var originalCancel = $mdDialog.cancel;
|
||||
var originalDataHash = eventHash(component);
|
||||
|
||||
$mdDialog.cancel = () => {
|
||||
var newDataHash = eventHash(component);
|
||||
|
||||
if (originalDataHash === newDataHash) {
|
||||
originalCancel();
|
||||
$mdDialog.cancel = originalCancel;
|
||||
} else if (confirm(l('You have modified data unsaved. Do you want to close popup and loose data ?'))) {
|
||||
originalCancel();
|
||||
$mdDialog.cancel = originalCancel;
|
||||
}
|
||||
};
|
||||
|
||||
return $mdDialog.show({
|
||||
parent: angular.element(document.body),
|
||||
targetEvent: $event,
|
||||
|
||||
@@ -216,6 +216,7 @@
|
||||
this.categories = {};
|
||||
this.showRecurrenceEditor = this.component.$hasCustomRepeat;
|
||||
this.showAttendeesEditor = this.component.attendees && this.component.attendees.length;
|
||||
this.isFullscreen = false;
|
||||
|
||||
if (this.component.type == 'appointment') {
|
||||
this.component.initAttendees();
|
||||
@@ -296,6 +297,10 @@
|
||||
this.component.$attendees.initOrganizer(Calendar.$get(this.component.destinationCalendar));
|
||||
};
|
||||
|
||||
this.toggleFullscreen = function() {
|
||||
vm.isFullscreen = !vm.isFullscreen;
|
||||
}
|
||||
|
||||
// Autocomplete cards for attendees
|
||||
this.cardFilter = function ($query) {
|
||||
return AddressBook.$filterAll($query);
|
||||
|
||||
Reference in New Issue
Block a user