(js) Prevent the creation of empty card categories

This commit is contained in:
Francis Lachapelle committed 2017-10-10 14:55:22 -04:00
1 parent 888adc9396
commit f34937d92c
4 files changed
+11 -2

No files matched your search

@@ -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();
};