(js) Focus to new calendar/contact category field

Fixes #172
pull/186/head
Francis Lachapelle 2015-12-10 11:46:56 -05:00
parent eb539c1354
commit b74b73bca4
2 changed files with 8 additions and 4 deletions

View File

@ -364,7 +364,8 @@
<sg-color-picker ng-model="app.preferences.defaults.SOGoCalendarCategoriesColors[item]"><!-- color picker--></sg-color-picker>
<md-input-container>
<input type="text" label:aria-label="Calendar Category"
ng-model="app.preferences.defaults.SOGoCalendarCategories[$index]"/>
ng-model="app.preferences.defaults.SOGoCalendarCategories[$index]"
sg-focus-on="calendarCategory_{{$index}}"/>
</md-input-container>
<md-button class="sg-icon-button" type="button"
layout="row" layout-align="end center"
@ -447,7 +448,8 @@
<md-input-container>
<input type="text"
label:aria-label="Contact Category"
ng-model="app.preferences.defaults.SOGoContactsCategories[$index]"/>
ng-model="app.preferences.defaults.SOGoContactsCategories[$index]"
sg-focus-on="contactCategory_{{$index}}"/>
</md-input-container>
<md-button type="button" class="sg-icon-button"
label:aria-label="Remove Contact Category"

View File

@ -7,8 +7,8 @@
/**
* @ngInject
*/
PreferencesController.$inject = ['$q', '$window', '$state', '$mdDialog', '$mdToast', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication'];
function PreferencesController($q, $window, $state, $mdDialog, $mdToast, Dialog, User, Account, statePreferences, Authentication) {
PreferencesController.$inject = ['$q', '$window', '$state', '$mdDialog', '$mdToast', 'sgFocus', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication'];
function PreferencesController($q, $window, $state, $mdDialog, $mdToast, focus, Dialog, User, Account, statePreferences, Authentication) {
var vm = this, account, mailboxes = [];
vm.preferences = statePreferences;
@ -73,6 +73,7 @@
function addCalendarCategory() {
vm.preferences.defaults.SOGoCalendarCategoriesColors["New category"] = "#aaa";
vm.preferences.defaults.SOGoCalendarCategories.push("New category");
focus('calendarCategory_' + (vm.preferences.defaults.SOGoCalendarCategories.length - 1));
}
function removeCalendarCategory(index) {
@ -83,6 +84,7 @@
function addContactCategory() {
vm.preferences.defaults.SOGoContactsCategories.push("");
focus('contactCategory_' + (vm.preferences.defaults.SOGoContactsCategories.length - 1));
}
function removeContactCategory(index) {