mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-21 21:34:15 +00:00
[#1977] move sleep & clear-completed to user.ops
This commit is contained in:
parent
d4e0ae85a0
commit
dc63eff41d
5 changed files with 2 additions and 20 deletions
|
|
@ -306,10 +306,6 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
|||
.controller("TavernCtrl", ['$scope', 'Groups', 'User',
|
||||
function($scope, Groups, User) {
|
||||
$scope.group = Groups.tavern();
|
||||
$scope.rest = function(){
|
||||
User.user.flags.rest = !User.user.flags.rest;
|
||||
User.log({op:'set',data:{'flags.rest':User.user.flags.rest}});
|
||||
}
|
||||
$scope.toggleUserTier = function($event) {
|
||||
$($event.target).next().toggle();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,11 +91,6 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||
}
|
||||
};
|
||||
|
||||
$scope.clearCompleted = function() {
|
||||
User.user.todos = _.reject(User.user.todos, {completed:true});
|
||||
User.log({op: 'clear-completed'});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
------------------------
|
||||
|
|
|
|||
|
|
@ -169,15 +169,6 @@ api.sortTask = function(req, res, next) {
|
|||
})
|
||||
};
|
||||
|
||||
api.clearCompleted = function(req, res, next) {
|
||||
var user = res.locals.user;
|
||||
user.todos = _.where(user.todos, {completed: false});
|
||||
return user.save(function(err, saved) {
|
||||
if (err) return res.json(500, {err: err});
|
||||
return res.json(saved);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------
|
||||
Items
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
.popover-content
|
||||
| Welcome to the Tavern! Stay a while and meet the locals. If you need to rest (going on vacation? sudden illness?), I'll set you up at the inn - Dailies won't hurt you while you're resting.
|
||||
div
|
||||
button.btn.btn-large.btn-success(ng-class='{active: user.flags.rest}', ng-click='rest()')
|
||||
button.btn.btn-large.btn-success(ng-class='{active: user.flags.rest}', ng-click='User.user.ops.sleep({})')
|
||||
span(ng-show='user.flags.rest') Check Out of Inn
|
||||
span(ng-hide='user.flags.rest') Rest in the Inn
|
||||
.alert.alert-info(ng-show='user.flags.rest')
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
|
||||
// Todo Tabs
|
||||
div(bo-if='main && list.type=="todo"', bo-class='{"tabbable tabs-below": list.type=="todo"}')
|
||||
button.task-action-btn.tile.spacious.bright(ng-show='list.showCompleted', ng-click='clearCompleted()') Clear Completed
|
||||
button.task-action-btn.tile.spacious.bright(ng-show='list.showCompleted', ng-click='user.ops.clearCompleted({})') Clear Completed
|
||||
// remaining/completed tabs
|
||||
ul.nav.nav-tabs
|
||||
li(ng-class='{active: !list.showCompleted}')
|
||||
|
|
|
|||
Loading…
Reference in a new issue