Commit 2571f3b8c7f162e16dac7e2c11f41f1e2284bf29

Authored by Rachel Lee
1 parent ecbd57876c

Started study but getting stuck help

Showing 3 changed files with 88 additions and 16 deletions Side-by-side Diff

scripts/StudyController.js View file @ 2571f3b
1 1 angular.module('flashy.StudyController', ['ui.router']).
2 2  
3   -controller('StudyController', ['$scope', '$stateParams', '$state', '$http',
4   - function($scope, $stateParams, $state, $http) {
  3 +controller('StudyController', ['$scope', '$stateParams', '$state', '$http', 'UserService',
  4 + function($scope, $stateParams, $state, $http, UserService) {
5 5 console.log('Flashy study controller content in this file. also hell0');
6 6 sectionId = $stateParams.sectionId;
  7 +
  8 + $(document).ready(function() {
  9 + $('.datepicker').pickadate({
  10 + selectMonths: true, // Creates a dropdown to control month
  11 + selectYears: 15 // Creates a dropdown of 15 years to control year
  12 + });
  13 + });
  14 +
  15 + $scope.UserService = UserService;
  16 +
  17 + console.log($scope.UserService.getUserData().sections);
  18 +
  19 + $scope.toggleSectionToStudy = function(id) {
  20 + console.log('toggle sect', id);
  21 + $scope.sectionToStudy = id;
  22 + };
  23 +
  24 +/*
  25 + $scope.fetchQuiz = function() {
  26 + console.log('fetching quiz...');
  27 + var studyRequest = {
  28 + 'sections': ($scope.sectionToStudy == null) ? [] : [$scope.sectionToStudy],
  29 + 'material_date_begin':,
  30 + 'material_date_end':
  31 + };
  32 +
  33 +// $http.post('/api/study/', studyRequest).
  34 +//TODO
  35 + };
  36 + */
7 37  
8 38 // Flashcard content
9 39 $scope.htmlContent = 'sample text here longwordddddddddddddddddddddddddddd hello there from js review ctrl alwkejflakewjflk awjkefjkwefjlkea jfkewjaweajkakwef jk fjeawkafj kaewjf jawekfj akwejfk ';
styles/flashy.css View file @ 2571f3b
... ... @@ -224,7 +224,6 @@
224 224 font-family: 'Titillium Web', sans-serif;
225 225 height: 100%;
226 226 }
227   -
228 227 html {
229 228 background: transparent;
230 229 height: 100%;
... ... @@ -244,6 +243,11 @@
244 243  
245 244 .btn-floating:hover {
246 245 background-color: #0097cb;
  246 +}
  247 +
  248 +.toggley {
  249 + float: left;
  250 + margin: 10px;
247 251 }
248 252  
249 253 #logo-container {
templates/study.html View file @ 2571f3b
1   - <div class="row">
2   - <div class="col s6 offset-s3">
3   - <div class="card">
4   - <div class="card-content">
5   - <span ng-repeat="display in displayText">{{display}}<input ng-model="blank[displayText.indexOf(display)]" ng-show="displayText.indexOf(display) < blankText.length" class="" type="text"/></span>
6   - </div>
7   - <div class="card-action">
8   - <button class="btn waves-effect waves-light" type="submit" ng-click="checkAnswer()" style="position: relative">Check
9   - <i class="mdi-content-send right"></i>
10   - </button>
11   - </div>
12   - </div>
13   - </div>
  1 +<!-- Parameters for the studying -->
  2 +<div class="row">
  3 + <div class="col s6 offset-s3">
  4 + <h3>Choose what to study</h3>
  5 + <!-- lots of difficulty with materializecss select and angularjs. If we want to
  6 + refactor into a select(which prob looks better), maybe refer to this article:
  7 + http://stackoverflow.com/questions/29402495/values-not-showing-up-in-select-button
  8 + -->
  9 + <!-- Also suffered huge casualties trying to do radios...let's just do buttons...
  10 + -->
  11 + <a class="waves-effect waves-light btn toggley"
  12 + ng-init="sectionToStudy = null"
  13 + ng-click="toggleSectionToStudy(null)"
  14 + ng-class="{'pink white-text': sectionToStudy == null}">
  15 + All classes</a>
  16 + <div ng-repeat="section in UserService.getUserData().sections">
  17 + <a class="waves-effect waves-light btn toggley"
  18 + ng-click="toggleSectionToStudy(section.id)"
  19 + ng-class="{'pink white-text': sectionToStudy == section.id}">
  20 + {{section.short_name}}</a>
  21 + </div>
  22 +
  23 + <input type="date" class="datepicker">
  24 + </div>
  25 +</div>
  26 +
  27 +<div class="row">
  28 + <div class="col s6 offset-s3">
  29 + <div class="card-action">
  30 + <button class="btn waves-effect waves-light" ng-click="fetchQuiz()">
  31 + Fetch!
  32 + <i class="mdi-content-send right"></i>
  33 + </button>
  34 + </div>
  35 + </div>
  36 +</div>
  37 +
  38 +<!-- Fetched card "quiz" -->
  39 +<div class="row">
  40 + <div class="col s6 offset-s3">
  41 + <div class="card">
  42 + <div class="card-content">
  43 + <span ng-repeat="display in displayText">{{display}}<input ng-model="blank[displayText.indexOf(display)]" ng-show="displayText.indexOf(display) < blankText.length" class="" type="text"/></span>
14 44 </div>
  45 + <div class="card-action">
  46 + <button class="btn waves-effect waves-light" type="submit" ng-click="checkAnswer()" style="position: relative">Check
  47 + <i class="mdi-content-send right"></i>
  48 + </button>
  49 + </div>
  50 + </div>
  51 + </div>
  52 +</div>