From 8fa323ef66e4a4bec2d39cf2848b15548eaf598c Mon Sep 17 00:00:00 2001 From: Andrew Buss Date: Mon, 18 May 2015 18:11:35 -0700 Subject: [PATCH] more on userservice. conditionally display sidebar --- config.js | 13 ++++---- flashy.css | 4 --- home.html | 8 ++--- scripts/FeedController.js | 64 +++++++++++++++++++------------------- scripts/RequestResetController.js | 2 +- scripts/ResetPasswordController.js | 2 +- scripts/RootController.js | 1 + scripts/UserService.js | 13 ++++++-- scripts/VerifyEmailController.js | 36 ++++++++++----------- 9 files changed, 73 insertions(+), 70 deletions(-) diff --git a/config.js b/config.js index 6dde881..72a3c52 100644 --- a/config.js +++ b/config.js @@ -49,7 +49,7 @@ angular.module('flashy', [ }). state('feed', { resolve: auth_resolve, - url: '/feed', + url: '/feed/{sectionId}', templateUrl: 'templates/feed.html', controller: 'FeedController' }). @@ -78,13 +78,11 @@ angular.module('flashy', [ controller: 'FlashcardController' }). state('requestpasswordreset', { - resolve: auth_resolve, url: '/requestpasswordreset', templateUrl: 'templates/requestpasswordreset.html', controller: 'RequestResetController' }). state('resetpassword', { - resolve: auth_resolve, url: '/resetpassword/{uid}/{token}', templateUrl: 'templates/resetpassword.html', controller: 'ResetPasswordController' @@ -99,15 +97,16 @@ angular.module('flashy', [ function($rootScope, $state, $stateParams, $location, UserService) { $rootScope.$on('$stateChangeStart', function(event, toState, toStateParams) { if (UserService.isLoggedIn()) return console.log('no login required; going straight to ' + toState.name); - if (toState.name == 'login') return; - if (!UserService.isUserResolved()) return; + if (toState.name == 'login') return console.log('we are going to login anyway; just let it happen :)'); + if (!UserService.isUserResolved()) return console.log('user not yet resolved; hold off'); $rootScope.returnToState = toState; $rootScope.returnToStateParams = toStateParams; console.log('going to ' + toState.name + ' after login'); $state.go('login'); }); - $rootScope.$on('$routeChangeError', function() { - console.log('failed to change routes'); + $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) { + console.log('failed to change state: ' + error); + $state.go('login'); }); } ]); diff --git a/flashy.css b/flashy.css index 00e5f26..88066bb 100644 --- a/flashy.css +++ b/flashy.css @@ -60,10 +60,6 @@ ul.side-nav.fixed li a { font-size:24px; } - -#logo-container{ - height:110px; -} /* Flashcard directive css */ .card.fixed-size { height: calc(3 * 5vw); diff --git a/home.html b/home.html index c18d2e9..5c35abf 100644 --- a/home.html +++ b/home.html @@ -13,7 +13,7 @@ -