(js) Fix syncing of calendar categories colors

This commit is contained in:
Francis Lachapelle
2018-09-11 15:17:31 -04:00
parent 8f4a24fb67
commit 38c733bf8b
4 changed files with 18 additions and 8 deletions
@@ -64,13 +64,13 @@
this.resetCalendarCategories = function(form) {
this.preferences.defaults.SOGoCalendarCategories = _.keys($window.defaultCalendarCategories);
this.preferences.defaults.SOGoCalendarCategoriesColors = angular.copy($window.defaultCalendarCategories);
this.preferences.defaults.SOGoCalendarCategoriesColorsValues = _.values($window.defaultCalendarCategories);
form.$setDirty();
};
this.addCalendarCategory = function(form) {
this.preferences.defaults.SOGoCalendarCategoriesColors[l('New category')] = "#aaa";
this.preferences.defaults.SOGoCalendarCategories.push(l('New category'));
this.preferences.defaults.SOGoCalendarCategoriesColorsValues.push("#aaa");
focus('calendarCategory_' + (this.preferences.defaults.SOGoCalendarCategories.length - 1));
form.$setDirty();
};
@@ -80,9 +80,8 @@
};
this.removeCalendarCategory = function(index, form) {
var key = this.preferences.defaults.SOGoCalendarCategories[index];
this.preferences.defaults.SOGoCalendarCategories.splice(index, 1);
delete this.preferences.defaults.SOGoCalendarCategoriesColors[key];
this.preferences.defaults.SOGoCalendarCategoriesColorsValues.splice(index, 1);
form.$setDirty();
};