2013-08-25 01:06:37 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The menu controller:
|
|
|
|
|
* - sets the menu options, should we do it dynamic so it generates the menu like: width = 1/elements * 100 ?
|
|
|
|
|
* - exposes the model to the template and provides event handlers
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
habitrpg.controller('MenuCtrl',
|
|
|
|
|
['$scope', '$rootScope', '$location', 'User',
|
|
|
|
|
function($scope, $rootScope, $location, User) {
|
|
|
|
|
|
2013-09-01 23:41:17 +00:00
|
|
|
$scope.sync = function(){
|
|
|
|
|
User.user._v--;
|
|
|
|
|
User.log({})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.gotoOptions = function(){
|
|
|
|
|
$location.path('/options');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.gotoTasks = function(){
|
|
|
|
|
$location.path('/tasks')
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 14:38:05 +00:00
|
|
|
$scope.$on('$routeChangeSuccess', function(ev, current) {
|
|
|
|
|
if(current.$$route.originalPath === "/tasks"){
|
|
|
|
|
$scope.viewingOptions = false;
|
|
|
|
|
}else if(current.$$route.originalPath === "/options"){
|
|
|
|
|
$scope.viewingOptions = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2013-09-01 23:41:17 +00:00
|
|
|
|
2013-08-28 00:11:15 +00:00
|
|
|
//FIXME where to implement this in rewrite?
|
2013-08-28 01:13:05 +00:00
|
|
|
|
2013-08-28 00:11:15 +00:00
|
|
|
$scope.refreshing = function () {
|
2013-08-28 01:13:05 +00:00
|
|
|
User.settings.fetching ? "spin" : ""
|
2013-08-28 00:11:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.queueLength = function () {
|
2013-08-28 01:13:05 +00:00
|
|
|
User.settings.sync.queue.length || User.settings.sync.sent.length
|
2013-08-28 00:11:15 +00:00
|
|
|
};
|
2013-08-25 01:06:37 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
]);
|