diff --git a/scripts/StudyController.js b/scripts/StudyController.js
index ed38005..98a7e27 100644
--- a/scripts/StudyController.js
+++ b/scripts/StudyController.js
@@ -1,24 +1,41 @@
angular.module('flashy.StudyController', ['ui.router']).
-controller('StudyController', ['$scope', '$state',
- function($scope, $state) {
+controller('StudyController', ['$scope', '$stateParams', '$state', '$http',
+ function($scope, $stateParams, $state, $http) {
console.log('Flashy study controller content in this file. also hell0');
+ sectionId = $stateParams.sectionId;
// Flashcard content
$scope.htmlContent = 'sample text here longwordddddddddddddddddddddddddddd hello there from js review ctrl alwkejflakewjflk awjkefjkwefjlkea jfkewjaweajkakwef jk fjeawkafj kaewjf jawekfj akwejfk ';
- $scope.samples = [
+ //single card
+ $scope.samples =
{
'name': 'lol',
- 'desc': 'sample text here 111111'
- },
- {
- 'name': 'lol 2',
- 'desc': 'sample text here 22222222222222'
- },
- {
- 'name': 'lol3',
- 'desc': 'sample text here 33333333333333'
- }
- ];
+ 'text': 'sample text here 111111 woo hoo I think it works',
+ 'mask': [[0,6],[16,23]]
+ };
+
+ // get text to display as array
+ $scope.displayText = [];
+ // get answers to blanks as array
+ $scope.blankText = [];
+ var start = 0; // where to start next string break
+ for (var i = 0; i < $scope.samples.mask.length; i++) {
+ $scope.displayText.push($scope.samples.text.substring(start, $scope.samples.mask[i][0]));
+ $scope.blankText.push($scope.samples.text.substring($scope.samples.mask[i][0], $scope.samples.mask[i][1]));
+ start = $scope.samples.mask[i][1];
+ }
+ if (start != $scope.samples.mask.length-1)
+ $scope.displayText.push($scope.samples.text.substring(start));
+
+ // user entered responses as array
+ $scope.blank = [];
+ $scope.checkAnswer = function() {
+ console.log('check!');
+ for (var i = 0; i < $scope.blank.length; i++)
+ console.log($scope.blank[i]);
+ console.log('actual: ' + $scope.blankText);
+ $scope.blank = '';
+ };
}
]);
diff --git a/templates/study.html b/templates/study.html
index dc2d6a4..c1e2256 100644
--- a/templates/study.html
+++ b/templates/study.html
@@ -1,9 +1,14 @@
-Hello
-1. Get card from server.
-2. Show card
-3. Inputs
-4. Compare answers
-5. User decides for correct/incorrect
-