diff --git a/Gruntfile.js b/Gruntfile.js index 5667a60ad1..cec3fe5539 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,7 +25,7 @@ module.exports = function(grunt) { 'public/bower_components/angular/angular.min.js', 'public/bower_components/angular-sanitize/angular-sanitize.min.js', 'public/bower_components/marked/lib/marked.js', - 'public/bower_components/angular-ui-router/angular-ui-router.min.js', + 'public/bower_components/angular-ui-router/release/angular-ui-router.js', 'public/bower_components/angular-resource/angular-resource.min.js', 'public/bower_components/angular-ui/build/angular-ui.min.js', 'public/bower_components/angular-ui-utils/modules/keypress/keypress.js', diff --git a/public/js/app.js b/public/js/app.js index ae9b2b0bdd..77d3cd0260 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,7 +1,7 @@ "use strict"; window.habitrpg = angular.module('habitrpg', - ['ngRoute', 'ngResource', 'ngSanitize', 'userServices', 'groupServices', 'memberServices', 'challengeServices', 'sharedServices', 'authServices', 'notificationServices', 'guideServices', 'ui.bootstrap', 'ui.keypress', 'ui.router']) + ['ngResource', 'ngSanitize', 'userServices', 'groupServices', 'memberServices', 'challengeServices', 'sharedServices', 'authServices', 'notificationServices', 'guideServices', 'ui.bootstrap', 'ui.keypress', 'ui.router']) .constant("API_URL", "") .constant("STORAGE_USER_ID", 'habitrpg-user') diff --git a/public/js/controllers/challengesCtrl.js b/public/js/controllers/challengesCtrl.js index b47e70afdf..6ecce55fad 100644 --- a/public/js/controllers/challengesCtrl.js +++ b/public/js/controllers/challengesCtrl.js @@ -1,7 +1,7 @@ "use strict"; -habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notification', '$compile', 'Groups', '$state', '$filter', - function($scope, User, Challenges, Notification, $compile, Groups, $state, $filter) { +habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notification', '$compile', 'Groups', '$state', + function($scope, User, Challenges, Notification, $compile, Groups, $state) { // FIXME get this from cache Groups.Group.query(function(groups){ diff --git a/public/js/controllers/menuCtrl.js b/public/js/controllers/menuCtrl.js index d8ddd61397..1837b4bd0f 100644 --- a/public/js/controllers/menuCtrl.js +++ b/public/js/controllers/menuCtrl.js @@ -7,33 +7,10 @@ */ habitrpg.controller('MenuCtrl', - ['$scope', '$rootScope', '$location', 'User', - function($scope, $rootScope, $location, User) { + ['$scope', '$rootScope', 'User', + function($scope, $rootScope, User) { - $scope.sync = function(){ - User.user._v--; - User.log({}) - } - - $scope.gotoOptions = function(){ - $location.path('/options'); - } - - $scope.gotoTasks = function(){ - $location.path('/tasks') - } - - $scope.$on('$routeChangeSuccess', function(ev, current) { - if(!current.$$route) return; - if(current.$$route.originalPath === "/tasks"){ - $scope.viewingOptions = false; - }else if(current.$$route.originalPath === "/options"){ - $scope.viewingOptions = true; - } - }); - - - //FIXME where to implement this in rewrite? + //FIXME are these used anywhere? can we get rid of this file? $scope.refreshing = function () { User.settings.fetching ? "spin" : "" diff --git a/public/js/directives/directives.js b/public/js/directives/directives.js index 548ad9a213..b7cf52766c 100644 --- a/public/js/directives/directives.js +++ b/public/js/directives/directives.js @@ -120,12 +120,12 @@ habitrpg // main: '@', // true if it's the user's main list // obj: '=' //}, - controller: function($scope, $rootScope){ + controller: ['$scope', '$rootScope', function($scope, $rootScope){ $scope.editTask = function(task){ task._editing = !task._editing; if($rootScope.charts[task.id]) $rootScope.charts[task.id] = false; }; - }, + }], link: function(scope, element, attrs) { // $scope.obj needs to come from controllers, so we can pass by ref scope.main = attrs.main; diff --git a/public/js/services/userServices.js b/public/js/services/userServices.js index 11131a4bed..78cb54fb08 100644 --- a/public/js/services/userServices.js +++ b/public/js/services/userServices.js @@ -144,6 +144,11 @@ angular.module('userServices', []). syncQueue(cb); }, + sync: function(){ + user._v--; + userServices.log({}); + }, + /* Very simple path-set. `set('preferences.gender','m')` for example. We'll deprecate this once we have a complete API */ diff --git a/views/index.jade b/views/index.jade index fbbce9ebae..d20a29e9be 100644 --- a/views/index.jade +++ b/views/index.jade @@ -36,7 +36,6 @@ html script(type='text/javascript', src='/bower_components/angular-sanitize/angular-sanitize.min.js') script(type='text/javascript', src='/bower_components/marked/lib/marked.js') - script(type='text/javascript', src='/bower_components/angular-route/angular-route.js') script(type='text/javascript', src='/bower_components/angular-resource/angular-resource.js') script(type='text/javascript', src='/bower_components/angular-ui/build/angular-ui.js') script(type='text/javascript', src='/bower_components/angular-ui-utils/modules/keypress/keypress.js') diff --git a/views/shared/header/menu.jade b/views/shared/header/menu.jade index 1baf555a64..cfef422cc1 100644 --- a/views/shared/header/menu.jade +++ b/views/shared/header/menu.jade @@ -6,14 +6,14 @@ ul.flyout-content.nav.stacked li a.task-action-btn.tile.solid - span(ng-show='viewingOptions', ng-click='gotoTasks()') + span(ng-show='$state.includes("options")', ui-sref='tasks') i.icon-ok | Tasks - span(ng-hide='viewingOptions', ng-click='gotoOptions()') + span(ng-show='$state.includes("tasks")', ui-sref='options') i.icon.icon-wrench | Options li - a.task-action-btn.tile.solid(ng-click='sync()') + a.task-action-btn.tile.solid(ng-click='User.sync()') i.icon.icon-refresh | Sync li