Loaded completed todos when done is clicked

This commit is contained in:
Keith Holliday
2016-05-14 10:43:50 -05:00
parent 0537ff3552
commit 72c1729d54
3 changed files with 14 additions and 3 deletions

View File

@@ -140,6 +140,13 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
*/
$scope._today = moment().add({days: 1});
$scope.loadedCompletedTodos = function () {
Tasks.getUserTasks(true)
.then(function (response) {
User.user.todos.concat(response.data.data);
});
}
/*
------------------------
Dailies

View File

@@ -6,10 +6,14 @@ angular.module('habitrpg')
.factory('Tasks', ['$rootScope', 'Shared', '$http',
function tasksFactory($rootScope, Shared, $http) {
function getUserTasks () {
function getUserTasks (getCompletedTodos) {
var url = '/api/v3/tasks/user';
if (getCompletedTodos) url += '?type=completedTodos';
return $http({
method: 'GET',
url: '/api/v3/tasks/user',
url: url,
});
};

View File

@@ -32,7 +32,7 @@ mixin taskColumnTabs(position)
li(ng-class='{active: list.view == "dated"}')
a(ng-click='list.view = "dated"')=env.t('dated')
li(ng-class='{active: list.view == "complete"}')
a(ng-click='list.view = "complete"')=env.t('complete')
a(ng-click='list.view = "complete";loadedCompletedTodos()')=env.t('complete')
// Rewards Tabs
div(ng-if='::main && list.type=="reward"', class='tabbable tabs-below')
ul.task-filter