Commit b06f64922ca11ad201840f141efa58a53d01664f

Authored by Andrew Buss
1 parent 1d616f4a4d

fix pullUnpull for new flashcard magics

Showing 2 changed files with 2 additions and 2 deletions Inline Diff

scripts/FlashcardFactory.js View file @ b06f649
angular.module('flashy.FlashcardFactory', ['ui.router']). 1 1 angular.module('flashy.FlashcardFactory', ['ui.router']).
factory('Flashcard', function ($http) { 2 2 factory('Flashcard', function ($http) {
var FlashcardCache = []; 3 3 var FlashcardCache = [];
var Deck = null; 4 4 var Deck = null;
var Flashcard = function (data, deck) { 5 5 var Flashcard = function (data, deck) {
if(deck) Deck = deck; 6 6 if(deck) Deck = deck;
if (typeof data == 'number') return FlashcardCache[data]; 7 7 if (typeof data == 'number') return FlashcardCache[data];
if (FlashcardCache[data.id]) return FlashcardCache[data.id]; 8 8 if (FlashcardCache[data.id]) return FlashcardCache[data.id];
for (var k in data) this[k] = data[k]; 9 9 for (var k in data) this[k] = data[k];
this.textPieces = []; 10 10 this.textPieces = [];
this.mask.sort(function (a, b) { 11 11 this.mask.sort(function (a, b) {
return a[0] - b[0]; 12 12 return a[0] - b[0];
}); 13 13 });
var i = 0; 14 14 var i = 0;
this.mask.forEach(function (blank) { 15 15 this.mask.forEach(function (blank) {
this.textPieces.push({text: this.text.slice(i, blank[0])}); 16 16 this.textPieces.push({text: this.text.slice(i, blank[0])});
this.textPieces.push({text: this.text.slice(blank[0], blank[1]), blank: true}); 17 17 this.textPieces.push({text: this.text.slice(blank[0], blank[1]), blank: true});
i = blank[1]; 18 18 i = blank[1];
}, this); 19 19 }, this);
this.textPieces.push({text: this.text.slice(i)}); 20 20 this.textPieces.push({text: this.text.slice(i)});
this.formatted_text = ''; 21 21 this.formatted_text = '';
for (i in this.textPieces) { 22 22 for (i in this.textPieces) {
p = this.textPieces[i]; 23 23 p = this.textPieces[i];
this.formatted_text += p.blank ? '<b>' + p.text + '</b>' : p.text; 24 24 this.formatted_text += p.blank ? '<b>' + p.text + '</b>' : p.text;
} 25 25 }
FlashcardCache[this.id] = this; 26 26 FlashcardCache[this.id] = this;
}; 27 27 };
28 28
Flashcard.prototype.isInDeck = function () { 29 29 Flashcard.prototype.isInDeck = function () {
return !(typeof Deck.contains(this.id) === 'undefined'); 30 30 return !(typeof Deck.contains(this.id) === 'undefined');
}; 31 31 };
Flashcard.prototype.pullUnpull = function() { 32 32 Flashcard.prototype.pullUnpull = function() {
if (Deck[this.id]) this.unpull(); 33 33 if (this.isInDeck()) this.unpull();
else this.pull(); 34 34 else this.pull();
}; 35 35 };
Flashcard.prototype.pull = function () { 36 36 Flashcard.prototype.pull = function () {
if (this.isInDeck()) return console.log('Not pulling', this.id, "because it's already in deck"); 37 37 if (this.isInDeck()) return console.log('Not pulling', this.id, "because it's already in deck");
return $http.post('/api/flashcards/' + this.id + '/pull/'); 38 38 return $http.post('/api/flashcards/' + this.id + '/pull/');
}; 39 39 };
Flashcard.prototype.unpull = function () { 40 40 Flashcard.prototype.unpull = function () {
if (!this.isInDeck()) return console.log('Not unpulling', this.id, "because it's not in deck"); 41 41 if (!this.isInDeck()) return console.log('Not unpulling', this.id, "because it's not in deck");
return $http.post('/api/flashcards/' + this.id + '/unpull/'); 42 42 return $http.post('/api/flashcards/' + this.id + '/unpull/');
}; 43 43 };
Flashcard.prototype.hide = function () { 44 44 Flashcard.prototype.hide = function () {
return $http.post('/api/flashcards/' + this.id + '/hide/'); 45 45 return $http.post('/api/flashcards/' + this.id + '/hide/');
}; 46 46 };
47 47
return Flashcard; 48 48 return Flashcard;
styles/flashy.css View file @ b06f649
.no-user-select { 1 1 .no-user-select {
-moz-user-select: none; 2 2 -moz-user-select: none;
-webkit-user-select: none; 3 3 -webkit-user-select: none;
-ms-user-select: none; 4 4 -ms-user-select: none;
user-select: none; 5 5 user-select: none;
} 6 6 }
7 7
.angucomplete-dropdown { 8 8 .angucomplete-dropdown {
border-color: #ececec; 9 9 border-color: #ececec;
border-width: 1px; 10 10 border-width: 1px;
border-style: solid; 11 11 border-style: solid;
border-radius: 2px; 12 12 border-radius: 2px;
/*width: 250px;*/ 13 13 /*width: 250px;*/
padding: 6px; 14 14 padding: 6px;
cursor: pointer; 15 15 cursor: pointer;
z-index: 9999; 16 16 z-index: 9999;
position: absolute; 17 17 position: absolute;
/*top: 32px; 18 18 /*top: 32px;
left: 0px; 19 19 left: 0px;
*/ 20 20 */
margin-top: -6px; 21 21 margin-top: -6px;
background-color: #ffffff; 22 22 background-color: #ffffff;
} 23 23 }
24 24
.angucomplete-description { 25 25 .angucomplete-description {
font-size: 14px; 26 26 font-size: 14px;
} 27 27 }
28 28
.angucomplete-row { 29 29 .angucomplete-row {
padding: 5px; 30 30 padding: 5px;
color: #000000; 31 31 color: #000000;
margin-bottom: 4px; 32 32 margin-bottom: 4px;
clear: both; 33 33 clear: both;
} 34 34 }
35 35
.angucomplete-selected-row { 36 36 .angucomplete-selected-row {
background-color: #aaaaff; 37 37 background-color: #aaaaff;
} 38 38 }
39 39
/*.container .row {*/ 40 40 /*.container .row {*/
/*margin-left: 0;*/ 41 41 /*margin-left: 0;*/
/*margin-right: 0;*/ 42 42 /*margin-right: 0;*/
/*}*/ 43 43 /*}*/
44 44
/* Flashcard directive css */ 45 45 /* Flashcard directive css */
.card { 46 46 .card {
word-wrap: break-word; 47 47 word-wrap: break-word;
} 48 48 }
49 49
.card.flashy.in-deck { 50 50 .card.flashy.in-deck {
border: 3px solid rgba(0, 184, 76, 0.4); 51 51 /*border: 3px solid rgba(0, 184, 76, 0.4);*/
} 52 52 }
53 53
.card.flashy { 54 54 .card.flashy {
border: 0px solid rgba(0, 184, 76, 0.4); 55 55 border: 0px solid rgba(0, 184, 76, 0.4);
background-color: #fff; 56 56 background-color: #fff;
font-family: 'Titillium Web', sans-serif; 57 57 font-family: 'Titillium Web', sans-serif;
float: left; 58 58 float: left;
text-align: center; 59 59 text-align: center;
margin: 6px; 60 60 margin: 6px;
} 61 61 }
62 62
.card-overlay { 63 63 .card-overlay {
cursor: pointer; 64 64 cursor: pointer;
left: 0; 65 65 left: 0;
opacity: 0; 66 66 opacity: 0;
position: absolute; 67 67 position: absolute;
/*pointer-events: none;*/ 68 68 /*pointer-events: none;*/
top: 0; 69 69 top: 0;
transition: visibility 0s cubic-bezier(0, 0, 0.6, 1) 0.0s, 70 70 transition: visibility 0s cubic-bezier(0, 0, 0.6, 1) 0.0s,
opacity 0.2s cubic-bezier(0, 0, 0.6, 1); 71 71 opacity 0.2s cubic-bezier(0, 0, 0.6, 1);
/* animation effect to appear on off-hover */ 72 72 /* animation effect to appear on off-hover */
visibility: hidden; 73 73 visibility: hidden;
height: 100%; 74 74 height: 100%;
width: 100%; 75 75 width: 100%;
} 76 76 }
77 77
.card-overlay i { 78 78 .card-overlay i {
color: #FFF; 79 79 color: #FFF;
left: 50%; 80 80 left: 50%;
position: absolute; 81 81 position: absolute;
top: 50%; 82 82 top: 50%;
transform: translate(-50%, -50%); 83 83 transform: translate(-50%, -50%);
transition: all 0.2s cubic-bezier(0, 0, 0.6, 1) 0s; 84 84 transition: all 0.2s cubic-bezier(0, 0, 0.6, 1) 0s;
} 85 85 }
86 86
.center-me:hover i { 87 87 .center-me:hover i {
text-shadow: 0 0 15px rgba(255, 255, 255, 0.9); 88 88 text-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
} 89 89 }
90 90
.card:hover .card-overlay { 91 91 .card:hover .card-overlay {
opacity: 1.0; 92 92 opacity: 1.0;
transition-delay: 0s; /* animation effect to appear on hover */ 93 93 transition-delay: 0s; /* animation effect to appear on hover */
visibility: visible; 94 94 visibility: visible;
} 95 95 }
96 96
.top-box { 97 97 .top-box {
background-color: rgba(0, 184, 76, 0.4); 98 98 background-color: rgba(0, 184, 76, 0.4);
height: 65%; 99 99 height: 65%;
position: relative; 100 100 position: relative;
transition: all 0.2s cubic-bezier(0, 0, 0.6, 1) 0s; 101 101 transition: all 0.2s cubic-bezier(0, 0, 0.6, 1) 0s;
width: 100%; 102 102 width: 100%;
} 103 103 }
104 104
.top-box:hover { 105 105 .top-box:hover {
background-color: rgba(0, 184, 76, 0.5); 106 106 background-color: rgba(0, 184, 76, 0.5);
} 107 107 }
108 108
.bottom-box { 109 109 .bottom-box {
height: 35%; 110 110 height: 35%;
width: 100%; 111 111 width: 100%;
} 112 112 }
113 113
.left-box { 114 114 .left-box {
background-color: rgba(119, 146, 255, 0.5); 115 115 background-color: rgba(119, 146, 255, 0.5);
float: left; 116 116 float: left;
position: relative; 117 117 position: relative;
height: 100%; 118 118 height: 100%;
transition: all 0.2s cubic-bezier(0, 0, 0.6, 1) 0s; 119 119 transition: all 0.2s cubic-bezier(0, 0, 0.6, 1) 0s;
width: 50%; 120 120 width: 50%;
} 121 121 }
122 122
.left-box:hover { 123 123 .left-box:hover {
background-color: rgba(119, 146, 255, 0.6); 124 124 background-color: rgba(119, 146, 255, 0.6);
} 125 125 }
126 126
.right-box { 127 127 .right-box {
background-color: rgba(255, 62, 76, 0.5); 128 128 background-color: rgba(255, 62, 76, 0.5);
float: right; 129 129 float: right;
height: 100%; 130 130 height: 100%;
position: relative; 131 131 position: relative;
transition: all 0.2s cubic-bezier(0, 0, 0.6, 1) 0s; 132 132 transition: all 0.2s cubic-bezier(0, 0, 0.6, 1) 0s;
width: 50%; 133 133 width: 50%;
} 134 134 }
135 135
.right-box:hover { 136 136 .right-box:hover {
background-color: rgba(255, 62, 76, 0.6); 137 137 background-color: rgba(255, 62, 76, 0.6);
} 138 138 }
139 139
.center-me { 140 140 .center-me {
height: 100%; 141 141 height: 100%;
margin: 0 auto; 142 142 margin: 0 auto;
text-align: center; 143 143 text-align: center;
vertical-align: middle; 144 144 vertical-align: middle;
width: 100%; 145 145 width: 100%;
} 146 146 }
147 147
/* Card Colors */ 148 148 /* Card Colors */
.card.flashy.cardcolor-blue div { 149 149 .card.flashy.cardcolor-blue div {
background-color: rgba(119, 158, 203, 0.5) !important; 150 150 background-color: rgba(119, 158, 203, 0.5) !important;
} 151 151 }
152 152
.cardcolor-red div { 153 153 .cardcolor-red div {
background-color: rgba(255, 105, 97, 0.5) !important; 154 154 background-color: rgba(255, 105, 97, 0.5) !important;
} 155 155 }
156 156
.cardcolor-green div { 157 157 .cardcolor-green div {
background-color: rgba(119, 190, 119, 0.5) !important; 158 158 background-color: rgba(119, 190, 119, 0.5) !important;
} 159 159 }
160 160
.cardcolor-yellow div { 161 161 .cardcolor-yellow div {
background-color: rgba(253, 253, 150, 0.5) !important; 162 162 background-color: rgba(253, 253, 150, 0.5) !important;
} 163 163 }
164 164
/* Card Colors END */ 165 165 /* Card Colors END */
166 166
.modal.bottom-sheet { 167 167 .modal.bottom-sheet {
max-width: 600px; 168 168 max-width: 600px;
margin-left: auto; 169 169 margin-left: auto;
margin-right: auto; 170 170 margin-right: auto;
} 171 171 }
172 172
.feed-modal-input { 173 173 .feed-modal-input {
background-color: #D3D3D3; 174 174 background-color: #D3D3D3;
border-style: solid; 175 175 border-style: solid;
border-width: 1px; 176 176 border-width: 1px;
box-shadow: 2px 2px 5px #888888; 177 177 box-shadow: 2px 2px 5px #888888;
height: 24px; 178 178 height: 24px;
} 179 179 }
180 180
.input-field label { 181 181 .input-field label {
color: #00b3c2; 182 182 color: #00b3c2;
} 183 183 }
184 184
/* label focus color */ 185 185 /* label focus color */
.input-field input[type]:focus + label { 186 186 .input-field input[type]:focus + label {
color: #00b3c2; 187 187 color: #00b3c2;
} 188 188 }
189 189
/* label underline focus color */ 190 190 /* label underline focus color */
.input-field input[type]:focus { 191 191 .input-field input[type]:focus {
border-bottom: 1px solid #00b3c2; 192 192 border-bottom: 1px solid #00b3c2;
box-shadow: 0 1px 0 0 #b388ff; 193 193 box-shadow: 0 1px 0 0 #b388ff;
} 194 194 }
195 195
/* valid color */ 196 196 /* valid color */
.input-field input[type].valid { 197 197 .input-field input[type].valid {
border-bottom: 1px solid #00c28f; 198 198 border-bottom: 1px solid #00c28f;
box-shadow: 0 1px 0 0 #673ab7; 199 199 box-shadow: 0 1px 0 0 #673ab7;
} 200 200 }
201 201
/* invalid color */ 202 202 /* invalid color */
.input-field input[type].invalid { 203 203 .input-field input[type].invalid {
border-bottom: 1px solid #673ab7; 204 204 border-bottom: 1px solid #673ab7;
box-shadow: 0 1px 0 0 #673ab7; 205 205 box-shadow: 0 1px 0 0 #673ab7;
} 206 206 }
207 207
/* icon prefix focus color */ 208 208 /* icon prefix focus color */
.input-field .prefix.active { 209 209 .input-field .prefix.active {
color: #b388ff; 210 210 color: #b388ff;
} 211 211 }
212 212
/* label focus color */ 213 213 /* label focus color */
.input-field textarea[type]:focus + label { 214 214 .input-field textarea[type]:focus + label {
color: #b388ff; 215 215 color: #b388ff;
} 216 216 }
217 217
/* label underline focus color */ 218 218 /* label underline focus color */
.input-field textarea[type]:focus { 219 219 .input-field textarea[type]:focus {
border-bottom: 1px solid #00b3c2; 220 220 border-bottom: 1px solid #00b3c2;
box-shadow: 0 1px 0 0 #b388ff; 221 221 box-shadow: 0 1px 0 0 #b388ff;
} 222 222 }
223 223
body { 224 224 body {
background-color: #e8e8e8; 225 225 background-color: #e8e8e8;
overflow-x: hidden; 226 226 overflow-x: hidden;
font-family: 'Titillium Web', sans-serif; 227 227 font-family: 'Titillium Web', sans-serif;
height: 100%; 228 228 height: 100%;
} 229 229 }
230 230
html { 231 231 html {
background: transparent; 232 232 background: transparent;
height: 100%; 233 233 height: 100%;
} 234 234 }
235 235
.btn { 236 236 .btn {
background-color: #00b3c2; 237 237 background-color: #00b3c2;
} 238 238 }
239 239
.btn:hover { 240 240 .btn:hover {
background-color: #0097cb; 241 241 background-color: #0097cb;
} 242 242 }
243 243
.btn-floating { 244 244 .btn-floating {
background-color: #00b3c2; 245 245 background-color: #00b3c2;
} 246 246 }
247 247
.btn-floating:hover { 248 248 .btn-floating:hover {
background-color: #0097cb; 249 249 background-color: #0097cb;
} 250 250 }
251 251
.toggley { 252 252 .toggley {
float: left; 253 253 float: left;
margin: 10px; 254 254 margin: 10px;
} 255 255 }
256 256
#logo-container { 257 257 #logo-container {
margin-bottom: 18px; 258 258 margin-bottom: 18px;
} 259 259 }
260 260
#lean-overlay { 261 261 #lean-overlay {
display: none !important; 262 262 display: none !important;
} 263 263 }
264 264
nav { 265 265 nav {
background-color: #d2143f !important; 266 266 background-color: #d2143f !important;
} 267 267 }
268 268
main { 269 269 main {
min-height: 145px; 270 270 min-height: 145px;
} 271 271 }
272 272
.side-nav .collapsible-body { 273 273 .side-nav .collapsible-body {
width: 100%; 274 274 width: 100%;
} 275 275 }
276 276
.side-nav .collapsible-body li.active, .side-nav.fixed .collapsible-body li.active { 277 277 .side-nav .collapsible-body li.active, .side-nav.fixed .collapsible-body li.active {
background-color: #00b3c2; 278 278 background-color: #00b3c2;
} 279 279 }
280 280
nav .button-collapse { 281 281 nav .button-collapse {
margin: 0 20px; 282 282 margin: 0 20px;
} 283 283 }
284 284
.collapsible-body i { 285 285 .collapsible-body i {
font-size: 1rem !important; 286 286 font-size: 1rem !important;
} 287 287 }
288 288
.tabs .tab a { 289 289 .tabs .tab a {
color: #00b3c2; 290 290 color: #00b3c2;
} 291 291 }
292 292
.tabs .tab a:hover { 293 293 .tabs .tab a:hover {
color: #0041dd; 294 294 color: #0041dd;
} 295 295 }
296 296
.tabs .indicator { 297 297 .tabs .indicator {
border-bottom: 1px solid #00b3c2; 298 298 border-bottom: 1px solid #00b3c2;
} 299 299 }
300 300
h2 { 301 301 h2 {
text-align: center; 302 302 text-align: center;
} 303 303 }
304 304
md-content.md-default-theme { 305 305 md-content.md-default-theme {
background-color: rgba(255, 255, 255, 0); 306 306 background-color: rgba(255, 255, 255, 0);
border: 1px solid #fff; 307 307 border: 1px solid #fff;
} 308 308 }
309 309
/*#sidenav-overlay { 310 310 /*#sidenav-overlay {
background-color: rgba(0, 0, 0, 0) !important; 311 311 background-color: rgba(0, 0, 0, 0) !important;
}*/ 312 312 }*/
.card-content { 313 313 .card-content {
width: 100%; 314 314 width: 100%;
} 315 315 }
316 316
.valign-wrapper { 317 317 .valign-wrapper {
height: 100%; 318 318 height: 100%;
} 319 319 }
320 320
/*.toast { 321 321 /*.toast {
height: 100px; 322 322 height: 100px;
width: 300px; 323 323 width: 300px;
line-height: 20px; 324 324 line-height: 20px;
max-height: 100px; 325 325 max-height: 100px;
word-wrap: normal; 326 326 word-wrap: normal;
}*/ 327 327 }*/
328 328
[ng-cloak] { 329 329 [ng-cloak] {
display: none !important; 330 330 display: none !important;
} 331 331 }
332 332
.cardColumn { 333 333 .cardColumn {
float: left; 334 334 float: left;
} 335 335 }
336 336
/* Animation CSS, http://www.yearofmoo.com/2013/08/remastered-animation-in-angularjs-1-2.html */ 337 337 /* Animation CSS, http://www.yearofmoo.com/2013/08/remastered-animation-in-angularjs-1-2.html */
.repeated-card.ng-enter, 338 338 .repeated-card.ng-enter,
.repeated-card.ng-enter > flashcard > .card, 339 339 .repeated-card.ng-enter > flashcard > .card,
.repeated-card.ng-leave, 340 340 .repeated-card.ng-leave,
.repeated-card.ng-leave > flashcard > .card, 341 341 .repeated-card.ng-leave > flashcard > .card,
.repeated-card.ng-move, 342 342 .repeated-card.ng-move,
.repeated-card.ng-move > flashcard > .card { 343 343 .repeated-card.ng-move > flashcard > .card {
-webkit-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1); 344 344 -webkit-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1);
-moz-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1); 345 345 -moz-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1);
-o-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1); 346 346 -o-transition: 0.5s all cubic-bezier(0, 0, 0.6, 1);
transition: 1s all cubic-bezier(0.6, 0.3, 0.7, 1.0); 347 347 transition: 1s all cubic-bezier(0.6, 0.3, 0.7, 1.0);
position: relative; 348 348 position: relative;
} 349 349 }
350 350
.repeated-card.ng-enter > flashcard > .card { 351 351 .repeated-card.ng-enter > flashcard > .card {
z-index: 1; 352 352 z-index: 1;
top: -236px; 353 353 top: -236px;
margin-bottom: -230px; 354 354 margin-bottom: -230px;
} 355 355 }
356 356
.repeated-card.ng-enter.ng-enter-active > flashcard > .card { 357 357 .repeated-card.ng-enter.ng-enter-active > flashcard > .card {
top: 0px; 358 358 top: 0px;
margin-bottom: 6px; 359 359 margin-bottom: 6px;
} 360 360 }
361 361
.repeated-card.ng-leave > flashcard > .card { 362 362 .repeated-card.ng-leave > flashcard > .card {
z-index: -100; 363 363 z-index: -100;
top: 0px; 364 364 top: 0px;
margin-bottom: 6px; 365 365 margin-bottom: 6px;
} 366 366 }
367 367
.repeated-card.ng-leave.ng-leave-active > flashcard > .card { 368 368 .repeated-card.ng-leave.ng-leave-active > flashcard > .card {
z-index: -100; 369 369 z-index: -100;
opacity: 0; 370 370 opacity: 0;
top: -236px; 371 371 top: -236px;
margin-bottom: -230px; 372 372 margin-bottom: -230px;
} 373 373 }
374 374
.repeated-card.ng-move > flashcard > .card { 375 375 .repeated-card.ng-move > flashcard > .card {
background-color:blue; 376 376 background-color:blue;
top: -250px; 377 377 top: -250px;
} 378 378 }
379 379
.repeated-card.ng-move-active > flashcard > .card { 380 380 .repeated-card.ng-move-active > flashcard > .card {
top: 0 381 381 top: 0
} 382 382 }
383 383
.repeated-card.ng-move > flashcard > .card + div { 384 384 .repeated-card.ng-move > flashcard > .card + div {
background-color:red; 385 385 background-color:red;
top: -250px; 386 386 top: -250px;
} 387 387 }
388 388