Commit 54c942ddfc0a2d78857202c9d3d9933fdeea9a65

Authored by Andrew Buss
1 parent b20f733ef7

recovered cardlist view, committing before I lose!

Showing 5 changed files with 55 additions and 3 deletions Side-by-side Diff

... ... @@ -11,6 +11,7 @@
11 11 'flashy.FlashcardDirective',
12 12 'flashy.ResetPasswordController',
13 13 'flashy.VerifyEmailController',
  14 + 'flashy.CardListController',
14 15 'ngCookies']).
15 16 config(['$stateProvider', '$urlRouterProvider', '$httpProvider',
16 17 '$locationProvider',
... ... @@ -52,6 +53,12 @@
52 53 url: '/feed/{sectionId}',
53 54 templateUrl: 'templates/feed.html',
54 55 controller: 'FeedController'
  56 + }).
  57 + state('cardlist', {
  58 + resolve: auth_resolve,
  59 + url: '/cards/{sectionId}',
  60 + templateUrl: 'templates/cardlist.html',
  61 + controller: 'CardListController'
55 62 }).
56 63 state('addclass', {
57 64 resolve: auth_resolve,
... ... @@ -58,7 +58,9 @@
58 58 <script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.9.0/angular-material.min.js"></script>
59 59 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script>
60 60 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script>
  61 +<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.5.4/angular-filter.js"></script>
61 62  
  63 +
62 64 <script src="config.js"></script>
63 65  
64 66 <!-- Controllers -->
... ... @@ -71,6 +73,7 @@
71 73 <script src="scripts/ClassAddController.js"></script>
72 74 <script src="scripts/StudyController.js"></script>
73 75 <script src="scripts/ResetPasswordController.js"></script>
  76 +<script src="scripts/CardListController.js"></script>
74 77 <script src="scripts/VerifyEmailController.js"></script>
75 78 <!--<script src="scripts/SidebarController.js"></script>-->
76 79  
scripts/CardListController.js View file @ 54c942d
  1 +angular.module('flashy.CardListController', ['ui.router']).
  2 + controller('CardListController', ['$scope', '$state', '$http', '$stateParams',
  3 + function ($scope, $state, $http, $stateParams) {
  4 + // cards array
  5 + sectionId = $stateParams.sectionId;
  6 + $scope.cards = [];
  7 +
  8 + $http.get('/api/sections/' + sectionId + '/flashcards/').
  9 + success(function (data) {
  10 + console.log(data);
  11 + $scope.cards = data;
  12 + }).
  13 + error(function (err) {
  14 + console.log('pulling feed failed');
  15 + });
  16 + $scope.viewFeed = function () {
  17 + $state.go('feed', {sectionId: sectionId});
  18 + console.log('go to feed');
  19 + };
  20 +
  21 +
  22 + }]);
templates/cardlist.html View file @ 54c942d
  1 +<div class="row">
  2 + <a class="btn" ng-click="viewFeed()" style="margin-top: 15px">View Feed</a>
  3 +</div>
  4 +
  5 +<!--<i class="small mdi-content-sort" ng-click="filter()">Filter</i>-->
  6 +<div class="row">
  7 + <table>
  8 + <thead>
  9 + <tr>
  10 + <th data-field="id">Name</th>
  11 + </tr>
  12 + </thead>
  13 +
  14 + <tbody>
  15 + <tr ng-repeat="card in cards">
  16 + <td>{{card.text}}</td>
  17 + </tr>
  18 + </tbody>
  19 + </table>
  20 +</div>
templates/flashcard.html View file @ 54c942d
1 1 <div class="card flashy smallify" ng-init="startShrink = false"
2   - ng-class="{'shrinky': startShrink}">
  2 + ng-class="{'shrinky': startShrink}">
3 3 <div class="card-content">
4 4 <p>{{flashcard.text}}</p>
5 5 </div>
6 6 <div class="card-overlay">
7 7 <div class="top-box no-user-select"
8   - ng-click="pullCard(flashcard)">
  8 + ng-click="pullCard(flashcard)">
9 9 <div class="center-me"><i class="mdi-content-add-circle-outline medium"></i></div>
10 10 </div>
11 11