Skip to content

Commit

Permalink
Merge pull request #40 from ucfopen/dev/1.3.0
Browse files Browse the repository at this point in the history
Dev/1.3.0
  • Loading branch information
clpetersonucf authored Apr 24, 2024
2 parents 8435014 + 0e4804c commit a8aaf19
Show file tree
Hide file tree
Showing 16 changed files with 5,803 additions and 6,278 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
node-version: [18.13.0]

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Test and build with node ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -31,5 +31,5 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/_output/*
tag: ${{ github.ref }}
overwrite: false
overwrite: true
file_glob: true
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.3.1, 12.x]
node-version: [18.13.0]

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Run tests with Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install -g yarn
Expand Down
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@
},
"version": "1.2.0",
"scripts": {
"start": "webpack-dev-server",
"build": "webpack -p",
"build-dev": "webpack",
"start": "mwdk-start",
"build": "mwdk-build-prod",
"build-dev": "mwdk-build-dev",
"test": "echo 'tests not implemented'",
"test-ci": "echo 'tests not implemented'"
},
"devDependencies": {
"materia-widget-development-kit": "2.5.2"
"materia-widget-development-kit": "~3.0.0"
},
"dependencies": {
"@babel/preset-react": "^7.16.0",
"createjs": "1.0.0",
"hammerjs": "1.0.5",
"modernizr-webpack-plugin": "^1.0.7",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"hammerjs": "1.0.5"
},
"license": "AGPL-3.0",
"description": "Guess the Phrase is a guessing game played by guessing letters in a word using the provided clues.",
Expand Down
3 changes: 0 additions & 3 deletions src/_score/score_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ class Score_Modules_Hangman extends Score_Module

public function check_answer($log)
{
// get qset once for options
if (empty($this->inst->qset)) $this->inst->get_qset($this->inst->id);

$wrong_limit = $this->inst->qset->data['options']['attempts'];
$is_partial = $this->inst->qset->data['options']['partial'];

Expand Down
1 change: 1 addition & 0 deletions src/assets/img/materia-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/materialogo.png
Binary file not shown.
21 changes: 17 additions & 4 deletions src/creator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Hangman.directive('focusMe', ['$timeout', '$parse', ($timeout, $parse) ->
])

Hangman.factory 'Resource', ['$sanitize', ($sanitize) ->
buildQset: (title, items, partial, attempts, random) ->
buildQset: (title, items, partial, attempts, random, enableQuestionBank, questionBankVal) ->
qsetItems = []
qset = {}

Expand All @@ -47,7 +47,7 @@ Hangman.factory 'Resource', ['$sanitize', ($sanitize) ->
Materia.CreatorCore.cancelSave 'Word #'+(i+1)+' needs to contain at least one letter or number.'
return false

qset.options = {partial: partial, attempts: attempts, random: random}
qset.options = {partial: partial, attempts: attempts, random: random, enableQuestionBank: enableQuestionBank, questionBankVal: questionBankVal}
qset.assets = []
qset.rand = false
qset.name = title
Expand Down Expand Up @@ -97,6 +97,10 @@ Hangman.controller 'HangmanCreatorCtrl', ['$timeout', '$scope', '$sanitize', 'Re
$scope.partial = false
$scope.random = false
$scope.attempts = 5
$scope.questionBankModal = false
$scope.enableQuestionBank = false
$scope.questionBankVal = 1
$scope.questionBankValTemp = 1

# for use with paginating results
$scope.currentPage = 0;
Expand Down Expand Up @@ -191,7 +195,12 @@ Hangman.controller 'HangmanCreatorCtrl', ['$timeout', '$scope', '$sanitize', 'Re
$scope.hideCover()

$scope.hideCover = ->
$scope.showTitleDialog = $scope.showIntroDialog = false
$scope.showTitleDialog = $scope.showIntroDialog = $scope.questionBankModal = false
$scope.questionBankValTemp = $scope.questionBankVal

$scope.validateQuestionBankVal = ->
if ($scope.questionBankValTemp >= 1 && $scope.questionBankValTemp <= $scope.items.length)
$scope.questionBankVal = $scope.questionBankValTemp

$scope.initNewWidget = (widget, baseUrl) ->
$scope.$apply ->
Expand All @@ -202,12 +211,16 @@ Hangman.controller 'HangmanCreatorCtrl', ['$timeout', '$scope', '$sanitize', 'Re
$scope.attempts = ~~qset.options.attempts or 5
$scope.partial = qset.options.partial
$scope.random = qset.options.random
$scope.enableQuestionBank = if qset.options.enableQuestionBank then qset.options.enableQuestionBank else false
$scope.questionBankVal = if qset.options.questionBankVal then qset.options.questionBankVal else 1
$scope.questionBankValTemp = if qset.options.questionBankVal then qset.options.questionBankVal else 1

$scope.onQuestionImportComplete qset.items[0].items

$scope.$apply()

$scope.onSaveClicked = (mode = 'save') ->
qset = Resource.buildQset $sanitize($scope.title), $scope.items, $scope.partial, $scope.attempts, $scope.random
qset = Resource.buildQset $sanitize($scope.title), $scope.items, $scope.partial, $scope.attempts, $scope.random, $scope.enableQuestionBank, $scope.questionBankVal
if qset then Materia.CreatorCore.save $sanitize($scope.title), qset

$scope.onSaveComplete = (title, widget, qset, version) -> true
Expand Down
82 changes: 62 additions & 20 deletions src/creator.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
<script src="materia.creatorcore.js"></script>

<!-- YOUR PREREQUISITES -->
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular-animate.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular-sanitize.min.js"></script>
<script src="assets/lib/hammer.min.js" data-embed="false"></script>
<script src="assets/lib/angular-hammer.min.js" data-embed="false"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.8.3/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-animate/1.8.3/angular-animate.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-sanitize/1.8.3/angular-sanitize.min.js"></script>
<script src="assets/lib/hammer.min.js"></script>

<!-- MAIN CREATOR SCRIPT -->
<script src="creator.js"></script>
Expand Down Expand Up @@ -52,25 +51,43 @@ <h1 id="title" ng-bind="title" ng-click="showTitleDialog = true"></h1>
</span>
<div class="random partial">
<p>Randomize Order</p>
<input type="checkbox" id="randomize" ng-model="random">
<label for="randomize" class="checktoggle"></label>
<input type="checkbox" ng-checked=enableQuestionBank ng-disabled=enableQuestionBank id="randomize" ng-model="random">
<label for="randomize" ng-class="{'disabled-look': enableQuestionBank}" class="checktoggle"></label>
<div class="question-tip randomizer-tip">?
<div class="qtip-box">
<p>
If <b>Question Bank</b> is on then the check to randomize order is disabled. This is because the question bank
randomizes the question order already.
</p>
</div>
</div>
</div>

<div class="partial">
<p>Partial scoring</p>
<input type="checkbox" id="partial" ng-model="partial">
<label for="partial" class="checktoggle"></label>
</div>
<div class="question-tip">?
<div class="qtip-box">
<p>
If <b>partial scoring</b> is on then students will receive credit equal to the percentage of the phrase they reveal.
When off students will receive a 100% if they guess the phrase correctly and a 0% otherwise.
</p>
<p>
If the student doesn't reveal the phrase after the number of allowed <b>incorrect guesses</b> they move on to the next phrase.
</p>
<div class="question-tip">?
<div class="qtip-box">
<p>
If <b>partial scoring</b> is on then students will receive credit equal to the percentage of the phrase they reveal.
When off students will receive a 100% if they guess the phrase correctly and a 0% otherwise.
</p>
<p>
If the student doesn't reveal the phrase after the number of allowed <b>incorrect guesses</b> they move on to the next phrase.
</p>
</div>
</div>
</div>

<button
class="qb-button"
ng-class= "{'gray-out': !enableQuestionBank}"
ng-click="questionBankModal = !questionBankModal"
ng-disabled="items.length === 0">
Question Bank: {{enableQuestionBank === true ? "ON" : "OFF"}}
</button>

<div class="bottom"></div>
</div>
<div class="pagination" ng-show="numberOfPages() > 1">
Expand Down Expand Up @@ -169,11 +186,10 @@ <h3>Phrase</h3>
<span>{{currentPage+1}}/{{numberOfPages()}}</span>
<button ng-disabled="currentPage >= numberOfPages() - 1" ng-click="currentPage=currentPage+1">Next</button>
</div>

<div ng-show="!items.length &amp;&amp; step" class="arrow-box">
<div ng-show="!items.length" class="arrow-box">
<span>Click here to add your first question</span>
</div>
<div id="backgroundcover" ng-click="hideCover()" ng-class="{ show: showTitleDialog || showIntroDialog }"></div>
<div id="backgroundcover" ng-click="hideCover()" ng-class="{ show: showTitleDialog || showIntroDialog || questionBankModal }"></div>
<div ng-class="{ show: showIntroDialog }" class="box intro">
<img src="assets/creator_example.png">
<h1>Guess the Phrase</h1>
Expand All @@ -189,5 +205,31 @@ <h1>Guess the Phrase</h1>
<input type="text" placeholder="My Guess the Phrase widget" ng-model="title" focus-me="showTitleDialog" ng-enter="hideCover()">
<input type="button" value="Done" ng-click="hideCover()">
</div>
<div ng-class="{ show: questionBankModal }" ng-click= 'hideCover()' class="box question-bank-dialog">
<h1>Question Bank</h1>
<p>When the question bank is enabled, the widget can use a subset of phrases to create a randomized and unique experience every time the student hits play.</p>
<div class="enable-qb-question">
<label style="font-weight: bold;">Enable question bank? </label>
<div class="enable-qb-options" ng-click="$event.stopPropagation()">
<span>
<input type="radio" ng-model="enableQuestionBank" ng-value=false> No</input>
<input type="radio" ng-model="enableQuestionBank" ng-change="questionBankValTemp = questionBankVal = items.length" ng-value=true> Yes</input>
</span>
</div>
</div>
<div>
<span ng-show="enableQuestionBank" >
<label style="font-weight: bold;">How many phrases per play? </label>
<div class="num-input-wrapper" ng-click="$event.stopPropagation()">
<input class="num-input" type="number" ng-model="questionBankValTemp" ng-change="validateQuestionBankVal()" step="1">
<span> out of {{items.length}} </span>
</div>
</span>
</div>
<button class="dialog-close-button"
ng-click="questionBankModal = false"
ng-disabled="questionBankValTemp < 1 || questionBankValTemp > items.length">Confirm</button>
</div>

</body>
</html>
Loading

0 comments on commit a8aaf19

Please sign in to comment.