add auto-focus when single/multiple is toggled

This commit is contained in:
Bill Parrott
2015-02-19 08:46:45 -06:00
parent c215b90869
commit 98c6526cf7
2 changed files with 4 additions and 2 deletions

View File

@@ -45,6 +45,7 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
addTask(addTo, listDef, listDef.newTask);
}
delete listDef.newTask;
delete listDef.focus;
};
$scope.toggleBulk = function(list) {
@@ -52,6 +53,7 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
list.bulk = false;
}
list.bulk = !list.bulk;
list.focus = true;
};
/**

View File

@@ -24,8 +24,8 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
// Add New
form.task-add(name='new{{list.type}}form', ng-hide='obj._locked', ng-submit='addTask(obj[list.type+"s"],list)')
textarea(rows='6', ng-model='list.newTask', placeholder='{{list.placeHolderBulk}}', ng-if='list.bulk', ui-keydown='{"meta-enter ctrl-enter":"addTask(obj[list.type+\'s\'],list)"}', required)
input(type='text', ng-model='list.newTask', placeholder='{{list.placeHolder}}', ng-if='!list.bulk', required)
textarea(rows='6', task-focus='list.bulk && list.focus', ng-model='list.newTask', placeholder='{{list.placeHolderBulk}}', ng-if='list.bulk', ui-keydown='{"meta-enter ctrl-enter":"addTask(obj[list.type+\'s\'],list)"}', required)
input(type='text', task-focus='!list.bulk && list.focus', ng-model='list.newTask', placeholder='{{list.placeHolder}}', ng-if='!list.bulk', required)
button(type='submit', ng-disabled='new{{list.type}}form.$invalid')
span.glyphicon.glyphicon-plus
small.help-block.btn-link.pull-right(ng-click='toggleBulk(list)')