fix: Update client to remove completed todos immediately

closes #7549
closes #7685
This commit is contained in:
Husman
2016-06-18 09:40:45 -07:00
committed by Blade Barringer
parent ea5a148add
commit 1a19605ee6
3 changed files with 6 additions and 1 deletions

View File

@@ -94,6 +94,7 @@
"confirmFortify": "Are you sure?", "confirmFortify": "Are you sure?",
"fortifyComplete": "Fortify complete!", "fortifyComplete": "Fortify complete!",
"sureDelete": "Are you sure you want to delete the <%= taskType %> with the text \"<%= taskText %>\"?", "sureDelete": "Are you sure you want to delete the <%= taskType %> with the text \"<%= taskText %>\"?",
"sureDeleteCompletedTodos": "Are you sure you want to delete your completed todos?",
"streakCoins": "Streak Bonus!", "streakCoins": "Streak Bonus!",
"pushTaskToTop": "Push task to top. Hold ctrl or cmd to push to bottom.", "pushTaskToTop": "Push task to top. Hold ctrl or cmd to push to bottom.",
"emptyTask": "Enter the task's title first.", "emptyTask": "Enter the task's title first.",

View File

@@ -74,7 +74,11 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
* Add the new task to the actions log * Add the new task to the actions log
*/ */
$scope.clearDoneTodos = function() { $scope.clearDoneTodos = function() {
if (!confirm(window.env.t('sureDeleteCompletedTodos'))) {
return;
}
Tasks.clearCompletedTodos(); Tasks.clearCompletedTodos();
User.user.todos = _.reject(User.user.todos, 'completed');
}; };
/** /**

View File

@@ -24,7 +24,7 @@ mixin taskColumnTabs(position)
div(ng-show='list.view == "complete"') div(ng-show='list.view == "complete"')
.alert .alert
=env.t('lotOfToDos') =env.t('lotOfToDos')
button.task-action-btn.tile.spacious.bright(ng-click='User.clearCompleted({})',popover=env.t('deleteToDosExplanation'),popover-trigger='mouseenter')=env.t('clearCompleted') button.task-action-btn.tile.spacious.bright(ng-click='clearDoneTodos()',popover=env.t('deleteToDosExplanation'),popover-trigger='mouseenter')=env.t('clearCompleted')
// remaining/completed tabs // remaining/completed tabs
ul.task-filter ul.task-filter
li(ng-class='{active: list.view == "remaining"}') li(ng-class='{active: list.view == "remaining"}')