Commit 45a1bef4979d11d04146104a3d0b1b39634755e4

Authored by Andrew Buss

merge

Showing 3 changed files Side-by-side Diff

... ... @@ -80,16 +80,16 @@
80 80 <!-- Slide-in side-nav for small screens -->
81 81 <ul ng-show="UserService.isLoggedIn()" class="side-nav" id="mobile-demo">
82 82 <span ng-show="currentSection.id">
83   - <li ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})" class="tooltipped">
  83 + <li ui-sref-active="active"><a ui-sref="feed({sectionId:currentSection.id})">
84 84 <i class="mdi-action-view-module left"></i>
85 85 Feed</a>
86 86 </li>
87   - <li ui-sref-active="active"><a ui-sref="deck({sectionId:currentSection.id})" class="tooltipped">
  87 + <li ui-sref-active="active"><a ui-sref="deck({sectionId:currentSection.id})">
88 88 <i class="mdi-action-view-carousel left"> </i>
89 89 Deck
90 90 </a>
91 91 </li>
92   - <li ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})" class="tooltipped">
  92 + <li ui-sref-active="active"><a ui-sref="cardlist({sectionId:currentSection.id})">
93 93 <i class="mdi-action-view-list left"></i>
94 94 Card List
95 95 </a>
scripts/StudyController.js View file @ 45a1bef
... ... @@ -29,24 +29,39 @@
29 29 $scope.isParamOpen = !$scope.isParamOpen;
30 30 };
31 31  
  32 + $scope.toggleContent = function(event, index) {
  33 + if ($('#content-x').hasClass('open')) { // let's close it
  34 + // Note: 250 is duration (ms) of animation
  35 + $('#content-x').slideUp(250).removeClass('open');
  36 + } else { // let's open it
  37 + $('#content-x').slideDown(250).addClass('open');
  38 + }
  39 + };
  40 +
  41 +
  42 + /*
32 43 $scope.fetchQuiz = function(a, b) {
33 44 //console.log($scope.startDate, $scope.endDate);
34 45 console.log(a, b);
  46 + console.log($('#start-date').val());
35 47 };
  48 + */
36 49  
37   -/*
38 50 $scope.fetchQuiz = function() {
39 51 console.log('fetching quiz...');
40 52 var studyRequest = {
41   - 'sections': ($scope.sectionToStudy == null) ? [] : [$scope.sectionToStudy],
42   - 'material_date_begin':,
43   - 'material_date_end':
  53 + 'sections': ($scope.sectionToStudy == null) ? [] : [$scope.sectionToStudy]
44 54 };
  55 + console.log('enddate:', $('#end-date').val() + 'T00:00:00Z');
  56 + console.log('study sect', $scope.sectionToStudy);
45 57  
46   -// $http.post('/api/study/', studyRequest).
47   -//TODO
  58 +
  59 + $http.post('/api/study/', studyRequest).
  60 + success(function(data) {
  61 + console.log('Fetched card:', data);
  62 + }).error(function(err) {
  63 + });
48 64 };
49   - */
50 65  
51 66 /* OLD STUFF :in case you still neeed it */
52 67 // Flashcard content
templates/study.html View file @ 45a1bef
1   -<!-- Parameters for the studying -->
2   -
3   -<div class="collapsible-header param-header"
4   - ng-click="openParams()">
5   -<i class="mdi-image-filter-drama"></i>Choose study settings</div>
6   -
7   -<div class="study-params dropping" ng-show="isParamOpen">
8   - <div class="row">
9   - <h3>Choose what to study</h3>
  1 +<div class="container">
  2 + <ul class="collection st-accordion">
  3 + <li class="st-accordion--item">
  4 + <div class="st-accordion--header" ng-click="toggleContent($event, $index)">
  5 + <i class="mdi-image-filter-drama"></i>
  6 + Choose what to study
  7 + </div>
  8 + <div id="content-x" class="st-accordion--content">
10 9 <!-- lots of difficulty with materializecss select and angularjs. If we want to
11 10 refactor into a select(which prob looks better), maybe refer to this article:
12 11 http://stackoverflow.com/questions/29402495/values-not-showing-up-in-select-button
13 12 -->
14 13 <!-- Also suffered huge casualties trying to do radios...let's just do buttons...
15 14 -->
16   - <a class="waves-effect waves-light btn toggley"
17   - ng-init="sectionToStudy = null"
18   - ng-click="toggleSectionToStudy(null)"
19   - ng-class="{'pink white-text': sectionToStudy == null}">
20   - All classes</a>
21   - <div ng-repeat="section in UserService.getUserData().sections">
  15 + <!-- Default: all classes button -->
  16 + <!-- Button for classes -->
  17 + <div class="card">
  18 + <!-- Default: all classes button -->
22 19 <a class="waves-effect waves-light btn toggley"
23   - ng-click="toggleSectionToStudy(section.id)"
24   - ng-class="{'pink white-text': sectionToStudy == section.id}">
25   - {{section.short_name}}
26   - </a>
27   - </div>
  20 + ng-init="sectionToStudy = null"
  21 + ng-click="toggleSectionToStudy(null)"
  22 + ng-class="{'pink white-text': sectionToStudy == null}">
  23 + All classes</a>
28 24  
29   -<!--
30   - <div class="input-field col s12">
31   - <select ng-model="selectedClass"
32   - ng-options="section.short_name for section in UserService.getUserData().sections">
33   - </select>
34   - <label>Materialize Select</label>
  25 + <!-- Buttons of rest of classes -->
  26 + <div ng-repeat="section in UserService.getUserData().sections">
  27 + <a class="waves-effect waves-light btn toggley"
  28 + ng-click="toggleSectionToStudy(section.id)"
  29 + ng-class="{'pink white-text': sectionToStudy == section.id}">
  30 + {{section.short_name}}
  31 + </a>
  32 + </div>
  33 + </div> <!-- end of buttons for classes -->
  34 + <div class="row">
  35 + <div class="card">
  36 + <h3>Choose Date</h3>
  37 + <input id="start-date" type="date" class="" ng-model="startDate" placeholder="Start Date"/>
  38 + <input id="end-date" type="date" class="" ng-model"endDate" placeholder="End Date"/>
  39 + </div>
35 40 </div>
36   - -->
37   - </div>
38 41  
39   - <div class="row">
40   - <div class="card">
41   - <h3>Choose Date</h3>
42   - <input type="date" class="datepicker" ng-model="startDate" placeholder="Start Date"/>
43   - <input type="date" class="datepicker" ng-model"endDate" placeholder="End Date"/>
44   - </div>
45   - </div>
  42 + </div> <!-- end of #content-x -->
  43 + </li>
  44 + </ul>
46 45  
47 46 <div class="row">
48 47 <div class="card-action">
... ... @@ -52,7 +51,6 @@
52 51 </button>
53 52 </div>
54 53 </div>
55   -</div>
56 54  
57 55  
58 56 <!-- Fetched card "quiz" -->
... ... @@ -68,4 +66,5 @@
68 66 </div>
69 67 </div>
70 68 </div>
  69 +</div> <!-- End of .container-->