-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added dependencies angular boostrap jquery
- Loading branch information
wgermaine
committed
Jan 23, 2017
1 parent
c72307d
commit 907feaf
Showing
9 changed files
with
559 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[{ | ||
"qid": 123, // question id - cannot be repeated | ||
"qtype": "matchAns", // either: "oneAns", "typedAns", "matchAns", "dragOneAns", "None" | ||
"qpicture1": "/link", // picture that matches to picture2 | ||
"qpicture2": "/link", // picture that matches to picture1 | ||
"qtext1": "Text of Picture 1", // picture1 text | ||
"qtext2": "Text of Picture 2", // picture 2 text | ||
// "corrAnsWiki": "Synopsis of wikipedia page", /// possible implementation | ||
"corrAnsDesc": "Description of the answer", // elaboration of ans | ||
}, | ||
{ | ||
"qid": 123, // question id - cannot be repeated | ||
"qtype": "matchAns", // either: "oneAns", "typedAns", "matchAns", "dragOneAns", "None" | ||
"qpicture1": "/link", // picture that matches to picture2 | ||
"qpicture2": "/link", // picture that matches to picture1 | ||
"qtext1": "Text of Picture 1", // picture1 text | ||
"qtext2": "Text of Picture 2", // picture 2 text | ||
// "corrAnsWiki": "Synopsis of wikipedia page", /// possible implementation | ||
"corrAnsDesc": "Description of the answer", // elaboration of ans | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[{ | ||
"qid": 0, // question id - cannot be repeated | ||
"question":"How do you say 'name' in English?", // required | ||
"qpicture": "/link/image.jpg", // optional img to go along w question | ||
"qtype": "oneAns", // either: "oneAns", "typedAns", "matchAns", "dragOneAns", "None" | ||
"corrAnswer":["Nama", ""], // correct answer - may have alternate answer | ||
// "corrAnsWiki": "Synopsis of wikipedia page", /// possible implementation | ||
"corrAnsDesc": "Description of the answer", // elaboration of ans | ||
"othAnswer1": "Ans1", // other incorrect answers | ||
"othAnswer2": "Ans2", | ||
"othAnswer3": "Ans3" | ||
}, | ||
{ | ||
"qid": 1, // question id - cannot be repeated | ||
"question":"How do you say 'name' in English?", // required | ||
"qpicture": "/link/image.jpg", // optional img to go along w question | ||
"qtype": "oneAns", // either: "oneAns", "typedAns", "matchAns", "dragOneAns", "None" | ||
"corrAnswer":["Nama", ""], // correct answer - may have alternate answer | ||
// "corrAnsWiki": "Synopsis of wikipedia page", /// possible implementation | ||
"corrAnsDesc": "Description of the answer", // elaboration of ans | ||
"othAnswer1": "Ans1", // other incorrect answers | ||
"othAnswer2": "Ans2", | ||
"othAnswer3": "Ans3" | ||
} | ||
] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html lang="id" data-ng-app="quizApp"> | ||
<head> | ||
<title></title> | ||
<meta charset="utf-8" /> | ||
|
||
<!-- Bootstrap --> | ||
<link href="css/bootstrap.min.css" rel="stylesheet" /> | ||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 | ||
elements and media queries --> | ||
<!-- WARNING: Respond.js doesn't work if you view the | ||
page via file:// --> | ||
<!--[if lt IE 9]> | ||
<script src="js/html5shiv.js"></script> | ||
<script src="js/respond.min.js"></script> | ||
<![endif]--> | ||
</head> | ||
<body> | ||
<section id="matchAns" | ||
data-ng-app="matchAnsApp"> | ||
</section> | ||
<section id="typedAns" | ||
data-ng-app="typedAnsApp"> | ||
</section> | ||
<section id="oneAns" | ||
data-ng-app="oneAnsApp"> | ||
</section> | ||
<section id="dragOneAns" | ||
data-ng-app="dragOneAnsApp"> | ||
</section> | ||
|
||
<section id="resultsPage" | ||
data-ng-app="resultsApp"> | ||
|
||
</section> | ||
|
||
<!-- jQuery - required for Bootstrap's JavaScript plugins) --> | ||
<script src="js/jquery.min.js"></script> | ||
<!-- All Bootstrap plug-ins file --> | ||
<script src="js/bootstrap.min.js"></script> | ||
<!–- Basic AngularJS --> | ||
<script src="js/angular.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
var app = angular.module("quizApp"); | ||
|
||
app.controller("typedAnsCtrl", function($scope, http) { | ||
$scope.displayQuestion = function() {}; | ||
$scope. | ||
}) | ||
|
||
|
||
// redirect to Cate page | ||
$scope.redirectCate = function(index) | ||
{ | ||
$scope.cateIndex = index; | ||
$scope.homeShow = false; | ||
$scope.cateShow = true; | ||
$scope.cardShow = false; | ||
} | ||
}); | ||
|
||
|
||
// category ctrl | ||
app.controller("cateCtrl", function ($scope) | ||
{ | ||
// make new category | ||
$scope.addCate = function() | ||
{ | ||
$scope.category.push($scope.newCat); | ||
$scope.newCat = null; | ||
} | ||
|
||
// update category | ||
$scope.updateCate = function(cate, cateIndex) | ||
{ | ||
$scope.category[cateIndex] = cate; | ||
} | ||
|
||
// delete category | ||
$scope.delCate = function(cateIndex) | ||
{ | ||
$scope.category.splice(cateIndex, 1); | ||
} | ||
}); | ||
|
||
// card ctrl | ||
app.controller("cardCtrl", function($scope, $http) { | ||
// make new card in category | ||
$scope.addCard = function() | ||
{ | ||
$scope.category[$scope.cateIndex].cards.push($scope.newCard); | ||
$scope.newCard = null; | ||
} | ||
|
||
// updates card | ||
$scope.updateCard = function(aCard, cardIndex) { | ||
$scope.category[$scope.cateIndex].cards[cardIndex] = aCard; | ||
} | ||
|
||
// delete card | ||
$scope.delCard = function(cardIndex) | ||
{ | ||
$scope.category[$scope.cateIndex].cards.splice(cardIndex, 1); | ||
} | ||
|
||
// shuffle cards | ||
$scope.shuffleCards = function() | ||
{ | ||
$scope.generated = []; | ||
$scope.currentIndex = $scope.category[$scope.cateIndex].cards.length; | ||
$scope.cindex = $scope.category[$scope.cateIndex].cards.length; | ||
|
||
while ($scope.cindex >= 1) { | ||
$scope.randIndex = Math.floor(Math.random() * $scope.currentIndex); // add 1 for 1-4 | ||
if($scope.generated.includes($scope.category[$scope.cateIndex].cards[$scope.randIndex]) == false) { | ||
$scope.generated.push($scope.category[$scope.cateIndex].cards[$scope.randIndex]); | ||
$scope.cindex -= 1; | ||
} | ||
} | ||
$scope.category[$scope.cateIndex].cards = $scope.generated; | ||
} | ||
}); | ||
|
||
app.controller("cardTestCtrl", function($scope, $http, $q) { | ||
$scope.cardsRemembered = []; | ||
$scope.iteration = 0; | ||
var cardsIndex = 0; | ||
|
||
var url = "data/cards.json"; | ||
$http.get(url).then( | ||
function(response) { | ||
$scope.cardsNotRemembered = response.data; | ||
}, | ||
function(response) { | ||
// error handling routine | ||
}); | ||
|
||
var index = cardsIndex; | ||
|
||
$scope.changeCardStatus = function(answer) { | ||
$scope.cardDescShow = false; | ||
$scope.iteration += 1; | ||
|
||
if ($scope.cardsNotRemembered[$scope.cateIndex].cards.length > 0) { | ||
|
||
if(answer == 'yes') { | ||
|
||
if ($scope.cardsNotRemembered[$scope.cateIndex].cards.length != 0) { | ||
$scope.cardsRemembered.push($scope.cardsNotRemembered[$scope.cateIndex].cards[index]); | ||
|
||
$scope.cardsNotRemembered[$scope.cateIndex].cards.splice(index, 1); | ||
} | ||
} | ||
|
||
$scope.currentCardShow = $scope.cardsNotRemembered[$scope.cateIndex].cards[index]; | ||
} | ||
|
||
// #to_implement Make completed thing a bit final | ||
if ($scope.cardsNotRemembered[$scope.cateIndex].cards.length == 0) { | ||
$scope.finalCardShow = true; | ||
} | ||
} | ||
}); |
Oops, something went wrong.