diff --git a/Makefile b/Makefile index 33dbd66..a4ccf7c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ styles/materialize.css: .PHONY sassc materialize/sass/materialize.scss > styles/materialize.css +fixjsstyle: + fixjsstyle --flagfile gjslint.conf config.js scripts/*{Controller,Directive,Service}.js + .PHONY: diff --git a/config.js b/config.js index 4c166d0..6dde881 100644 --- a/config.js +++ b/config.js @@ -14,13 +14,21 @@ angular.module('flashy', [ 'ngCookies']). config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider', - function ($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) { + function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) { 'use strict'; $httpProvider.defaults.withCredentials = true; $httpProvider.defaults.xsrfCookieName = 'csrftoken'; $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; $locationProvider.html5Mode(true); $urlRouterProvider.otherwise('/home'); + var auth_resolve = { + authorize: ['$q', 'UserService', + function($q, UserService) { + console.log('resolving user before continuing'); + return UserService.getUserData(); + } + ] + }; $stateProvider. state('login', { url: '/login', @@ -28,78 +36,78 @@ angular.module('flashy', [ controller: 'LoginController' }). state('logout', { + resolve: auth_resolve, url: '/logout', templateUrl: 'templates/logout.html', controller: 'LogoutController' }). state('root', { + resolve: auth_resolve, url: '/', templateUrl: 'templates/root.html', - controller: 'RootController', - resolve: { - authorize: ['UserService', - function (UserService) { - return UserService.getUserData(); - } - ] - } - + controller: 'RootController' }). state('feed', { + resolve: auth_resolve, url: '/feed', templateUrl: 'templates/feed.html', - controller: 'FeedController', - resolve: { - authorize: ['UserService', - function (UserService) { - return UserService.getUserData(); - } - ] - } + controller: 'FeedController' }). state('addclass', { + resolve: auth_resolve, url: '/addclass', templateUrl: 'templates/addclass.html', controller: 'ClassAddController' }). state('deck', { + resolve: auth_resolve, url: '/deck', templateUrl: 'templates/deck.html', controller: 'DeckController' }). state('study', { + resolve: auth_resolve, url: '/study', templateUrl: 'templates/study.html', controller: 'StudyController' }). state('flashcard', { + resolve: auth_resolve, url: '/flashcard', templateUrl: 'templates/flashcard.html', 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' }). state('verifyemail', { + resolve: auth_resolve, url: '/verifyemail/{key}', templateUrl: 'templates/verifyemail.html', controller: 'VerifyEmailController' }); }]).run(['$rootScope', '$state', '$stateParams', '$location', 'UserService', - function ($rootScope, $state, $stateParams, $location, UserService) { - $rootScope.$on('$stateChangeStart', function (event, toState, toStateParams) { + 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; $rootScope.returnToState = toState; $rootScope.returnToStateParams = toStateParams; - console.log('going to' + toState.name); - console.log(UserService.isLoggedIn()); - if (!UserService.isLoggedIn() && toState.name != 'login') $location.path('login'); + console.log('going to ' + toState.name + ' after login'); + $state.go('login'); + }); + $rootScope.$on('$routeChangeError', function() { + console.log('failed to change routes'); }); } ]); diff --git a/flashy.css b/flashy.css index 6931474..00e5f26 100644 --- a/flashy.css +++ b/flashy.css @@ -27,70 +27,98 @@ } .angucomplete-selected-row { - background-color:#aaaaff; + background-color: #aaaaff; } - .container .row { - margin-left: 0; - margin-right: 0; + margin-left: 0; + margin-right: 0; +} + +ul.side-nav.fixed li { + /*line-height: 30px;*/ + /*font-weight:700;*/ + font-size:24px; } +ul.side-nav.fixed li a { + /*line-height: 30px;*/ + /*font-weight:700;*/ + font-size:24px; +} + + +ul.side-nav.fixed li ul li { + /*line-height: 30px;*/ + /*font-weight:700;*/ + margin-left:20px; +} + +ul.side-nav.fixed li a { + /*line-height: 30px;*/ + /*font-weight:700;*/ + font-size:24px; +} + + +#logo-container{ + height:110px; +} /* Flashcard directive css */ .card.fixed-size { - height: calc(3*5vw); - min-height: calc(3*50px); - min-width: calc(5*50px); - width: calc(5*5vw); + height: calc(3 * 5vw); + min-height: calc(3 * 50px); + min-width: calc(5 * 50px); + width: calc(5 * 5vw); } .card-overlay { -/* display: none; */ - height: calc(3*5vw); - left: 0; - min-height: calc(3*50px); - min-width: calc(5*50px); - position: absolute; - top: 0; - width: calc(5*5vw); + /* display: none; */ + height: calc(3 * 5vw); + left: 0; + min-height: calc(3 * 50px); + min-width: calc(5 * 50px); + position: absolute; + top: 0; + width: calc(5 * 5vw); } .card-overlay i { - color: #FFF; + color: #FFF; } .card:hover .card-overlay { - display: block; + display: block; } .top-box { - background-color: rgba(50,50,90,0.5); - height: 50%; - position: relative; - width: 100%; + background-color: rgba(50, 50, 90, 0.5); + height: 50%; + position: relative; + width: 100%; } .bottom-box { - height: 50%; - position: relative; - width: 100%; + height: 50%; + position: relative; + width: 100%; } .left-box { - background-color: rgba(90,50,190,0.5); - float: left; - position: relative; - width: 50%; + background-color: rgba(90, 50, 190, 0.5); + float: left; + position: relative; + width: 50%; } .right-box { - background-color: rgba(190,50,90,0.5); - float: right; - width: 50%; + background-color: rgba(190, 50, 90, 0.5); + float: right; + width: 50%; } .center-me { - margin: 0 auto; + margin: 0 auto; } .container { @@ -108,64 +136,64 @@ /* label color */ .input-field label { - color: #673ab7; + color: #673ab7; } /* label focus color */ .input-field input[type]:focus + label { - color: #b388ff; + color: #b388ff; } /* label underline focus color */ .input-field input[type]:focus { - border-bottom: 1px solid #b388ff; - box-shadow: 0 1px 0 0 #b388ff; + border-bottom: 1px solid #b388ff; + box-shadow: 0 1px 0 0 #b388ff; } /* valid color */ .input-field input[type].valid { - border-bottom: 1px solid #673ab7; - box-shadow: 0 1px 0 0 #673ab7; + border-bottom: 1px solid #673ab7; + box-shadow: 0 1px 0 0 #673ab7; } /* invalid color */ .input-field input[type].invalid { - border-bottom: 1px solid #673ab7; - box-shadow: 0 1px 0 0 #673ab7; + border-bottom: 1px solid #673ab7; + box-shadow: 0 1px 0 0 #673ab7; } /* icon prefix focus color */ .input-field .prefix.active { - color: #b388ff; + color: #b388ff; } /* label focus color */ .input-field textarea[type]:focus + label { - color: #b388ff; + color: #b388ff; } /* label underline focus color */ .input-field textarea[type]:focus { - border-bottom: 1px solid #b388ff; - box-shadow: 0 1px 0 0 #b388ff; + border-bottom: 1px solid #b388ff; + box-shadow: 0 1px 0 0 #b388ff; } body { - background-color: #3e1944; + background-color: #3e1944; } .btn { - background-color: #673ab7; + background-color: #673ab7; } .btn:hover { - background-color: #7c4dff; + background-color: #7c4dff; } .btn-floating { - background-color: #673ab7; + background-color: #673ab7; } .btn-floating:hover { - background-color: #7c4dff; + background-color: #7c4dff; } diff --git a/gjslint.conf b/gjslint.conf index b106210..b1a8d11 100644 --- a/gjslint.conf +++ b/gjslint.conf @@ -1 +1 @@ ---summary \ No newline at end of file +--max_line_length=140 diff --git a/home.html b/home.html index 16249d7..c18d2e9 100644 --- a/home.html +++ b/home.html @@ -2,39 +2,40 @@ - + - + -