Commit 331ca39d260f407b607540153cdc15eccde98bba

Authored by Melody
1 parent 9436dc71d2

Crude Drop Class page

Showing 6 changed files with 52 additions and 2 deletions Side-by-side Diff

... ... @@ -5,6 +5,7 @@
5 5 'flashy.FeedController',
6 6 'flashy.DeckController',
7 7 'flashy.ClassAddController',
  8 + 'flashy.ClassDropController',
8 9 'flashy.RequestResetController',
9 10 'flashy.StudyController',
10 11 'flashy.UserService',
... ... @@ -107,6 +108,12 @@
107 108 url: '/addclass',
108 109 templateUrl: 'templates/addclass.html',
109 110 controller: 'ClassAddController'
  111 + }).
  112 + state('dropclass', {
  113 + resolve: auth_resolve,
  114 + url: '/settings/dropclass',
  115 + templateUrl: 'templates/dropclass.html',
  116 + controller: 'ClassDropController'
110 117 }).
111 118 state('deck', {
112 119 resolve: auth_resolve,
... ... @@ -164,6 +164,7 @@
164 164 <script src="scripts/DeckController.js"></script>
165 165 <script src="scripts/RequestResetController.js"></script>
166 166 <script src="scripts/ClassAddController.js"></script>
  167 +<script src="scripts/ClassDropController.js"></script>
167 168 <script src="scripts/StudyController.js"></script>
168 169 <script src="scripts/ResetPasswordController.js"></script>
169 170 <script src="scripts/CardListController.js"></script>
scripts/CardListController.js View file @ 331ca39
... ... @@ -199,7 +199,6 @@
199 199 if (start != card.mask.length - 1)
200 200 cardText = cardText.concat(card.text.substring(start));
201 201  
202   - //cardText = cardText.concat("</span>");
203 202 return $sce.trustAsHtml(cardText);
204 203 };
205 204 });
scripts/ClassDropController.js View file @ 331ca39
  1 +angular.module('flashy.ClassDropController', ['ui.router']).
  2 + controller('ClassDropController', function($rootScope, $resource, $scope, $state, $http, UserService) {
  3 + $scope.hi = "hi";
  4 + $rootScope.SectionResource = $resource('/api/sections/:sectionId/');
  5 + $rootScope.currentSection = {};
  6 + $rootScope.UserService = UserService;
  7 +
  8 + $scope.dropClass = function(section) {
  9 + $http.post('/api/sections/' + section.id + '/drop/').
  10 + success(function(data) {
  11 + console.log(section.short_name + ' dropped');
  12 +
  13 + Materialize.toast('Dropped', 3000, 'rounded');
  14 + }).
  15 + error(function(err) {
  16 + console.log('no drop for you');
  17 + });
  18 + };
  19 +
  20 + });
templates/cardlist.html View file @ 331ca39
... ... @@ -58,7 +58,7 @@
58 58 </form>
59 59 </div>
60 60  
61   - <div class="list" style="padding: 0px 15px">
  61 + <div class="list" style="padding: 0px 25px">
62 62 <ul class="collection"
63 63 ng-repeat="(weeknum, week_cards) in cards | filter:searchText | filter:filterByDate | groupBy: 'material_week_num'">
64 64 <li class="collection-header"><h3>Week {{weeknum}}</h3></li>
templates/dropclass.html View file @ 331ca39
  1 +<div class="card" id="dropClassForm">
  2 +
  3 + <h2>Enrolled Classes</h2>
  4 +
  5 + <table class="stiped hoverable">
  6 + <thead>
  7 + <tr>
  8 + <th data-field="id">Name</th>
  9 + <th data-field="price">Drop?</th>
  10 + </tr>
  11 + </thead>
  12 +
  13 + <tbody>
  14 + <tr ng-repeat="section in UserService.getUserData().sections">
  15 + <td>
  16 + <span>{{section.short_name}}</span>
  17 + <p>{{section.long_name}}</p>
  18 + </td>
  19 + <td><a href="" ng-click="dropClass(section)"><i class="mdi-content-clear"></i></a></td>
  20 + </tr>
  21 + </tbody>
  22 + </table>
  23 +</div>