Commit dc71f53b151e92e99435eee5df5a669ecc16f15a

Authored by Andrew Buss
1 parent 20f4dcac7c

dropdown for class name

Showing 5 changed files with 65 additions and 49 deletions Side-by-side Diff

... ... @@ -21,14 +21,14 @@
21 21 <nav>
22 22 <div class="nav-wrapper">
23 23 <a href="#" data-activates="mobile-demo" class="left button-collapse"><i class="mdi-navigation-menu"></i></a>
24   - <ul ng-show="sectionId && isLoggedIn" class="left hide-on-small-and-down">
25   - <li ui-sref-active="active"><a ui-sref="feed({sectionId:sectionId})" class="tooltipped" data-position="bottom"
  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 26 data-delay="50" data-tooltip="Feed"><i
27 27 class="mdi-action-view-module"></i></a></li>
28   - <li ui-sref-active="active"><a ui-sref="deck({sectionId:sectionId})" class="tooltipped" data-position="bottom"
  28 + <li ui-sref-active="active"><a ui-sref="deck({sectionId:currentSection.id})" class="tooltipped" data-position="bottom"
29 29 data-delay="50" data-tooltip="Deck"><i
30 30 class="mdi-action-view-carousel"></i></a></li>
31   - <li ui-sref-active="active"><a ui-sref="cardlist({sectionId:sectionId})" class="tooltipped" data-position="bottom"
  31 + <li ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})" class="tooltipped" data-position="bottom"
32 32 data-delay="50" data-tooltip="Card List"><i
33 33 class="mdi-action-view-list"></i></a></li>
34 34 </ul>
... ... @@ -43,7 +43,7 @@
43 43 <li class="divider"></li>
44 44 <li><a ui-sref="addclass">Add Class</a></li>
45 45 </ul>
46   - <li ng-show="currentSection"><a class="dropdown-button" href="#!" data-activates="dropdown1">{{currentSection?currentSection.short_name:"Classes"}}<i
  46 + <li><a class="dropdown-button ng-cloak" href="#!" data-activates="dropdown1">{{currentSection.id?currentSection.short_name:"Classes"}}<i
47 47 class="mdi-navigation-arrow-drop-down right"></i></a></li>
48 48 <li><a ui-sref="study">Study</a></li>
49 49 <li><a ui-sref="logout">Logout</a></li>
... ... @@ -74,7 +74,13 @@
74 74 </div>
75 75 </nav>
76 76 <main ui-view></main>
77   -
  77 +<footer class="page-footer">
  78 + <div class="footer-copyright">
  79 + <div class="container">
  80 + Concerns? Contact us by <a class="grey-text text-lighten-4" href="mailto:halp@flashy.cards">email</a>!
  81 + </div>
  82 + </div>
  83 +</footer>
78 84 </body>
79 85 <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
80 86 <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.js"></script>
scripts/CardListController.js View file @ dc71f53
1 1 angular.module('flashy.CardListController', ['ui.router']).
2   - controller('CardListController', ['$scope', '$state', '$http', '$stateParams',
3   - function($scope, $state, $http, $stateParams) {
4   - // cards array
5   - sectionId = $stateParams.sectionId;
6   - $scope.cards = [];
  2 + controller('CardListController', function ($scope, $rootScope, $state, $http, $stateParams) {
  3 + // cards array
  4 + sectionId = $stateParams.sectionId;
  5 + $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId});
  6 + $scope.cards = [];
7 7  
8   - $http.get('/api/sections/' + sectionId + '/flashcards/').
9   - success(function(data) {
10   - console.log(data);
11   - $scope.cards = data;
12   - }).
13   - error(function(err) {
14   - console.log('pulling feed failed');
15   - });
  8 + $http.get('/api/sections/' + sectionId + '/flashcards/').
  9 + success(function (data) {
  10 + console.log(data);
  11 + $scope.cards = data;
  12 + }).
  13 + error(function (err) {
  14 + console.log('pulling feed failed');
  15 + });
16 16  
17   - $scope.viewFeed = function() {
18   - $state.go('feed', {sectionId: sectionId});
19   - console.log('go to feed');
20   - };
  17 + $scope.viewFeed = function () {
  18 + $state.go('feed', {sectionId: sectionId});
  19 + console.log('go to feed');
  20 + };
21 21  
22   - // unhide card (dunno if it works yet)
23   - $scope.unhide = function(card) {
24   - $http.post('/api/flashcards/' + card.id + '/unhide').
25   - success(function(data) {
26   - console.log(card.text + " unhidden");
  22 + // unhide card (dunno if it works yet)
  23 + $scope.unhide = function (card) {
  24 + $http.post('/api/flashcards/' + card.id + '/unhide').
  25 + success(function (data) {
  26 + console.log(card.text + " unhidden");
27 27 }).
28   - error(function(err) {
29   - console.log('no unhide for you');
  28 + error(function (err) {
  29 + console.log('no unhide for you');
30 30 });
31   - };
  31 + };
32 32  
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   - })
39   - });
40   - })
  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 + })
  39 + });
  40 + });
  41 + $scope.$on('$destroy', function () {
  42 + $rootScope.currentSection = {};
  43 + $(document).off('keydown');
  44 + });
41 45  
42   - }]);
  46 + }
  47 +);
scripts/DeckController.js View file @ dc71f53
1 1 angular.module('flashy.DeckController', ['ui.router']).
2 2  
3   -controller('DeckController', ['$scope', '$state', '$http', '$stateParams',
4   - function($scope, $state, $http, $stateParams) {
  3 + controller('DeckController', function ($scope, $rootScope, $state, $http, $stateParams) {
5 4 // cards array
6 5 sectionId = $stateParams.sectionId;
  6 + $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId});
7 7 $scope.sectionId = sectionId;
8 8 $scope.cards = [];
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 () {
  37 + $rootScope.currentSection = {};
  38 + });
36 39 }
37   -]);
  40 +);
scripts/FeedController.js View file @ dc71f53
... ... @@ -151,6 +151,7 @@
151 151  
152 152 $scope.$on('$destroy', function () {
153 153 ws.close();
  154 + $rootScope.currentSection = {};
154 155 $(document).off('keydown');
155 156 });
156 157  
styles/flashy.css View file @ dc71f53
... ... @@ -274,6 +274,7 @@
274 274 border: 1px solid #fff;
275 275 }
276 276  
  277 +
277 278 /*#sidenav-overlay {
278 279 background-color: rgba(0, 0, 0, 0) !important;
279 280 }*/