mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-19 21:53:19 +00:00
(feat) now able to copy/move events and also duplicate them (fixes #3196)
This commit is contained in:
@@ -1229,6 +1229,28 @@
|
||||
return localizedString;
|
||||
};
|
||||
|
||||
/**
|
||||
* @function copyTo
|
||||
* @memberof Component.prototype
|
||||
* @desc Copy an event to a calendar
|
||||
* @param {string} calendar - a target calendar UID
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Component.prototype.copyTo = function(calendar) {
|
||||
return Component.$$resource.post(this.pid + '/' + this.id, 'copy', {destination: calendar});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function moveTo
|
||||
* @memberof Component.prototype
|
||||
* @desc Move an event to a calendar
|
||||
* @param {string} calendar - a target calendar UID
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Component.prototype.moveTo = function(calendar) {
|
||||
return Component.$$resource.post(this.pid + '/' + this.id, 'move', {destination: calendar});
|
||||
};
|
||||
|
||||
Component.prototype.toString = function() {
|
||||
return '[Component ' + this.id + ']';
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
function ComponentController($rootScope, $mdDialog, Calendar, Component, AddressBook, Alarm, stateComponent) {
|
||||
var vm = this, component;
|
||||
|
||||
vm.calendarService = Calendar;
|
||||
vm.service = Component;
|
||||
vm.component = stateComponent;
|
||||
vm.close = close;
|
||||
@@ -21,6 +22,8 @@
|
||||
vm.deleteOccurrence = deleteOccurrence;
|
||||
vm.deleteAllOccurrences = deleteAllOccurrences;
|
||||
vm.toggleRawSource = toggleRawSource;
|
||||
vm.copySelectedComponent = copySelectedComponent;
|
||||
vm.moveSelectedComponent = moveSelectedComponent;
|
||||
|
||||
// Load all attributes of component
|
||||
if (angular.isUndefined(vm.component.$futureComponentData)) {
|
||||
@@ -141,6 +144,20 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function copySelectedComponent(calendar) {
|
||||
vm.component.copyTo(calendar).then(function() {
|
||||
$mdDialog.hide();
|
||||
$rootScope.$emit('calendars:list');
|
||||
});
|
||||
}
|
||||
|
||||
function moveSelectedComponent(calendar) {
|
||||
vm.component.moveTo(calendar).then(function() {
|
||||
$mdDialog.hide();
|
||||
$rootScope.$emit('calendars:list');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user