Commit bac1b3d8dec13fea64fb99222b60007b917c250e

Authored by Melody
1 parent 629f7a4bae

Purple

Showing 3 changed files with 44 additions and 19 deletions Side-by-side Diff

... ... @@ -86,4 +86,8 @@
86 86 border-bottom: 1px solid #b388ff;
87 87 box-shadow: 0 1px 0 0 #b388ff;
88 88 }
  89 +
  90 +body {
  91 + background-color: #3A263D;
  92 +}
scripts/FeedController.js View file @ bac1b3d
... ... @@ -3,17 +3,34 @@
3 3 controller('FeedController', ['$scope', '$state', '$http', function($scope, $state, $http) {
4 4 console.log('Hello from feed');
5 5  
  6 + $scope.cards = [];
  7 +
  8 +
  9 + $scope.cards[0] = { 'id': 1, 'title': 'title1', 'content': 'abc' };
  10 + $scope.cards[1] = { 'id': 2, 'title': 'title2', 'content': 'xyz' };
  11 + $scope.cards[2] = { 'id': 2, 'title': 'title3', 'content': 'qwe' };
  12 +
  13 + $http.get("/api/sections/{pk}/flashcards").
  14 + success(function(data) {
  15 + for (var i = 0; i < data.length; i++) {
  16 + cards.push({ 'title': data[i].title, 'content': data[i].content });
  17 + }
  18 + }).
  19 + error(function(err) {
  20 + console.log('no');
  21 + });
  22 +
6 23 $scope.viewDeck = function() {
7 24 $state.go('deck');
8 25 console.log('go to deck');
9 26 };
10 27  
11   - $scope.pullCard = function() {
12   - console.log('card clicked');
  28 + $scope.pullCard = function(card) {
  29 + var index = $scope.cards.indexOf(card);
  30 +
  31 + console.log($scope.cards[index]);
13 32 };
14 33  
15   - $scope.create = false; // show make flashcard
16   -
17 34 $scope.pushCard = function() {
18 35 console.log('make! card content:' + $scope.text);
19 36 var pushed = new Date(Date.now());
... ... @@ -28,7 +45,6 @@
28 45 console.log('haha, n00b');
29 46 });
30 47  
31   - $scope.create = false; // hide make flashcard
32 48 $scope.text = '';
33 49 };
34 50  
templates/feed.html View file @ bac1b3d
... ... @@ -4,22 +4,27 @@
4 4 <a class="waves-effect waves-light btn purple" ng-click="viewDeck()" style="top: 15px">View Deck</a>
5 5 </div>
6 6  
7   - <!--random dummy cards-->
  7 + <!--cards-->
8 8 <div class="row">
9   - <div class="col s6">
10   - <div class="card-panel deep-purple" ng-click="pullCard()">
11   - <span class="white-text">{{ flashcard }}</span>
12   - </div>
13   - </div>
  9 + <div ng-repeat="card in cards">
  10 + <div class="col s6">
  11 + <div class="card" ng-click="pullCard(card)">
  12 + <div class="card-content">
  13 + <span class="card-title">{{card.title}}</span>
  14 + <p> {{card.content}} </p>
  15 + </div>
14 16  
15   - <div class="col s6">
16   - <div class="card-panel" ng-click="pullCard()">
17   - <span>{{ flashcard }}</span>
18   - </div>
19 17 </div>
20   -
  18 +
  19 + </div>
  20 +
  21 +
  22 + </div>
  23 + </div>
  24 +
  25 +
21 26 <!--Lil plus button in corner-->
22   - <div class="fixed-action-btn" ng-click="create = !create" style="bottom: 45px; right: 24px;">
  27 + <div class="fixed-action-btn" style="bottom: 45px; right: 24px;">
23 28 <a data-target="modal1" class="btn-floating btn-large purple modal-trigger" href="#newCard">
24 29 <i class="large mdi-content-add"></i>
25 30 </a>
... ... @@ -39,7 +44,7 @@
39 44 <div class="row">
40 45 <div class="input-field">
41 46 <i class="mdi-editor-mode-edit prefix"></i>
42   - <textarea class="materialize-textarea" ng-model="text" name="text"></textarea>
  47 + <textarea class="materialize-textarea" ng-model="text" type="text"></textarea>
43 48 <label id="newCardSign" for="newCard">New Flashcard</label>
44 49 </div>
45 50 </div>