Commit 0dfc7258627de8bcb7475af67c074e6ec0c10fd1

Authored by Andrew Buss
1 parent 45a1bef497

more refactoring; bugfixes; new border if in deck

Showing 7 changed files with 31 additions and 19 deletions Side-by-side Diff

scripts/CardGridController.js View file @ 0dfc725
... ... @@ -96,6 +96,7 @@
96 96 lowestCol.unshift(card);
97 97 $scope.cardTable[card.id] = {'colNum': lowestColNum, 'obj': card};
98 98 $timeout($scope.refreshColumnWidth);
  99 +
99 100 };
100 101  
101 102 $scope.updateColRanks = function(col) {
scripts/FeedController.js View file @ 0dfc725
... ... @@ -28,10 +28,7 @@
28 28 };
29 29  
30 30 $scope.updateCardScore = function(card) {
31   - console.log('old score', card.score);
32   - card.score = flashcard.score;
33   - console.log('new score', card.score);
34   - $scope.cardCols[$scope.cardTable[card.id].colNum].sort(function(a, b) {
  31 + $scope.cardCols[card.colNum].sort(function(a, b) {
35 32 return b.score - a.score;
36 33 });
37 34 };
... ... @@ -44,7 +41,8 @@
44 41 $scope.addCardToGrid(new Flashcard(data.flashcard), $scope.deck);
45 42 } else if (data.event_type == 'score_change') {
46 43 card = new Flashcard(data.flashcard.id);
47   - $scope.updateCardScore(new Flashcard(data.flashcard.id));
  44 + card.score = data.flashcard.score;
  45 + $scope.updateCardScore(card);
48 46 }
49 47 });
50 48  
scripts/FlashcardDirective.js View file @ 0dfc725
... ... @@ -10,6 +10,7 @@
10 10 refresh: '&' // eval refresh in parent html
11 11 },
12 12 link: function(scope, element) {
  13 + $('.tooltipped').tooltip();
13 14 /* Handles width of the card */
14 15 }
15 16 };
scripts/FlashcardFactory.js View file @ 0dfc725
... ... @@ -9,7 +9,6 @@
9 9 this.mask.sort(function (a, b) {
10 10 return a[0] - b[0];
11 11 });
12   -
13 12 var i = 0;
14 13 this.mask.forEach(function (blank) {
15 14 this.textPieces.push({text: this.text.slice(i, blank[0])});
16 15  
... ... @@ -17,10 +16,15 @@
17 16 i = blank[1];
18 17 }, this);
19 18 this.textPieces.push({text: this.text.slice(i)});
  19 + this.formatted_text = '';
  20 + for (i in this.textPieces) {
  21 + p = this.textPieces[i];
  22 + this.formatted_text += p.blank ? '<b>' + p.text + '</b>' : p.text;
  23 + }
20 24 FlashcardCache[this.id] = this;
21 25 };
22 26 Flashcard.prototype.isInDeck = function () {
23   - return this.deck[this.id];
  27 + return !(typeof this.deck[this.id] === 'undefined');
24 28 };
25 29 Flashcard.prototype.pull = function () {
26 30 if (this.deck[this.id]) return console.log('Not pulling', this.id, "because it's already in deck");
scripts/StudyController.js View file @ 0dfc725
... ... @@ -37,7 +37,7 @@
37 37 $('#content-x').slideDown(250).addClass('open');
38 38 }
39 39 };
40   -
  40 +
41 41  
42 42 /*
43 43 $scope.fetchQuiz = function(a, b) {
styles/flashy.css View file @ 0dfc725
... ... @@ -47,6 +47,10 @@
47 47 word-wrap: break-word;
48 48 }
49 49  
  50 +.card.flashy.in-deck {
  51 + border: 3px solid rgba(0, 184, 76, 0.4);
  52 +}
  53 +
50 54 .card.flashy {
51 55 background-color: #fff;
52 56 font-family: 'Titillium Web', sans-serif;
... ... @@ -67,6 +71,7 @@
67 71 left: 0;
68 72 opacity: 0;
69 73 position: absolute;
  74 + /*pointer-events: none;*/
70 75 top: 0;
71 76 transition: visibility 0s cubic-bezier(0, 0, 0.6, 1) 0.2s,
72 77 opacity 0.2s cubic-bezier(0, 0, 0.6, 1);
... ... @@ -348,7 +353,8 @@
348 353 -webkit-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1);
349 354 -moz-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1);
350 355 -o-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1);
351   - transition: 1s all cubic-bezier(0, 0, 0.6, 1);
  356 + transition: 1s cubic-bezier(0.6, 0.3, 0.7, 1.4);
  357 + /*1s all cubic-bezier(0, 0, 1, 0.3);*/
352 358 position: relative;
353 359 }
354 360  
... ... @@ -381,9 +387,9 @@
381 387 }
382 388  
383 389 /*.wrapper {*/
384   - /*min-height: 100%;*/
385   - /*height: 100%;*/
386   - /*/!*margin: 0 auto -4em;*!/*/
  390 +/*min-height: 100%;*/
  391 +/*height: 100%;*/
  392 +/*/!*margin: 0 auto -4em;*!/*/
387 393 /*}*/
388 394  
389 395 .container, .push {
... ... @@ -457,7 +463,8 @@
457 463 padding: 10px 20px;
458 464 }
459 465  
460   -#new-card-input > b {
  466 +#new-card-input > b,
  467 +.card.flashy .card-content > b {
461 468 /*font-weight: ;*/
462 469 border-bottom: 2px solid black;
463 470 border-radius: 2px;
templates/flashcard.html View file @ 0dfc725
1 1 <div class="card flashy smallify cyan-text text-darken-2" ng-init="startShrink = false"
2   - ng-class="{'shrinky': startShrink}">
  2 + ng-class="{'shrinky': startShrink, 'in-deck':flashcard.isInDeck()}">
3 3 <div class="valign-wrapper">
4   - <div class="card-content valign center-align">
5   - <span ng-repeat="piece in flashcard.textPieces"
6   - ng-style="piece.blank ? {'opacity':'0.4', 'border-bottom': '1px solid black'} : {}">{{piece.text}}</span>
  4 + <div class="card-content valign center-align" ng-bind-html="flashcard.formatted_text">
  5 + <!--<span ng-repeat="piece in flashcard.textPieces"-->
  6 + <!--ng-style="piece.blank ? {'opacity':'0.4', 'border-bottom': '1px solid black'} : {}">{{piece.text}}</span>-->
7 7 </div>
8 8 </div>
9 9 <div class="card-overlay">
... ... @@ -25,8 +25,9 @@
25 25  
26 26 </div>
27 27 </div>
28   - <div ng-show="flashcard.isInDeck()" class="green-text" style="position:absolute; top:0px;right:0px">
29   - <div class="center-me"><i class="mdi-action-done small"></i></div>
  28 + <div ng-show="flashcard.isInDeck()" class="green-text" style="position:absolute; top:-9px;right:0px">
  29 + <div class="center-me tooltipped" data-position="bottom"
  30 + data-delay="50" data-tooltip="In deck"><i class="mdi-action-done small"></i></div>
30 31 </div>
31 32 <div ng-show="$root.debug_flashcard" style="position:absolute; bottom:0px; right:5px;">
32 33 <span class="center-me">score:{{flashcard.score}}</span>