diff --git a/scripts/CardGridController.js b/scripts/CardGridController.js index 2f18a58..af0d7a6 100644 --- a/scripts/CardGridController.js +++ b/scripts/CardGridController.js @@ -1,21 +1,22 @@ angular.module('flashy.CardGridController', ['ui.router', 'ngAnimate', 'ngWebSocket']).CardGridController = - function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, UserService, Flashcard) { - $scope.cards = []; + function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, $interval, UserService, Flashcard) { + $scope.cards = []; // all cards $scope.deck = []; $scope.cardCols = []; // organized data + $scope.cardColsShow = []; // displayed data $scope.numCols = 0; - $scope.cardTable = {}; // look up table of cards, {'colNum':col, 'obj':card} + $scope.cardTable = {}; // look up table of cards: {'colNum':col, 'obj':card} $scope.sectionId = parseInt($stateParams.sectionId); $scope.section = $rootScope.SectionResource.get({sectionId: $scope.sectionId}); $scope.showGrid = false; - $scope.moveQueue = []; + //$scope.moveQueue = []; // queue of flashcard objects $rootScope.currentSection = $scope.section; if (!UserService.isInSection($scope.sectionId)) { console.log('user is not enrolled in ' + $scope.sectionId); $state.go('addclass'); } - + $scope.refreshColumnWidth = function() { avail = $window.innerWidth - 17; width = Math.floor(avail / Math.floor(avail / 250)); diff --git a/scripts/FeedController.js b/scripts/FeedController.js index ff10ea4..ec63f03 100644 --- a/scripts/FeedController.js +++ b/scripts/FeedController.js @@ -1,17 +1,16 @@ angular.module('flashy.FeedController', ['ui.router', 'ngAnimate', 'ngWebSocket', 'contenteditable']).controller('FeedController', - function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, UserService, Flashcard) { + function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, $interval, UserService, Flashcard) { angular.module('flashy.CardGridController').CardGridController.apply(this, arguments); - - $scope.sortAdd = function(card, array) { - console.log('sort add'); - array.forEach(function(ele, i, ary) { - if (ele.score <= card.score) { - ary.splice(i, 0, card); - return; - } - }); - }; - + + (function drawCols() { + $interval(function() { + if ($scope.cardColsShow != $scope.cardCols) { + $scope.cardColsShow = $scope.cardCols; + console.log('interval'); + } + }, 1000); + }()); + $scope.updateCardScore = function(card) { console.log($scope.cardCols, card); // if no colNum is attached, then this doesn't exist on the feed yet diff --git a/templates/feed.html b/templates/feed.html index 6e8323e..26dfec2 100644 --- a/templates/feed.html +++ b/templates/feed.html @@ -5,7 +5,7 @@
-
+