Commit 910da5aeda313ed9b318c263db9c67ff9e5327b5

Authored by Andrew Buss
1 parent a97841dff4

show check mark for cards in deck, allow unpulling from feed

Showing 2 changed files with 30 additions and 27 deletions Side-by-side Diff

scripts/FlashcardDirective.js View file @ 910da5a
... ... @@ -24,35 +24,32 @@
24 24 scope.textPieces.push({text: scope.flashcard.text.slice(i)});
25 25 /* Pulls card from feed into deck */
26 26 scope.pullCard = function(flashcard) {
27   - if ($state.current.name == 'feed') {
28   - $http.post('/api/flashcards/' + flashcard.id + '/pull/', flashcard).
29   - success(function(data) {
30   - console.log('pulled flashcard #' + flashcard.id);
31   - scope.startShrink = true;
32   - scope.refresh(flashcard);
33   - }).
34   - error(function(data) {
35   - console.log('failed to pull flashcard #' + flashcard.id);
36   - });
37   - }
  27 + flashcard.is_in_deck = true;
  28 + $http.post('/api/flashcards/' + flashcard.id + '/pull/', flashcard).
  29 + success(function(data) {
  30 + console.log('pulled flashcard #' + flashcard.id);
  31 + //scope.startShrink = true;
  32 + //scope.refresh(flashcard);
  33 + }).
  34 + error(function(data) {
  35 + console.log('failed to pull flashcard #' + flashcard.id);
  36 + });
38 37 };
39 38  
40 39 /* Unpulls card from deck */
41 40 scope.unpullCard = function(flashcard) {
42   - if ($state.current.name == 'deck') {
43   - console.log('unpulling card...');
44   -
45   - $http.post('/api/flashcards/' + flashcard.id + '/unpull/',
46   - flashcard).
47   - success(function(data) {
48   - console.log('card unpull success');
49   - scope.startShrink = true;
50   - scope.refresh(flashcard);
51   - }).
52   - error(function(data) {
53   - console.log('card unpull FAILURE');
54   - });
55   - }
  41 + console.log('unpulling card...');
  42 + flashcard.is_in_deck = false;
  43 + $http.post('/api/flashcards/' + flashcard.id + '/unpull/',
  44 + flashcard).
  45 + success(function(data) {
  46 + console.log('card unpull success');
  47 + //scope.startShrink = true;
  48 + //scope.refresh(flashcard);
  49 + }).
  50 + error(function(data) {
  51 + console.log('card unpull FAILURE');
  52 + });
56 53 };
57 54  
58 55 /* Hides card from feed */
templates/flashcard.html View file @ 910da5a
... ... @@ -7,11 +7,14 @@
7 7 </div>
8 8 </div>
9 9 <div class="card-overlay">
10   - <div class="top-box no-user-select"
  10 + <div class="top-box no-user-select" ng-hide="flashcard.is_in_deck"
11 11 ng-click="pullCard(flashcard)">
12 12 <div class="center-me"><i class="mdi-content-add-circle-outline medium"></i></div>
13 13 </div>
14   -
  14 + <div class="top-box no-user-select" ng-show="flashcard.is_in_deck"
  15 + ng-click="unpullCard(flashcard)">
  16 + <div class="center-me"><i class="mdi-content-remove-circle-outline medium"></i></div>
  17 + </div>
15 18 <div class="bottom-box no-user-select">
16 19 <div class="left-box">
17 20 <div class="center-me"><i class="mdi-action-info-outline small"></i></div>
... ... @@ -22,6 +25,9 @@
22 25 </div>
23 26  
24 27 </div>
  28 + </div>
  29 + <div ng-show="flashcard.is_in_deck" class="green-text" style="position:absolute; top:0px;right:0px">
  30 + <div class="center-me"><i class="mdi-action-done small"></i></div>
25 31 </div>
26 32 </div>