Commit 4b3a4117493537bfecb252ce1d7e66863edbe1f7

Authored by Andrew Buss

Merge branch 'master' of git.ucsd.edu:110swag/flashy-frontend

Showing 6 changed files Side-by-side Diff

... ... @@ -4,6 +4,7 @@
4 4 'flashy.FeedController',
5 5 'flashy.DeckController',
6 6 'flashy.ClassAddController',
  7 + 'flashy.ClassDropController',
7 8 'flashy.RequestResetController',
8 9 'flashy.StudyController',
9 10 'flashy.UserService',
... ... @@ -104,6 +105,12 @@
104 105 url: '/addclass',
105 106 templateUrl: 'templates/addclass.html',
106 107 controller: 'ClassAddController'
  108 + }).
  109 + state('dropclass', {
  110 + resolve: auth_resolve,
  111 + url: '/settings/dropclass',
  112 + templateUrl: 'templates/dropclass.html',
  113 + controller: 'ClassDropController'
107 114 }).
108 115 state('deck', {
109 116 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 @ 4b3a411
... ... @@ -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 @ 4b3a411
  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 @ 4b3a411
... ... @@ -2,7 +2,7 @@
2 2 <div class="row">
3 3 <a class="btn" id="showHidden" ng-click="show = !show" style="margin-top: 15px">Show Hidden</a>
4 4  
5   - <div class="input-field col s4 right">
  5 + <div class="input-field col s6 right">
6 6 <i class="mdi-action-search prefix"></i>
7 7 <input id="search" type="text" class="validate" ng-model="searchText"/>
8 8 <label for="search">Search</label>
... ... @@ -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 @ 4b3a411
  1 +<div class="row">
  2 + <div class="col s8 offset-s2">
  3 + <div class="card-panel" id="dropClassForm">
  4 +
  5 + <h2>Enrolled Classes</h2>
  6 + <div class="row" style="padding: 0px 25px">
  7 + <table class="hoverable responsive-table">
  8 + <thead>
  9 + <tr>
  10 + <th data-field="id">Class</th>
  11 + <th data-field="drop">Drop?</th>
  12 + </tr>
  13 + </thead>
  14 +
  15 + <tbody>
  16 + <tr ng-repeat="section in UserService.getUserData().sections">
  17 + <td>
  18 + <span>{{section.short_name}}</span>
  19 + <p>{{section.long_name}}</p>
  20 + </td>
  21 + <td><a href="" ng-click="dropClass(section)"><i class="mdi-content-clear small"></i></a></td>
  22 + </tr>
  23 + </tbody>
  24 + </table>
  25 + </div>
  26 + </div>
  27 + </div>
  28 +</div>