Commit 5466bf8e0485f135ae3df4534639bfcaf80d47e5

Authored by Melody
1 parent e19b094000

List view looks nice. Unhide functionality unkown

Showing 2 changed files with 27 additions and 15 deletions Side-by-side Diff

scripts/CardListController.js View file @ 5466bf8
... ... @@ -13,11 +13,31 @@
13 13 error(function(err) {
14 14 console.log('pulling feed failed');
15 15 });
  16 +
16 17 $scope.viewFeed = function() {
17 18 $state.go('feed', {sectionId: sectionId});
18 19 console.log('go to feed');
19 20 };
20 21  
  22 + // unhide card (dunno if it works yet)
  23 + $scope.unhide = function(card) {
  24 + $http.post('/api/flashcards/' + card.id + '/unhide').
  25 + success(function(data) {
  26 + console.log(card.text + " unhidden");
  27 + }).
  28 + error(function(err) {
  29 + console.log('no unhide for you');
  30 + });
  31 + };
  32 +
  33 + // toggle button text from show to hide
  34 + $(function(){
  35 + $("#showHidden").click(function () {
  36 + $(this).text(function(i, text){
  37 + return text === "Show Hidden" ? "Hide Hidden" : "Show Hidden";
  38 + })
  39 + });
  40 + })
21 41  
22 42 }]);
templates/cardlist.html View file @ 5466bf8
1 1 <div class="row">
2 2 <a class="btn" ng-click="viewFeed()" style="margin-top: 15px">View Feed</a>
  3 + <a class="btn" id="showHidden" ng-click="show = !show" style="margin-top: 15px">Show Hidden</a>
3 4 </div>
4 5  
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>
  6 +<div class="list" style="padding: 0px 15px">
  7 + <ul class="collection">
  8 + <li class="collection-item" ng-repeat="card in cards" ng-show="show || !card.is_hidden">
  9 + <div>{{card.text}}<a href="unhide(card)" class="secondary-content" ng-show="card.is_hidden">Unhide</a></div>
  10 + </li>
  11 + </ul>
20 12 </div>