Commit 4c3a5e272ef1b27284ca56e5bd28286a3234450d

Authored by Andrew Buss
1 parent dc71f53b15

cleanup; redirect away from login if already logged in

Showing 7 changed files with 227 additions and 228 deletions Side-by-side Diff

... ... @@ -13,131 +13,128 @@
13 13 'flashy.VerifyEmailController',
14 14 'flashy.CardListController',
15 15 'ngCookies']).
16   - config(['$stateProvider', '$urlRouterProvider', '$httpProvider',
17   - '$locationProvider',
18   - function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) {
19   - 'use strict';
20   - $httpProvider.defaults.withCredentials = true;
21   - $httpProvider.defaults.xsrfCookieName = 'csrftoken';
22   - $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
  16 + config(function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) {
  17 + 'use strict';
  18 + $httpProvider.defaults.withCredentials = true;
  19 + $httpProvider.defaults.xsrfCookieName = 'csrftoken';
  20 + $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
23 21  
24   - var arrayMethods = Object.getOwnPropertyNames(Array.prototype);
25   - arrayMethods.forEach(attachArrayMethodsToNodeList);
26   - function attachArrayMethodsToNodeList(methodName) {
27   - if (methodName !== 'length') {
28   - NodeList.prototype[methodName] = Array.prototype[methodName];
29   - }
30   - };
  22 + var arrayMethods = Object.getOwnPropertyNames(Array.prototype);
  23 + arrayMethods.forEach(attachArrayMethodsToNodeList);
  24 + function attachArrayMethodsToNodeList(methodName) {
  25 + if (methodName !== 'length') {
  26 + NodeList.prototype[methodName] = Array.prototype[methodName];
  27 + }
  28 + };
31 29  
32   - $httpProvider.interceptors.push(function($q) {
33   - return {
34   - 'responseError': function(rejection) {
35   - if (rejection.status >= 500) {
36   - console.log('got error');
37   - console.log(rejection);
38   - $('body').html('<div class="card">Sorry, the server is not serving requests properly. Try again later</div>');
39   - }
40   - return $q.reject(rejection);
  30 + $httpProvider.interceptors.push(function($q) {
  31 + return {
  32 + 'responseError': function(rejection) {
  33 + if (rejection.status >= 500) {
  34 + console.log('got error');
  35 + console.log(rejection);
  36 + $('body').html('<div class="card">Sorry, the server is not serving requests properly. Try again later</div>');
41 37 }
42   - };
43   - });
44   - $locationProvider.html5Mode(true);
45   - $urlRouterProvider.otherwise('/login');
46   - var auth_resolve = {
47   - authorize: ['$q', 'UserService',
48   - function($q, UserService) {
49   - console.log('resolving user before continuing');
50   - return UserService.getUserData();
51   - }
52   - ]
  38 + return $q.reject(rejection);
  39 + }
53 40 };
54   - $stateProvider.
55   - state('login', {
56   - url: '/login',
57   - templateUrl: 'templates/login.html',
58   - controller: 'LoginController'
59   - }).
60   - state('logout', {
61   - resolve: auth_resolve,
62   - url: '/logout',
63   - templateUrl: 'templates/logout.html',
64   - controller: 'LogoutController'
65   - }).
66   - state('root', {
67   - resolve: auth_resolve,
68   - url: '',
69   - templateUrl: 'templates/root.html',
70   - controller: 'RootController'
71   - }).
72   - state('feed', {
73   - resolve: auth_resolve,
74   - url: '/feed/{sectionId}',
75   - templateUrl: 'templates/feed.html',
76   - controller: 'FeedController'
77   - }).
78   - state('cardlist', {
79   - resolve: auth_resolve,
80   - url: '/cards/{sectionId}',
81   - templateUrl: 'templates/cardlist.html',
82   - controller: 'CardListController'
83   - }).
84   - state('addclass', {
85   - resolve: auth_resolve,
86   - url: '/addclass',
87   - templateUrl: 'templates/addclass.html',
88   - controller: 'ClassAddController'
89   - }).
90   - state('deck', {
91   - resolve: auth_resolve,
92   - url: '/deck/{sectionId}',
93   - templateUrl: 'templates/deck.html',
94   - controller: 'DeckController'
95   - }).
96   - state('study', {
97   - resolve: auth_resolve,
98   - url: '/study',
99   - templateUrl: 'templates/study.html',
100   - controller: 'StudyController'
101   - }).
102   - state('flashcard', {
103   - resolve: auth_resolve,
104   - url: '/flashcard',
105   - templateUrl: 'templates/flashcard.html',
106   - controller: 'FlashcardController'
107   - }).
108   - state('requestpasswordreset', {
109   - url: '/requestpasswordreset',
110   - templateUrl: 'templates/requestpasswordreset.html',
111   - controller: 'RequestResetController'
112   - }).
113   - state('resetpassword', {
114   - url: '/resetpassword/{uid}/{token}',
115   - templateUrl: 'templates/resetpassword.html',
116   - controller: 'ResetPasswordController'
117   - }).
118   - state('verifyemail', {
119   - resolve: auth_resolve,
120   - url: '/verifyemail/{key}',
121   - templateUrl: 'templates/verifyemail.html',
122   - controller: 'VerifyEmailController'
123   - });
124   - }
125   - ]).
126   - run(['$rootScope', '$state', '$stateParams', '$location', 'UserService',
127   - function($rootScope, $state, $stateParams, $location, UserService) {
128   - $rootScope.$on('$stateChangeStart', function(event, toState, toStateParams) {
129   - if (UserService.isLoggedIn()) return console.log('no login required; going straight to ' + toState.name);
130   - if (toState.name == 'login') return console.log('we are going to login anyway; just let it happen :)');
131   - if (!UserService.isUserResolved()) return console.log('user not yet resolved; hold off');
132   - $rootScope.returnToState = toState;
133   - $rootScope.returnToStateParams = toStateParams;
134   - console.log('going to ' + toState.name + ' after login');
135   - $state.go('login');
  41 + });
  42 + $locationProvider.html5Mode(true);
  43 + $urlRouterProvider.otherwise('/login');
  44 + var auth_resolve = {
  45 + authorize: function($q, UserService) {
  46 + console.log('resolving user before continuing');
  47 + return UserService.getUserData();
  48 + }
  49 + };
  50 + $stateProvider.
  51 + state('login', {
  52 + url: '/login',
  53 + templateUrl: 'templates/login.html',
  54 + controller: 'LoginController'
  55 + }).
  56 + state('logout', {
  57 + resolve: auth_resolve,
  58 + url: '/logout',
  59 + templateUrl: 'templates/logout.html',
  60 + controller: 'LogoutController'
  61 + }).
  62 + state('root', {
  63 + resolve: auth_resolve,
  64 + url: '',
  65 + templateUrl: 'templates/root.html',
  66 + controller: 'RootController'
  67 + }).
  68 + state('feed', {
  69 + resolve: auth_resolve,
  70 + url: '/feed/{sectionId}',
  71 + templateUrl: 'templates/feed.html',
  72 + controller: 'FeedController'
  73 + }).
  74 + state('cardlist', {
  75 + resolve: auth_resolve,
  76 + url: '/cards/{sectionId}',
  77 + templateUrl: 'templates/cardlist.html',
  78 + controller: 'CardListController'
  79 + }).
  80 + state('addclass', {
  81 + resolve: auth_resolve,
  82 + url: '/addclass',
  83 + templateUrl: 'templates/addclass.html',
  84 + controller: 'ClassAddController'
  85 + }).
  86 + state('deck', {
  87 + resolve: auth_resolve,
  88 + url: '/deck/{sectionId}',
  89 + templateUrl: 'templates/deck.html',
  90 + controller: 'DeckController'
  91 + }).
  92 + state('study', {
  93 + resolve: auth_resolve,
  94 + url: '/study',
  95 + templateUrl: 'templates/study.html',
  96 + controller: 'StudyController'
  97 + }).
  98 + state('flashcard', {
  99 + resolve: auth_resolve,
  100 + url: '/flashcard',
  101 + templateUrl: 'templates/flashcard.html',
  102 + controller: 'FlashcardController'
  103 + }).
  104 + state('requestpasswordreset', {
  105 + url: '/requestpasswordreset',
  106 + templateUrl: 'templates/requestpasswordreset.html',
  107 + controller: 'RequestResetController'
  108 + }).
  109 + state('resetpassword', {
  110 + url: '/resetpassword/{uid}/{token}',
  111 + templateUrl: 'templates/resetpassword.html',
  112 + controller: 'ResetPasswordController'
  113 + }).
  114 + state('verifyemail', {
  115 + resolve: auth_resolve,
  116 + url: '/verifyemail/{key}',
  117 + templateUrl: 'templates/verifyemail.html',
  118 + controller: 'VerifyEmailController'
136 119 });
137   - $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
138   - console.log('failed to change state: ' + error);
139   - $state.go('login');
140   - });
141   - }
142   - ]);
  120 + }).
  121 + run(function($rootScope, $state, $stateParams, $location, UserService) {
  122 + $rootScope.$on('$stateChangeStart', function(event, toState, toStateParams) {
  123 + if (toState.name == 'login') {
  124 + if (UserService.isLoggedIn()) return console.log('already logged in') + $state.go('addclass');
  125 + else return console.log('we are going to login anyway');
  126 + }
  127 + if (UserService.isLoggedIn()) return console.log('no login required; going straight to ' + toState.name);
  128 +
  129 + if (!UserService.isUserResolved()) return console.log('user not yet resolved; hold off');
  130 + $rootScope.returnToState = toState;
  131 + $rootScope.returnToStateParams = toStateParams;
  132 + console.log('going to ' + toState.name + ' after login');
  133 +
  134 + });
  135 + $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
  136 + console.log('failed to change state: ' + error);
  137 + $state.go('login');
  138 + });
  139 + });
... ... @@ -13,66 +13,69 @@
13 13 <title>Flashy</title>
14 14 </head>
15 15 <header>
  16 + <nav>
  17 + <div class="nav-wrapper">
  18 + <a href="#" data-activates="mobile-demo" class="left button-collapse"><i class="mdi-navigation-menu"></i></a>
  19 + <ul ng-show="currentSection.id && isLoggedIn" class="left hide-on-small-and-down">
  20 + <li ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})" class="tooltipped"
  21 + data-position="bottom"
  22 + data-delay="50" data-tooltip="Feed"><i
  23 + class="mdi-action-view-module"></i></a></li>
  24 + <li ui-sref-active="active"><a ui-sref="deck({sectionId:currentSection.id})" class="tooltipped"
  25 + data-position="bottom"
  26 + data-delay="50" data-tooltip="Deck"><i
  27 + class="mdi-action-view-carousel"></i></a></li>
  28 + <li ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})" class="tooltipped"
  29 + data-position="bottom"
  30 + data-delay="50" data-tooltip="Card List"><i
  31 + class="mdi-action-view-list"></i></a></li>
  32 + </ul>
  33 + <a href="#" class="brand-logo center">Flashy</a>
16 34  
  35 + <ul ng-show="isLoggedIn" id="nav-mobile" class="right hide-on-small-and-down">
  36 + <!-- User's classes dropdown -->
  37 + <ul id="dropdown1" class="dropdown-content">
  38 + <li ui-sref-active="active" ng-repeat="section in sections">
  39 + <a class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a>
  40 + </li>
  41 + <li class="divider"></li>
  42 + <li><a ui-sref="addclass">Add Class</a></li>
  43 + </ul>
  44 + <li><a class="dropdown-button ng-cloak" href="#!" data-activates="dropdown1">{{currentSection.id?currentSection.short_name:"Classes"}}<i
  45 + class="mdi-navigation-arrow-drop-down right"></i></a></li>
  46 + <li><a ui-sref="study">Study</a></li>
  47 + <li><a ui-sref="logout">Logout</a></li>
  48 + </ul>
  49 +
  50 + <!-- Slide-in side-nav for small screens -->
  51 + <ul class="side-nav" id="mobile-demo">
  52 + <!-- Collapsible menu for all the User's classes -->
  53 + <ul class="collapsible" data-collapsible="accordion">
  54 + <li class="bold">
  55 + <a class="collapsible-header black-text">
  56 + Classes<i class="mdi-navigation-arrow-drop-down right"></i>
  57 + </a>
  58 + </li>
  59 + <div class="collapsible-body" style="display: block">
  60 + <ul>
  61 + <li ng-repeat="section in sections">
  62 + <a ui-sref-active="active" class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a>
  63 + </li>
  64 + <hr>
  65 + <li><a ui-sref="addclass"><i class="tiny mdi-content-add"> Add Class</i></a></li>
  66 + </ul>
  67 + </div>
  68 + </ul>
  69 + <li><a ui-sref="study">Study</a></li>
  70 + <li><a ui-sref="logout">Logout</a></li>
  71 + </ul>
  72 + </div>
  73 + </nav>
  74 +
17 75 </header>
18 76 <body ng-controller="RootController">
19 77  
20 78 <!-- Menu Bar -->
21   -<nav>
22   - <div class="nav-wrapper">
23   - <a href="#" data-activates="mobile-demo" class="left button-collapse"><i class="mdi-navigation-menu"></i></a>
24   - <ul ng-show="currentSection.id && isLoggedIn" class="left hide-on-small-and-down">
25   - <li ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})" class="tooltipped" data-position="bottom"
26   - data-delay="50" data-tooltip="Feed"><i
27   - class="mdi-action-view-module"></i></a></li>
28   - <li ui-sref-active="active"><a ui-sref="deck({sectionId:currentSection.id})" class="tooltipped" data-position="bottom"
29   - data-delay="50" data-tooltip="Deck"><i
30   - class="mdi-action-view-carousel"></i></a></li>
31   - <li ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})" class="tooltipped" data-position="bottom"
32   - data-delay="50" data-tooltip="Card List"><i
33   - class="mdi-action-view-list"></i></a></li>
34   - </ul>
35   - <a href="#" class="brand-logo center">Flashy</a>
36   -
37   - <ul ng-show="isLoggedIn" id="nav-mobile" class="right hide-on-small-and-down">
38   - <!-- User's classes dropdown -->
39   - <ul id="dropdown1" class="dropdown-content">
40   - <li ui-sref-active="active" ng-repeat="section in sections">
41   - <a class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a>
42   - </li>
43   - <li class="divider"></li>
44   - <li><a ui-sref="addclass">Add Class</a></li>
45   - </ul>
46   - <li><a class="dropdown-button ng-cloak" href="#!" data-activates="dropdown1">{{currentSection.id?currentSection.short_name:"Classes"}}<i
47   - class="mdi-navigation-arrow-drop-down right"></i></a></li>
48   - <li><a ui-sref="study">Study</a></li>
49   - <li><a ui-sref="logout">Logout</a></li>
50   - </ul>
51   -
52   - <!-- Slide-in side-nav for small screens -->
53   - <ul class="side-nav" id="mobile-demo">
54   - <!-- Collapsible menu for all the User's classes -->
55   - <ul class="collapsible" data-collapsible="accordion">
56   - <li class="bold">
57   - <a class="collapsible-header black-text">
58   - Classes<i class="mdi-navigation-arrow-drop-down right"></i>
59   - </a>
60   - </li>
61   - <div class="collapsible-body" style="display: block">
62   - <ul>
63   - <li ng-repeat="section in sections">
64   - <a ui-sref-active="active" class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a>
65   - </li>
66   - <hr>
67   - <li><a ui-sref="addclass"><i class="tiny mdi-content-add"> Add Class</i></a></li>
68   - </ul>
69   - </div>
70   - </ul>
71   - <li><a ui-sref="study">Study</a></li>
72   - <li><a ui-sref="logout">Logout</a></li>
73   - </ul>
74   - </div>
75   -</nav>
76 79 <main ui-view></main>
77 80 <footer class="page-footer">
78 81 <div class="footer-copyright">
scripts/CardListController.js View file @ 4c3a5e2
1 1 angular.module('flashy.CardListController', ['ui.router']).
2   - controller('CardListController', function ($scope, $rootScope, $state, $http, $stateParams) {
  2 + controller('CardListController', function($scope, $rootScope, $state, $http, $stateParams) {
3 3 // cards array
4 4 sectionId = $stateParams.sectionId;
5 5 $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId});
6 6 $scope.cards = [];
7 7  
8 8 $http.get('/api/sections/' + sectionId + '/flashcards/').
9   - success(function (data) {
  9 + success(function(data) {
10 10 console.log(data);
11 11 $scope.cards = data;
12 12 }).
13   - error(function (err) {
  13 + error(function(err) {
14 14 console.log('pulling feed failed');
15 15 });
16 16  
17   - $scope.viewFeed = function () {
  17 + $scope.viewFeed = function() {
18 18 $state.go('feed', {sectionId: sectionId});
19 19 console.log('go to feed');
20 20 };
21 21  
22 22 // unhide card (dunno if it works yet)
23   - $scope.unhide = function (card) {
  23 + $scope.unhide = function(card) {
24 24 $http.post('/api/flashcards/' + card.id + '/unhide').
25   - success(function (data) {
26   - console.log(card.text + " unhidden");
  25 + success(function(data) {
  26 + console.log(card.text + ' unhidden');
27 27 }).
28   - error(function (err) {
  28 + error(function(err) {
29 29 console.log('no unhide for you');
30 30 });
31 31 };
32 32  
33 33 // toggle button text from show to hide
34   - $(function () {
35   - $("#showHidden").click(function () {
36   - $(this).text(function (i, text) {
37   - return text === "Show Hidden" ? "Hide Hidden" : "Show Hidden";
38   - })
  34 + $(function() {
  35 + $('#showHidden').click(function() {
  36 + $(this).text(function(i, text) {
  37 + return text === 'Show Hidden' ? 'Hide Hidden' : 'Show Hidden';
  38 + });
39 39 });
40 40 });
41   - $scope.$on('$destroy', function () {
  41 + $scope.$on('$destroy', function() {
42 42 $rootScope.currentSection = {};
43 43 $(document).off('keydown');
44 44 });
scripts/DeckController.js View file @ 4c3a5e2
1 1 angular.module('flashy.DeckController', ['ui.router']).
2 2  
3   - controller('DeckController', function ($scope, $rootScope, $state, $http, $stateParams) {
  3 + controller('DeckController', function($scope, $rootScope, $state, $http, $stateParams) {
4 4 // cards array
5 5 sectionId = $stateParams.sectionId;
6 6 $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId});
7 7  
8 8  
9 9  
10 10  
11 11  
12 12  
... ... @@ -9,31 +9,31 @@
9 9  
10 10 // Populate our page with cards.
11 11 $http.get('/api/sections/' + sectionId + '/deck/').
12   - success(function (data) {
  12 + success(function(data) {
13 13 console.log(data);
14 14 $scope.cards = data;
15 15 }).
16   - error(function (err) {
  16 + error(function(err) {
17 17 console.log('pulling feed failed');
18 18 });
19 19  
20 20 /* Lets page refresh the cards shown on the page. */
21   - $scope.refreshCards = function () {
  21 + $scope.refreshCards = function() {
22 22 var myDelay = 200; // ms
23 23  
24   - setTimeout(function () {
  24 + setTimeout(function() {
25 25 $http.get('/api/sections/' + sectionId + '/deck/').
26   - success(function (data) {
  26 + success(function(data) {
27 27 console.log(data);
28 28 $scope.cards = data;
29 29 console.log('success in refresh cards...');
30 30 }).
31   - error(function (err) {
  31 + error(function(err) {
32 32 console.log('refresh fail');
33 33 });
34 34 }, myDelay);
35 35 };
36   - $scope.$on('$destroy', function () {
  36 + $scope.$on('$destroy', function() {
37 37 $rootScope.currentSection = {};
38 38 });
39 39 }
scripts/FeedController.js View file @ 4c3a5e2
1 1 angular.module('flashy.FeedController', ['ui.router']).
2   - controller('FeedController', function ($scope, $rootScope, $stateParams, $state, $http) {
  2 + controller('FeedController', function($scope, $rootScope, $stateParams, $state, $http) {
3 3 console.log('Hello from feed');
4 4 sectionId = $stateParams.sectionId;
5 5 $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId});
6 6  
7 7  
8 8  
9 9  
10 10  
11 11  
12 12  
13 13  
... ... @@ -14,39 +14,39 @@
14 14 new_uri += '//' + loc.host;
15 15 var ws = new WebSocket(new_uri + '/ws/feed/' + sectionId + '?subscribe-broadcast');
16 16  
17   - ws.onopen = function () {
  17 + ws.onopen = function() {
18 18 console.log('websocket connected');
19 19 };
20   - ws.onmessage = function (e) {
  20 + ws.onmessage = function(e) {
21 21 console.log('got websocket message ' + e.data);
22 22 $scope.refreshCards();
23 23 };
24   - ws.onerror = function (e) {
  24 + ws.onerror = function(e) {
25 25 console.error(e);
26 26 };
27   - ws.onclose = function (e) {
  27 + ws.onclose = function(e) {
28 28 console.log('connection closed');
29 29 };
30 30  
31 31 $http.get('/api/sections/' + sectionId + '/feed/').
32   - success(function (data) {
  32 + success(function(data) {
33 33 console.log(data);
34 34 $scope.cards = data;
35 35 }).
36   - error(function (err) {
  36 + error(function(err) {
37 37 console.log('pulling feed failed');
38 38 });
39 39  
40   - $scope.viewDeck = function () {
  40 + $scope.viewDeck = function() {
41 41 $state.go('deck', {sectionId: sectionId});
42 42 console.log('go to deck');
43 43 };
44 44  
45   - $scope.pushCard = function () {
  45 + $scope.pushCard = function() {
46 46 var pushed = new Date(Date.now());
47 47 var i = 0;
48 48 var blanks = [];
49   - $('#new-card-input')[0].childNodes.forEach(function (node) {
  49 + $('#new-card-input')[0].childNodes.forEach(function(node) {
50 50 node = $(node)[0];
51 51 console.log(node);
52 52 if (node.tagName == 'B') {
53 53  
54 54  
55 55  
56 56  
... ... @@ -66,25 +66,25 @@
66 66 section: sectionId
67 67 };
68 68 $http.post('/api/flashcards/', myCard).
69   - success(function (data) {
  69 + success(function(data) {
70 70 console.log('pushed a card!');
71 71 listenForC = true;
72 72 }).
73   - error(function (error) {
  73 + error(function(error) {
74 74 console.log('something went wrong pushing a card!');
75 75 });
76 76  
77 77 $('#new-card-input').html('');
78 78 };
79 79  
80   - $scope.refreshCards = function () {
  80 + $scope.refreshCards = function() {
81 81 $http.get('/api/sections/' + sectionId + '/feed/').
82   - success(function (data) {
  82 + success(function(data) {
83 83 console.log(data);
84 84 $scope.cards = data;
85 85 console.log('success in refresh cards...');
86 86 }).
87   - error(function (err) {
  87 + error(function(err) {
88 88 console.log('refresh fail');
89 89 });
90 90 };
91 91  
92 92  
... ... @@ -100,19 +100,19 @@
100 100 opacity: 0, // Opacity of modal background
101 101 in_duration: 300, // Transition in duration
102 102 out_duration: 200, // Transition out duration
103   - ready: function () {
  103 + ready: function() {
104 104 listenForC = false;
105 105 console.log('modal OPENING');
106 106 $('#new-card-input').focus();
107 107 },
108   - complete: function () {
  108 + complete: function() {
109 109 listenForC = true;
110 110 console.log('modal done, closing');
111 111 $('#new-card-input').blur();
112 112 }
113 113 };
114 114  
115   - $(document).keydown(function (e) {
  115 + $(document).keydown(function(e) {
116 116 console.log(e.which);
117 117 var keyed = e.which;
118 118 if (keyed == 67 && listenForC) { // "c" or "C" for compose
119 119  
... ... @@ -129,10 +129,10 @@
129 129 $scope.text = '';
130 130 var selected_start = 0;
131 131 var selected_end = 0;
132   - $(document).ready(function () {
  132 + $(document).ready(function() {
133 133 // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
134 134 $('.modal-trigger').leanModal(modal_options);
135   - $('#new-card-input').on('keydown', function (e) {
  135 + $('#new-card-input').on('keydown', function(e) {
136 136 if (e.which == 13) {
137 137 e.preventDefault();
138 138 $scope.pushCard();
139 139  
140 140  
... ... @@ -140,16 +140,16 @@
140 140 return false;
141 141 }
142 142 });
143   - $('#new-card-input').on('mouseup', function () {
  143 + $('#new-card-input').on('mouseup', function() {
144 144 console.log('got selection: ' + selected_start);
145 145 });
146   - $('button#blank-selected').click(function () {
  146 + $('button#blank-selected').click(function() {
147 147 console.log(window.getSelection());
148 148 document.execCommand('bold');
149 149 });
150 150 });
151 151  
152   - $scope.$on('$destroy', function () {
  152 + $scope.$on('$destroy', function() {
153 153 ws.close();
154 154 $rootScope.currentSection = {};
155 155 $(document).off('keydown');
scripts/RootController.js View file @ 4c3a5e2
1 1 angular.module('flashy.RootController', ['ui.router', 'ngResource']).
2 2  
3   - controller('RootController', function ($rootScope, $resource, $scope, $state, UserService) {
  3 + controller('RootController', function($rootScope, $resource, $scope, $state, UserService) {
4 4 $rootScope.SectionResource = $resource('/api/sections/:sectionId/');
5 5 window.rootscope = $rootScope;
6 6 $rootScope.isLoggedIn = false;
7 7 $rootScope.currentSection = {};
8   - UserService.getUserData().then(function (data) {
  8 + UserService.getUserData().then(function(data) {
9 9 console.log(data);
10 10 $rootScope.user = data;
11 11 });
styles/flashy.css View file @ 4c3a5e2
... ... @@ -266,14 +266,13 @@
266 266 }
267 267  
268 268 h2 {
269   - text-align: center;
  269 + text-align: center;
270 270 }
271 271  
272 272 md-content.md-default-theme {
273   - background-color: rgba(255,255,255,0);
274   - border: 1px solid #fff;
  273 + background-color: rgba(255, 255, 255, 0);
  274 + border: 1px solid #fff;
275 275 }
276   -
277 276  
278 277 /*#sidenav-overlay {
279 278 background-color: rgba(0, 0, 0, 0) !important;