diff --git a/home.html b/home.html index 0e41a36..716c1d7 100644 --- a/home.html +++ b/home.html @@ -21,14 +21,14 @@
- + diff --git a/scripts/CardListController.js b/scripts/CardListController.js index f0ccdcd..a707e26 100644 --- a/scripts/CardListController.js +++ b/scripts/CardListController.js @@ -1,42 +1,47 @@ angular.module('flashy.CardListController', ['ui.router']). - controller('CardListController', ['$scope', '$state', '$http', '$stateParams', - function($scope, $state, $http, $stateParams) { - // cards array - sectionId = $stateParams.sectionId; - $scope.cards = []; + controller('CardListController', function ($scope, $rootScope, $state, $http, $stateParams) { + // cards array + sectionId = $stateParams.sectionId; + $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId}); + $scope.cards = []; - $http.get('/api/sections/' + sectionId + '/flashcards/'). - success(function(data) { - console.log(data); - $scope.cards = data; - }). - error(function(err) { - console.log('pulling feed failed'); - }); + $http.get('/api/sections/' + sectionId + '/flashcards/'). + success(function (data) { + console.log(data); + $scope.cards = data; + }). + error(function (err) { + console.log('pulling feed failed'); + }); - $scope.viewFeed = function() { - $state.go('feed', {sectionId: sectionId}); - console.log('go to feed'); - }; + $scope.viewFeed = function () { + $state.go('feed', {sectionId: sectionId}); + console.log('go to feed'); + }; - // unhide card (dunno if it works yet) - $scope.unhide = function(card) { - $http.post('/api/flashcards/' + card.id + '/unhide'). - success(function(data) { - console.log(card.text + " unhidden"); + // unhide card (dunno if it works yet) + $scope.unhide = function (card) { + $http.post('/api/flashcards/' + card.id + '/unhide'). + success(function (data) { + console.log(card.text + " unhidden"); }). - error(function(err) { - console.log('no unhide for you'); + error(function (err) { + console.log('no unhide for you'); }); - }; + }; - // toggle button text from show to hide - $(function(){ - $("#showHidden").click(function () { - $(this).text(function(i, text){ - return text === "Show Hidden" ? "Hide Hidden" : "Show Hidden"; - }) - }); - }) + // toggle button text from show to hide + $(function () { + $("#showHidden").click(function () { + $(this).text(function (i, text) { + return text === "Show Hidden" ? "Hide Hidden" : "Show Hidden"; + }) + }); + }); + $scope.$on('$destroy', function () { + $rootScope.currentSection = {}; + $(document).off('keydown'); + }); - }]); + } +); diff --git a/scripts/DeckController.js b/scripts/DeckController.js index 1123154..23c72de 100644 --- a/scripts/DeckController.js +++ b/scripts/DeckController.js @@ -1,37 +1,40 @@ angular.module('flashy.DeckController', ['ui.router']). -controller('DeckController', ['$scope', '$state', '$http', '$stateParams', - function($scope, $state, $http, $stateParams) { + controller('DeckController', function ($scope, $rootScope, $state, $http, $stateParams) { // cards array sectionId = $stateParams.sectionId; + $rootScope.currentSection = $rootScope.SectionResource.get({sectionId: sectionId}); $scope.sectionId = sectionId; $scope.cards = []; // Populate our page with cards. $http.get('/api/sections/' + sectionId + '/deck/'). - success(function(data) { + success(function (data) { console.log(data); $scope.cards = data; }). - error(function(err) { + error(function (err) { console.log('pulling feed failed'); }); /* Lets page refresh the cards shown on the page. */ - $scope.refreshCards = function() { + $scope.refreshCards = function () { var myDelay = 200; // ms - setTimeout(function() { + setTimeout(function () { $http.get('/api/sections/' + sectionId + '/deck/'). - success(function(data) { + success(function (data) { console.log(data); $scope.cards = data; console.log('success in refresh cards...'); }). - error(function(err) { + error(function (err) { console.log('refresh fail'); }); }, myDelay); }; + $scope.$on('$destroy', function () { + $rootScope.currentSection = {}; + }); } -]); +); diff --git a/scripts/FeedController.js b/scripts/FeedController.js index 2dcb11b..3b37f73 100644 --- a/scripts/FeedController.js +++ b/scripts/FeedController.js @@ -151,6 +151,7 @@ angular.module('flashy.FeedController', ['ui.router']). $scope.$on('$destroy', function () { ws.close(); + $rootScope.currentSection = {}; $(document).off('keydown'); }); diff --git a/styles/flashy.css b/styles/flashy.css index af4c0b0..ccb0644 100644 --- a/styles/flashy.css +++ b/styles/flashy.css @@ -274,6 +274,7 @@ md-content.md-default-theme { border: 1px solid #fff; } + /*#sidenav-overlay { background-color: rgba(0, 0, 0, 0) !important; }*/