From 4ab19ac225ef84ccf58e4628f2986f1a26d7a5e2 Mon Sep 17 00:00:00 2001 From: gjoyner Date: Mon, 13 Oct 2014 14:10:59 -0700 Subject: [PATCH] Popovers now disappear when clicking Save and Close --- public/js/controllers/tasksCtrl.js | 4 +++- views/shared/tasks/task.jade | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/js/controllers/tasksCtrl.js b/public/js/controllers/tasksCtrl.js index 577850d20b..6c7541f74e 100644 --- a/public/js/controllers/tasksCtrl.js +++ b/public/js/controllers/tasksCtrl.js @@ -64,11 +64,13 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N User.user.ops.deleteTask({params:{id:list[$index].id}}) }; - $scope.saveTask = function(task, stayOpen) { + $scope.saveTask = function(task, stayOpen, isSaveAndClose) { if (task.checklist) task.checklist = _.filter(task.checklist,function(i){return !!i.text}); User.user.ops.updateTask({params:{id:task.id},body:task}); if (!stayOpen) task._editing = false; + if (isSaveAndClose) + $("#task-" + task.id).parent().children('.popover').removeClass('in'); }; /** diff --git a/views/shared/tasks/task.jade b/views/shared/tasks/task.jade index a16b488f61..4b00804cc1 100644 --- a/views/shared/tasks/task.jade +++ b/views/shared/tasks/task.jade @@ -143,7 +143,7 @@ li(bindonce='list', bo-id='"task-"+task.id', ng-repeat='task in obj[list.type+"s input.inline-edit(type='text',ng-model='item.text',ui-keydown="{'8 46':'removeChecklistItem(task,$event,$index)'}",ui-keyup="{'13':'addChecklistItem(task,$event,$index)','38 40':'navigateChecklist(task,$index,$event)'}") - form(ng-submit='saveTask(task)') + form(ng-submit='saveTask(task,false,true)') // text & notes fieldset.option-group label.option-title=env.t('text')