mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-19 18:18:12 +00:00
Handle the edition of recurring event occurrences
This commit is contained in:
1 parent
049c1385d6
commit
86a0032cc1
9 files changed
+66
-16
No files matched your search
@@ -274,8 +274,8 @@
|
||||
* @desc Fetch a component attributes from the server.
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Calendar.prototype.$getComponent = function(componentId) {
|
||||
return Calendar.$Component.$find(this.id, componentId);
|
||||
Calendar.prototype.$getComponent = function(componentId, recurrenceId) {
|
||||
return Calendar.$Component.$find(this.id, componentId, recurrenceId);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -124,10 +124,16 @@
|
||||
* @desc Fetch a component from a specific calendar.
|
||||
* @param {string} calendarId - the calendar ID
|
||||
* @param {string} componentId - the component ID
|
||||
* @param {string} [occurrenceId] - the component ID
|
||||
* @see {@link Calendar.$getComponent}
|
||||
*/
|
||||
Component.$find = function(calendarId, componentId) {
|
||||
var futureComponentData = this.$$resource.fetch([calendarId, componentId].join('/'), 'view');
|
||||
Component.$find = function(calendarId, componentId, occurrenceId) {
|
||||
var futureComponentData, path = [calendarId, componentId];
|
||||
|
||||
if (occurrenceId)
|
||||
path.push(occurrenceId);
|
||||
|
||||
futureComponentData = this.$$resource.fetch(path.join('/'), 'view');
|
||||
|
||||
return new Component(futureComponentData);
|
||||
};
|
||||
@@ -608,12 +614,15 @@
|
||||
* @desc Save the component to the server.
|
||||
*/
|
||||
Component.prototype.$save = function() {
|
||||
var _this = this, options;
|
||||
var _this = this, options, path = [this.pid, this.id];
|
||||
|
||||
if (this.isNew)
|
||||
options = { action: 'saveAs' + this.type.capitalize() };
|
||||
|
||||
return Component.$$resource.save([this.pid, this.id].join('/'), this.$omit(), options)
|
||||
if (this.occurrenceId)
|
||||
path.push(this.occurrenceId);
|
||||
|
||||
return Component.$$resource.save(path.join('/'), this.$omit(), options)
|
||||
.then(function(data) {
|
||||
// Make a copy of the data for an eventual reset
|
||||
_this.$shadowData = _this.$omit(true);
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
vm.component = stateComponent;
|
||||
vm.close = close;
|
||||
vm.edit = edit;
|
||||
vm.editAllOccurrences = editAllOccurrences;
|
||||
|
||||
// Load all attributes of component
|
||||
if (angular.isUndefined(vm.component.$futureComponentData)) {
|
||||
component = Calendar.$get(vm.component.c_folder).$getComponent(vm.component.c_name);
|
||||
component = Calendar.$get(vm.component.c_folder).$getComponent(vm.component.c_name, vm.component.c_recurrence_id);
|
||||
component.$futureComponentData.then(function() {
|
||||
vm.component = component;
|
||||
});
|
||||
@@ -26,6 +27,14 @@
|
||||
$mdDialog.hide();
|
||||
}
|
||||
|
||||
function editAllOccurrences() {
|
||||
component = Calendar.$get(vm.component.pid).$getComponent(vm.component.id);
|
||||
component.$futureComponentData.then(function() {
|
||||
vm.component = component;
|
||||
edit();
|
||||
});
|
||||
}
|
||||
|
||||
function edit() {
|
||||
var type = (vm.component.component == 'vevent')? 'Appointment':'Task';
|
||||
$mdDialog.hide().then(function() {
|
||||
|
||||
Reference in new issue
Block a user