mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Loaded completed todos when done is clicked
This commit is contained in:
@@ -140,6 +140,13 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||||||
*/
|
*/
|
||||||
$scope._today = moment().add({days: 1});
|
$scope._today = moment().add({days: 1});
|
||||||
|
|
||||||
|
$scope.loadedCompletedTodos = function () {
|
||||||
|
Tasks.getUserTasks(true)
|
||||||
|
.then(function (response) {
|
||||||
|
User.user.todos.concat(response.data.data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
------------------------
|
------------------------
|
||||||
Dailies
|
Dailies
|
||||||
|
|||||||
@@ -6,10 +6,14 @@ angular.module('habitrpg')
|
|||||||
.factory('Tasks', ['$rootScope', 'Shared', '$http',
|
.factory('Tasks', ['$rootScope', 'Shared', '$http',
|
||||||
function tasksFactory($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({
|
return $http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/api/v3/tasks/user',
|
url: url,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ mixin taskColumnTabs(position)
|
|||||||
li(ng-class='{active: list.view == "dated"}')
|
li(ng-class='{active: list.view == "dated"}')
|
||||||
a(ng-click='list.view = "dated"')=env.t('dated')
|
a(ng-click='list.view = "dated"')=env.t('dated')
|
||||||
li(ng-class='{active: list.view == "complete"}')
|
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
|
// Rewards Tabs
|
||||||
div(ng-if='::main && list.type=="reward"', class='tabbable tabs-below')
|
div(ng-if='::main && list.type=="reward"', class='tabbable tabs-below')
|
||||||
ul.task-filter
|
ul.task-filter
|
||||||
|
|||||||
Reference in New Issue
Block a user