[#1977] move sleep & clear-completed to user.ops

This commit is contained in:
Tyler Renelle 2013-12-12 16:59:22 -07:00
parent d4e0ae85a0
commit dc63eff41d
5 changed files with 2 additions and 20 deletions

View file

@ -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();
}

View file

@ -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'});
}
/*
------------------------

View file

@ -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

View file

@ -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')

View file

@ -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}')