From 910da5aeda313ed9b318c263db9c67ff9e5327b5 Mon Sep 17 00:00:00 2001 From: Andrew Buss Date: Tue, 26 May 2015 16:42:04 -0700 Subject: [PATCH] show check mark for cards in deck, allow unpulling from feed --- scripts/FlashcardDirective.js | 47 ++++++++++++++++++++----------------------- templates/flashcard.html | 10 +++++++-- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/scripts/FlashcardDirective.js b/scripts/FlashcardDirective.js index 70afe08..cc91a80 100644 --- a/scripts/FlashcardDirective.js +++ b/scripts/FlashcardDirective.js @@ -24,35 +24,32 @@ angular.module('flashy.FlashcardDirective', []). scope.textPieces.push({text: scope.flashcard.text.slice(i)}); /* Pulls card from feed into deck */ scope.pullCard = function(flashcard) { - if ($state.current.name == 'feed') { - $http.post('/api/flashcards/' + flashcard.id + '/pull/', flashcard). - success(function(data) { - console.log('pulled flashcard #' + flashcard.id); - scope.startShrink = true; - scope.refresh(flashcard); - }). - error(function(data) { - console.log('failed to pull flashcard #' + flashcard.id); - }); - } + flashcard.is_in_deck = true; + $http.post('/api/flashcards/' + flashcard.id + '/pull/', flashcard). + success(function(data) { + console.log('pulled flashcard #' + flashcard.id); + //scope.startShrink = true; + //scope.refresh(flashcard); + }). + error(function(data) { + console.log('failed to pull flashcard #' + flashcard.id); + }); }; /* Unpulls card from deck */ scope.unpullCard = function(flashcard) { - if ($state.current.name == 'deck') { - console.log('unpulling card...'); - - $http.post('/api/flashcards/' + flashcard.id + '/unpull/', - flashcard). - success(function(data) { - console.log('card unpull success'); - scope.startShrink = true; - scope.refresh(flashcard); - }). - error(function(data) { - console.log('card unpull FAILURE'); - }); - } + console.log('unpulling card...'); + flashcard.is_in_deck = false; + $http.post('/api/flashcards/' + flashcard.id + '/unpull/', + flashcard). + success(function(data) { + console.log('card unpull success'); + //scope.startShrink = true; + //scope.refresh(flashcard); + }). + error(function(data) { + console.log('card unpull FAILURE'); + }); }; /* Hides card from feed */ diff --git a/templates/flashcard.html b/templates/flashcard.html index a28b5f7..9e467d9 100644 --- a/templates/flashcard.html +++ b/templates/flashcard.html @@ -7,11 +7,14 @@
-
- +
+
+
@@ -23,4 +26,7 @@
+
+
+
-- 1.9.1