mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-20 15:44:53 +00:00
(js) Prevent the creation of empty card categories
This commit is contained in:
@@ -108,6 +108,8 @@
|
||||
|
||||
if (angular.isUndefined(data.SOGoContactsCategories))
|
||||
data.SOGoContactsCategories = [];
|
||||
else
|
||||
data.SOGoContactsCategories = _.compact(data.SOGoContactsCategories);
|
||||
|
||||
angular.extend(_this.defaults, data);
|
||||
|
||||
|
||||
@@ -76,8 +76,12 @@
|
||||
};
|
||||
|
||||
this.addContactCategory = function(form) {
|
||||
this.preferences.defaults.SOGoContactsCategories.push("");
|
||||
focus('contactCategory_' + (this.preferences.defaults.SOGoContactsCategories.length - 1));
|
||||
var i = _.indexOf(this.preferences.defaults.SOGoContactsCategories, "");
|
||||
if (i < 0) {
|
||||
this.preferences.defaults.SOGoContactsCategories.push("");
|
||||
i = this.preferences.defaults.SOGoContactsCategories.length - 1;
|
||||
}
|
||||
focus('contactCategory_' + i);
|
||||
form.$setDirty();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user