Commit 12b18b80d6fd4e94700452818d825adede41f69b

Authored by Tetranoir
1 parent 17907a95c7

queued column updates

Showing 3 changed files with 18 additions and 18 deletions Side-by-side Diff

scripts/CardGridController.js View file @ 12b18b8
1 1 angular.module('flashy.CardGridController', ['ui.router', 'ngAnimate', 'ngWebSocket']).CardGridController =
2   - function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, UserService, Flashcard) {
3   - $scope.cards = [];
  2 + function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, $interval, UserService, Flashcard) {
  3 + $scope.cards = []; // all cards
4 4 $scope.deck = [];
5 5 $scope.cardCols = []; // organized data
  6 + $scope.cardColsShow = []; // displayed data
6 7 $scope.numCols = 0;
7   - $scope.cardTable = {}; // look up table of cards, {'colNum':col, 'obj':card}
  8 + $scope.cardTable = {}; // look up table of cards: {'colNum':col, 'obj':card}
8 9 $scope.sectionId = parseInt($stateParams.sectionId);
9 10 $scope.section = $rootScope.SectionResource.get({sectionId: $scope.sectionId});
10 11 $scope.showGrid = false;
11   - $scope.moveQueue = [];
  12 + //$scope.moveQueue = []; // queue of flashcard objects
12 13 $rootScope.currentSection = $scope.section;
13 14  
14 15 if (!UserService.isInSection($scope.sectionId)) {
15 16 console.log('user is not enrolled in ' + $scope.sectionId);
16 17 $state.go('addclass');
17 18 }
18   -
  19 +
19 20 $scope.refreshColumnWidth = function() {
20 21 avail = $window.innerWidth - 17;
21 22 width = Math.floor(avail / Math.floor(avail / 250));
scripts/FeedController.js View file @ 12b18b8
1 1 angular.module('flashy.FeedController', ['ui.router', 'ngAnimate', 'ngWebSocket', 'contenteditable']).controller('FeedController',
2   - function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, UserService, Flashcard) {
  2 + function($scope, $rootScope, $state, $http, $window, $timeout, $stateParams, $websocket, $interval, UserService, Flashcard) {
3 3 angular.module('flashy.CardGridController').CardGridController.apply(this, arguments);
4   -
5   - $scope.sortAdd = function(card, array) {
6   - console.log('sort add');
7   - array.forEach(function(ele, i, ary) {
8   - if (ele.score <= card.score) {
9   - ary.splice(i, 0, card);
10   - return;
11   - }
12   - });
13   - };
14   -
  4 +
  5 + (function drawCols() {
  6 + $interval(function() {
  7 + if ($scope.cardColsShow != $scope.cardCols) {
  8 + $scope.cardColsShow = $scope.cardCols;
  9 + console.log('interval');
  10 + }
  11 + }, 1000);
  12 + }());
  13 +
15 14 $scope.updateCardScore = function(card) {
16 15 console.log($scope.cardCols, card);
17 16 // if no colNum is attached, then this doesn't exist on the feed yet
templates/feed.html View file @ 12b18b8
... ... @@ -5,7 +5,7 @@
5 5 <div class="indeterminate"></div>
6 6 </div>
7 7  
8   - <div class="cardColumn" ng-repeat="col in cardCols">
  8 + <div class="cardColumn" ng-repeat="col in cardColsShow">
9 9 <div class="repeated-card" ng-repeat="card in col">
10 10 <flashcard flashcard-obj="card"/>
11 11 </div>