(js) Prevent the creation of empty card categories

pull/218/merge
Francis Lachapelle 2017-10-10 14:55:22 -04:00
parent 888adc9396
commit f34937d92c
4 changed files with 11 additions and 2 deletions

2
NEWS
View File

@ -23,6 +23,8 @@ Bug fixes
- [web] only one postal address of same type is saved (#4091)
- [web] improve handling of email notifications of a calendar properties
- [web] fixed XSRF cookie path when changing password (#4139)
- [web] spaces can now be inserted in address book names
- [web] prevent the creation of empty contact categories
- [eas] hebrew folders encoding problem using EAS (#4240)
- [eas] avoid sync requests for shared folders every second (#4275)

View File

@ -497,6 +497,7 @@
<md-input-container class="md-block md-flex">
<input type="text"
label:aria-label="Contact Category"
required="required"
ng-model="app.preferences.defaults.SOGoContactsCategories[$index]"
sg-focus-on="contactCategory_{{$index}}"/>
</md-input-container>

View File

@ -108,6 +108,8 @@
if (angular.isUndefined(data.SOGoContactsCategories))
data.SOGoContactsCategories = [];
else
data.SOGoContactsCategories = _.compact(data.SOGoContactsCategories);
angular.extend(_this.defaults, data);

View File

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