challenges: switch from ngRoute to ui-router

This commit is contained in:
Tyler Renelle
2013-10-27 22:27:07 -07:00
parent f178eb2322
commit 35c4a62de0
23 changed files with 614 additions and 708 deletions

View File

@@ -1,7 +1,7 @@
"use strict";
habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'API_URL', '$q', 'User', 'Members', '$location',
function($scope, $rootScope, Groups, $http, API_URL, $q, User, Members, $location) {
habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'API_URL', '$q', 'User', 'Members', '$location', '$state',
function($scope, $rootScope, Groups, $http, API_URL, $q, User, Members, $location, $state) {
$scope.isMember = function(user, group){
return ~(group.members.indexOf(user._id));
@@ -25,10 +25,10 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
$scope.clickMember = function(uid, forceShow) {
if (User.user._id == uid && !forceShow) {
if ($location.path() == '/tasks') {
$location.path('/options');
if ($state.is('tasks')) {
$state.go('options');
} else {
$location.path('/tasks');
$state.go('tasks');
}
} else {
// We need the member information up top here, but then we pass it down to the modal controller
@@ -117,6 +117,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
.controller("GuildsCtrl", ['$scope', 'Groups', 'User', '$rootScope',
function($scope, Groups, User, $rootScope) {
Groups.fetchGuilds();
$scope.type = 'guild';
$scope.text = 'Guild';
$scope.newGroup = new Groups.Group({type:'guild', privacy:'private', leader: User.user._id, members: [User.user._id]});
@@ -202,6 +203,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
.controller("TavernCtrl", ['$scope', 'Groups', 'User',
function($scope, Groups, User) {
Groups.fetchTavern();
$scope.group = Groups.groups.tavern;
$scope.rest = function(){