Commit fbb202c4cd70ea9d06cbaddd96771bb68e2d2af1

Authored by Kevin Mach
1 parent 0c0dbdc7ef

made a few changes for edit

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

scripts/FlashcardDirective.js View file @ fbb202c
... ... @@ -13,10 +13,10 @@
13 13 },
14 14 colNum: 0,
15 15 colRank: 0,
16   - link: function(scope, element) {
  16 + /*link: function(scope, element) {
17 17 $('.tooltipped').tooltip();
18 18 // /* Handles width of the card */
19   - }
  19 + //}
20 20 };
21 21 }
22 22  
scripts/FlashcardFactory.js View file @ fbb202c
... ... @@ -59,8 +59,6 @@
59 59  
60 60 var editableText = this.formatted_text;
61 61  
62   - //$('#flashcardEditText').html(this.formatted_text);
63   -
64 62 $('.modal-trigger').leanModal({
65 63 dismissible: true, // Modal can be dismissed by clicking outside of the modal
66 64 opacity: .5, // Opacity of modal background
... ... @@ -71,7 +69,6 @@
71 69 $('#edit-card-input').html(editableText);
72 70  
73 71  
74   -
75 72 }, // Callback for Modal open
76 73 complete: function () {
77 74  
78 75  
... ... @@ -86,12 +83,8 @@
86 83  
87 84 Flashcard.prototype.refreshEditCardInput = function () {
88 85  
89   - console.log("ASDFASDFASDFASFD");
90   -
91   -
92 86 this.editCardText = $('#edit-card-input').text();
93 87  
94   -
95 88 this.submit_enabled = this.editCardText.length >= 5 && this.editCardText.length <= 160;
96 89  
97 90  
... ... @@ -145,7 +138,10 @@
145 138 };
146 139 if (myCard.text == '') {
147 140 console.log('blank flashcard not pushed:' + myCard.text);
148   - return closeNewCard();
  141 + //return closeNewCard();
  142 +
  143 + $('#editModal').closeModal(modal_options);
  144 +
149 145 }
150 146 $http.patch('/api/flashcards/' + this.id, myCard).
151 147 success(function (data) {
152 148  
153 149  
... ... @@ -154,10 +150,17 @@
154 150 Materialize.toast("<p>Thanks for contributing! However, others won't see your card until you verify your email address<p>", 4000);
155 151 }
156 152 });
157   - //return .closeNewCardModal();
158 153  
  154 + $('#editModal').closeModal(modal_options);
  155 +
159 156 }
160 157  
  158 +
  159 + Flashcard.prototype.discardChanges = function() {
  160 +
  161 + $('#editModal').closeModal(modal_options);
  162 +
  163 + }
161 164  
162 165  
163 166 return Flashcard;
templates/flashcard.html View file @ fbb202c
... ... @@ -21,13 +21,11 @@
21 21 <div class="bottom-box no-user-select">
22 22  
23 23  
24   - <div class="left-box tooltipped" data-position=" bottom" data-tooltip="Info">
  24 + <div class="left-box tooltipped" data-position=" bottom" data-tooltip="Edit">
25 25 <div class="center-me modal-trigger" href="#editModal" ng-click="flashcard.edit()"><i class="mdi-editor-border-color small"></i></div>
26 26 </div>
27 27  
28 28  
29   -
30   -
31 29 <div class="right-box tooltipped" ng-click="flashcard.hide()" data-position="bottom" data-tooltip="Hide">
32 30 <div class="center-me"><i class="mdi-action-delete small"></i></div>
33 31 </div>
... ... @@ -36,17 +34,7 @@
36 34 </div>
37 35  
38 36  
39   - <!--<div id="editModal" class="modal">
40   - <div class="modal-content">
41   - <h4 id="flashcardEditText"></h4>
42   - </div>
43   - <div class="modal-footer">
44   -
45   - </div>
46   - </div>-->
47   -
48   -
49   -
  37 + <!-- Edit Modal -->
50 38 <div id="editModal" class="modal row" style="max-height:none;">
51 39 <form id="edit-card-form">
52 40 <div class="modal-content col">
53 41  
54 42  
55 43  
... ... @@ -71,15 +59,28 @@
71 59 data-delay="50" ng-class="flashcard.submit_enabled?{}:'disabled'"
72 60 data-tooltip="Enter">
73 61 Edit
74   - <i class="mdi-hardware-keyboard-return right"></i>
  62 + <i class="mdi-action-done right"></i>
75 63 </button>
76 64 </div>
  65 +
  66 +
77 67 <div class="row">
  68 + <button class="btn modal-close" ng-click="flashcard.discardChanges()"
  69 + data-position="left"
  70 + data-delay="50">
  71 + Discard Changes
  72 + <i class="mdi-content-clear right"></i>
  73 + </button>
  74 + </div>
  75 +
  76 + <!--<div class="row">
78 77 <button id="blank-selected" style="float:left" class="btn tooltipped" data-position="right" data-delay="50"
79 78 data-tooltip="Ctrl-B">
80 79 Blank Selected Text
81 80 </button>
82   - </div>
  81 + </div>-->
  82 +
  83 +
83 84 <div class="row" ng-show="flashcard.editCardText" ng-style="(flashcard.editCardText.length>160)?{color:'red'}:{}">
84 85 {{flashcard.editCardText.length}}/160 characters
85 86 </div>