mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-05 08:49:21 +00:00
(html,js) Reorder and filter calendars list
This commit is contained in:
1 parent
6cb513f30b
commit
2963654800
7 files changed
+136
-22
No files matched your search
@@ -99,6 +99,12 @@
|
||||
});
|
||||
i = sibling ? _.indexOf(_.map(list, 'id'), sibling.id) : 1;
|
||||
list.splice(i, 0, calendar);
|
||||
|
||||
this.$Preferences.ready().then(function() {
|
||||
if (Calendar.$Preferences.settings.Calendar.FoldersOrder)
|
||||
// Save list order
|
||||
Calendar.saveFoldersOrder(_.flatMap(Calendar.$findAll(), 'id'));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -129,8 +135,8 @@
|
||||
this.$calendars = [];
|
||||
this.$subscriptions = [];
|
||||
this.$webcalendars = [];
|
||||
Calendar.$$resource.fetch('calendarslist').then(function(data) {
|
||||
Calendar.$findAll(data.calendars, writable);
|
||||
return Calendar.$$resource.fetch('calendarslist').then(function(data) {
|
||||
return Calendar.$findAll(data.calendars, writable);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -261,6 +267,23 @@
|
||||
return Calendar.$q.all(promises);
|
||||
};
|
||||
|
||||
/**
|
||||
* @function saveFoldersOrder
|
||||
* @desc Save to the user's settings the current calendars order.
|
||||
* @param {string[]} folders - the folders IDs
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Calendar.saveFoldersOrder = function(folders) {
|
||||
return this.$$resource.post(null, 'saveFoldersOrder', { folders: folders }).then(function() {
|
||||
Calendar.$Preferences.settings.Calendar.FoldersOrder = folders;
|
||||
if (!folders)
|
||||
// Calendars order was reset; reload list
|
||||
return Calendar.$$resource.fetch('calendarslist').then(function(data) {
|
||||
return Calendar.$findAll(data.calendars);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function init
|
||||
* @memberof Calendar.prototype
|
||||
|
||||
Reference in new issue
Block a user