mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
get rid of ngRoute completely, depend on ui-router instead
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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" : ""
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user