get rid of ngRoute completely, depend on ui-router instead

This commit is contained in:
Tyler Renelle
2013-10-30 10:31:36 -07:00
parent 8b76b74d78
commit ff3266bac8
8 changed files with 17 additions and 36 deletions

View File

@@ -25,7 +25,7 @@ module.exports = function(grunt) {
'public/bower_components/angular/angular.min.js', 'public/bower_components/angular/angular.min.js',
'public/bower_components/angular-sanitize/angular-sanitize.min.js', 'public/bower_components/angular-sanitize/angular-sanitize.min.js',
'public/bower_components/marked/lib/marked.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-resource/angular-resource.min.js',
'public/bower_components/angular-ui/build/angular-ui.min.js', 'public/bower_components/angular-ui/build/angular-ui.min.js',
'public/bower_components/angular-ui-utils/modules/keypress/keypress.js', 'public/bower_components/angular-ui-utils/modules/keypress/keypress.js',

View File

@@ -1,7 +1,7 @@
"use strict"; "use strict";
window.habitrpg = angular.module('habitrpg', 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("API_URL", "")
.constant("STORAGE_USER_ID", 'habitrpg-user') .constant("STORAGE_USER_ID", 'habitrpg-user')

View File

@@ -1,7 +1,7 @@
"use strict"; "use strict";
habitrpg.controller("ChallengesCtrl", ['$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, $filter) { function($scope, User, Challenges, Notification, $compile, Groups, $state) {
// FIXME get this from cache // FIXME get this from cache
Groups.Group.query(function(groups){ Groups.Group.query(function(groups){

View File

@@ -7,33 +7,10 @@
*/ */
habitrpg.controller('MenuCtrl', habitrpg.controller('MenuCtrl',
['$scope', '$rootScope', '$location', 'User', ['$scope', '$rootScope', 'User',
function($scope, $rootScope, $location, User) { function($scope, $rootScope, User) {
$scope.sync = function(){ //FIXME are these used anywhere? can we get rid of this file?
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?
$scope.refreshing = function () { $scope.refreshing = function () {
User.settings.fetching ? "spin" : "" User.settings.fetching ? "spin" : ""

View File

@@ -120,12 +120,12 @@ habitrpg
// main: '@', // true if it's the user's main list // main: '@', // true if it's the user's main list
// obj: '=' // obj: '='
//}, //},
controller: function($scope, $rootScope){ controller: ['$scope', '$rootScope', function($scope, $rootScope){
$scope.editTask = function(task){ $scope.editTask = function(task){
task._editing = !task._editing; task._editing = !task._editing;
if($rootScope.charts[task.id]) $rootScope.charts[task.id] = false; if($rootScope.charts[task.id]) $rootScope.charts[task.id] = false;
}; };
}, }],
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
// $scope.obj needs to come from controllers, so we can pass by ref // $scope.obj needs to come from controllers, so we can pass by ref
scope.main = attrs.main; scope.main = attrs.main;

View File

@@ -144,6 +144,11 @@ angular.module('userServices', []).
syncQueue(cb); 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 Very simple path-set. `set('preferences.gender','m')` for example. We'll deprecate this once we have a complete API
*/ */

View File

@@ -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/angular-sanitize/angular-sanitize.min.js')
script(type='text/javascript', src='/bower_components/marked/lib/marked.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-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/build/angular-ui.js')
script(type='text/javascript', src='/bower_components/angular-ui-utils/modules/keypress/keypress.js') script(type='text/javascript', src='/bower_components/angular-ui-utils/modules/keypress/keypress.js')

View File

@@ -6,14 +6,14 @@
ul.flyout-content.nav.stacked ul.flyout-content.nav.stacked
li li
a.task-action-btn.tile.solid 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 i.icon-ok
| Tasks | Tasks
span(ng-hide='viewingOptions', ng-click='gotoOptions()') span(ng-show='$state.includes("tasks")', ui-sref='options')
i.icon.icon-wrench i.icon.icon-wrench
| Options | Options
li li
a.task-action-btn.tile.solid(ng-click='sync()') a.task-action-btn.tile.solid(ng-click='User.sync()')
i.icon.icon-refresh i.icon.icon-refresh
| Sync | Sync
li li