Compare View
Commits (2)
Diff
Showing 3 changed files Side-by-side Diff
scripts/FlashcardDirective.js
View file @
fc88fb8
... | ... | @@ -11,10 +11,14 @@ angular.module('flashy.FlashcardDirective', []). |
11 | 11 | flashcard: '=flashcardObj', // flashcard-obj in parent html |
12 | 12 | refresh: '&' // eval refresh in parent html |
13 | 13 | }, |
14 | + colNum: 0, | |
15 | + colRank: 0, | |
16 | + /*link: function(scope, element) { | |
17 | + | |
14 | 18 | link: function(scope, element) { |
15 | 19 | $('.tooltipped').tooltip(); |
16 | 20 | // /* Handles width of the card */ |
17 | - } | |
21 | + //} | |
18 | 22 | }; |
19 | 23 | } |
20 | 24 |
scripts/FlashcardFactory.js
View file @
fc88fb8
... | ... | @@ -63,8 +63,6 @@ angular.module('flashy.FlashcardFactory', ['ui.router']). |
63 | 63 | |
64 | 64 | var editableText = this.formatted_text; |
65 | 65 | |
66 | - //$('#flashcardEditText').html(this.formatted_text); | |
67 | - | |
68 | 66 | $('.modal-trigger').leanModal({ |
69 | 67 | dismissible: true, // Modal can be dismissed by clicking outside of the modal |
70 | 68 | opacity: .5, // Opacity of modal background |
... | ... | @@ -75,7 +73,6 @@ angular.module('flashy.FlashcardFactory', ['ui.router']). |
75 | 73 | $('#edit-card-input').html(editableText); |
76 | 74 | |
77 | 75 | |
78 | - | |
79 | 76 | }, // Callback for Modal open |
80 | 77 | complete: function () { |
81 | 78 | |
... | ... | @@ -88,12 +85,8 @@ angular.module('flashy.FlashcardFactory', ['ui.router']). |
88 | 85 | |
89 | 86 | Flashcard.prototype.refreshEditCardInput = function () { |
90 | 87 | |
91 | - console.log("ASDFASDFASDFASFD"); | |
92 | - | |
93 | - | |
94 | 88 | this.editCardText = $('#edit-card-input').text(); |
95 | 89 | |
96 | - | |
97 | 90 | this.submit_enabled = this.editCardText.length >= 5 && this.editCardText.length <= 160; |
98 | 91 | |
99 | 92 | |
... | ... | @@ -147,7 +140,10 @@ angular.module('flashy.FlashcardFactory', ['ui.router']). |
147 | 140 | }; |
148 | 141 | if (myCard.text == '') { |
149 | 142 | console.log('blank flashcard not pushed:' + myCard.text); |
150 | - return closeNewCard(); | |
143 | + //return closeNewCard(); | |
144 | + | |
145 | + $('#editModal').closeModal(modal_options); | |
146 | + | |
151 | 147 | } |
152 | 148 | $http.patch('/api/flashcards/' + this.id, myCard). |
153 | 149 | success(function (data) { |
... | ... | @@ -156,11 +152,18 @@ angular.module('flashy.FlashcardFactory', ['ui.router']). |
156 | 152 | Materialize.toast("<p>Thanks for contributing! However, others won't see your card until you verify your email address<p>", 4000); |
157 | 153 | } |
158 | 154 | }); |
159 | - //return .closeNewCardModal(); | |
155 | + | |
156 | + $('#editModal').closeModal(modal_options); | |
160 | 157 | |
161 | 158 | } |
162 | 159 | |
163 | 160 | |
161 | + Flashcard.prototype.discardChanges = function() { | |
162 | + | |
163 | + $('#editModal').closeModal(modal_options); | |
164 | + | |
165 | + } | |
166 | + | |
164 | 167 | |
165 | 168 | return Flashcard; |
166 | 169 | }); |
templates/flashcard.html
View file @
fc88fb8
... | ... | @@ -16,7 +16,12 @@ |
16 | 16 | </div> |
17 | 17 | <div class="bottom-box no-user-select"> |
18 | 18 | |
19 | + <div class="left-box tooltipped" data-position=" bottom" data-tooltip="Edit"> | |
20 | + <div class="center-me modal-trigger" href="#editModal" ng-click="flashcard.edit()"><i class="mdi-editor-border-color small"></i></div> | |
21 | + </div> | |
22 | + | |
19 | 23 | |
24 | + <div class="right-box tooltipped" ng-click="flashcard.hide()" data-position="bottom" data-tooltip="Hide"> | |
20 | 25 | <div class="left-box"> |
21 | 26 | <a class="center-me modal-trigger" href="#editModal" ng-click="flashcard.edit()"><i |
22 | 27 | class="mdi-editor-border-color small"></i></a> |
... | ... | @@ -30,6 +35,68 @@ |
30 | 35 | </div> |
31 | 36 | </div> |
32 | 37 | |
38 | + <!-- Edit Modal --> | |
39 | + <div id="editModal" class="modal row" style="max-height:none;"> | |
40 | + <form id="edit-card-form"> | |
41 | + <div class="modal-content col"> | |
42 | + <div class="row" style="margin-bottom:0"> | |
43 | + <div class="card cyan-text text-darken-2" | |
44 | + style="width:300px; height:180px; margin-bottom:0; font-size:120%;"> | |
45 | + <div class="valign-wrapper"> | |
46 | + <div id="edit-card-input" ng-model="newCardFormattedText" style="outline:0px solid transparent;" | |
47 | + class="card-content valign center-align" | |
48 | + contenteditable select-non-editable="true" ng-change="flashcard.refreshEditCardInput()"> | |
49 | + </div> | |
50 | + </div> | |
51 | + </div> | |
52 | + </div> | |
53 | + </div> | |
54 | + <div class="col"> | |
55 | + <div class="row"> | |
56 | + </div> | |
57 | + <div class="row"> | |
58 | + <button class="btn modal-close tooltipped" type="submit" ng-click="flashcard.pushCard()" | |
59 | + data-position="left" | |
60 | + data-delay="50" ng-class="flashcard.submit_enabled?{}:'disabled'" | |
61 | + data-tooltip="Enter"> | |
62 | + Edit | |
63 | + <i class="mdi-action-done right"></i> | |
64 | + </button> | |
65 | + </div> | |
66 | + | |
67 | + | |
68 | + <div class="row"> | |
69 | + <button class="btn modal-close" ng-click="flashcard.discardChanges()" | |
70 | + data-position="left" | |
71 | + data-delay="50"> | |
72 | + Discard Changes | |
73 | + <i class="mdi-content-clear right"></i> | |
74 | + </button> | |
75 | + </div> | |
76 | + | |
77 | + <!--<div class="row"> | |
78 | + <button id="blank-selected" style="float:left" class="btn tooltipped" data-position="right" data-delay="50" | |
79 | + data-tooltip="Ctrl-B"> | |
80 | + Blank Selected Text | |
81 | + </button> | |
82 | + </div>--> | |
83 | + | |
84 | + | |
85 | + <div class="row" ng-show="flashcard.editCardText" ng-style="(flashcard.editCardText.length>160)?{color:'red'}:{}"> | |
86 | + {{flashcard.editCardText.length}}/160 characters | |
87 | + </div> | |
88 | + <div class="row" ng-show="flashcard.editCardText.length < 5"> | |
89 | + Please write a little more! | |
90 | + </div> | |
91 | + <div class="row" ng-show="flashcard.editCardText.length > 140"> | |
92 | + Good flashcards have a<br> | |
93 | + single atomic fact | |
94 | + </div> | |
95 | + </div> | |
96 | + </form> | |
97 | + </div> | |
98 | + | |
99 | + | |
33 | 100 | |
34 | 101 | <!--<div id="editModal" class="modal"> |
35 | 102 | <div class="modal-content"> |