Fixed checklist not advancing to next input. Closes #4430

This commit is contained in:
Blade Barringer 2014-12-29 15:43:20 -06:00
parent 4e1b298a42
commit b3025c36b1
2 changed files with 4 additions and 2 deletions

View file

@ -108,7 +108,7 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
*/
function focusChecklist(task,index) {
window.setTimeout(function(){
$('#task-'+task.id+' .checklist-form .inline-edit')[index].focus();
$('#task-'+task.id+' .checklist-form input[type="text"]')[index].focus();
});
}
$scope.addChecklist = function(task) {
@ -116,6 +116,8 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
focusChecklist(task,0);
}
$scope.addChecklistItem = function(task,$event,$index) {
console.log("ADD CHECKLIST ITEM");
console.log(task);
if (!task.checklist[$index].text) {
// Don't allow creation of an empty checklist item
// TODO Provide UI feedback that this item is still blank

View file

@ -128,7 +128,7 @@ li(bindonce='list', id='task-{{::task.id}}', ng-repeat='task in obj[list.type+"s
button(type='button', ng-if='!task.checklist[0] && (task.type=="daily" || task.type=="todo")',ng-click='addChecklist(task)')
span.glyphicon.glyphicon-tasks
span=env.t('addChecklist')
form(ng-if='task.checklist')
form.checklist-form(ng-if='task.checklist')
fieldset.option-group(ng-if='!$state.includes("options.social.challenges")')
legend.option-title
span.hint(popover=env.t('checklistText'),popover-trigger='mouseenter',popover-placement='bottom')=env.t('checklist')