Commit 714fedf890e3b47c0814ab813bc9dfb119452e23

Authored by Andrew Buss
1 parent f2dab803e1

display blanks in flashcarddirective!

Showing 4 changed files with 22 additions and 4 deletions Side-by-side Diff

scripts/FlashcardDirective.js View file @ 714fedf
... ... @@ -22,7 +22,18 @@
22 22 };
23 23 angular.element($window).bind('resize', refresh_width);
24 24 refresh_width();
25   -
  25 + scope.textPieces = [];
  26 + console.log(scope.flashcard);
  27 + scope.flashcard.mask.sort(function(a, b) {
  28 + return a[0] - b[0];
  29 + });
  30 + var i = 0;
  31 + scope.flashcard.mask.forEach(function(blank) {
  32 + scope.textPieces.push({text: scope.flashcard.text.slice(i, blank[0])});
  33 + scope.textPieces.push({text: scope.flashcard.text.slice(blank[0], blank[1]), blank: true});
  34 + i = blank[1];
  35 + });
  36 + scope.textPieces.push({text: scope.flashcard.text.slice(i)});
26 37 /* Pulls card from feed into deck */
27 38 scope.pullCard = function(flashcard) {
28 39 if ($state.current.name == 'feed') {
scripts/UserService.js View file @ 714fedf
... ... @@ -9,7 +9,7 @@
9 9 }).error(function(data) {
10 10 console.log(data);
11 11 console.log('not logged in yet: ' + data.detail);
12   - _user = {email:false};
  12 + _user = {email: false};
13 13 deferred.resolve(_user);
14 14 });
15 15  
styles/flashy.css View file @ 714fedf
... ... @@ -284,7 +284,13 @@
284 284 background-color: rgba(0, 0, 0, 0) !important;
285 285 }*/
286 286  
  287 +.card-content{
  288 + width:100%;
  289 +}
287 290  
  291 +.valign-wrapper{
  292 + height:100%;
  293 +}
288 294 h3{
289 295 text-align: center;
290 296 color: #654193;
templates/flashcard.html View file @ 714fedf
1 1 <div class="card flashy smallify" ng-init="startShrink = false"
2 2 ng-class="{'shrinky': startShrink}">
3 3 <div class="valign-wrapper">
4   - <div class="card-content valign">
5   - <p>{{flashcard.text}}</p>
  4 + <div class="card-content valign center-align">
  5 + <span ng-repeat="piece in textPieces"
  6 + ng-style="piece.blank ? {'opacity':'0.4', 'border-bottom': '1px solid black'} : {}">{{piece.text}}</span>
6 7 </div>
7 8 </div>
8 9 <div class="card-overlay">