Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/1.3.0 #40

Merged
merged 22 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
594bc1c
Removes unnecessary call to get_qset from score_module and references…
cayb0rg Feb 21, 2023
3d55741
Removes comment
cayb0rg Feb 21, 2023
5614186
Added question bank functionality to creator and player side
dmols Dec 12, 2023
a58620a
Polished the functionality and added styling
dmols Dec 12, 2023
a0166e7
Replaced question dialog function calls with ng-click attributes
dmols Dec 14, 2023
4cef684
WIP: making enableQuestionBank initially false
dmols Dec 14, 2023
3c98421
Fixed questionBankVal initial value and added input safeguards
dmols Dec 14, 2023
d28bfc9
Removed break statements and added visual padding in the dialog
dmols Dec 15, 2023
088a39d
Added lots of css changes to dialog and changed functionality
dmols Feb 13, 2024
ff0c079
visual improvements for the dialog and semantic html changes
dmols Feb 13, 2024
1d8e362
Minor css changes
dmols Feb 13, 2024
4bf05a0
Added tooltip for QB functionality and tweaked some css
dmols Feb 27, 2024
0cc8a47
Comprehensive update to MWDK 3.x
clpetersonucf Apr 19, 2024
beb9ba0
Removes unnecessary dependencies. Updates hard-coded angularjs import…
clpetersonucf Apr 19, 2024
a66d6cb
Merge pull request #38 from clpetersonucf/feature/mwdk-upgrade
clpetersonucf Apr 22, 2024
692a717
Merge branch 'dev/1.3.0' into implementing_questionBank
clpetersonucf Apr 22, 2024
d140a1a
Merge pull request #36 from dmols/implementing_questionBank
clpetersonucf Apr 22, 2024
e449060
Header style overhaul. Replaces reliance on floats and absolute posit…
clpetersonucf Apr 23, 2024
710d428
Tweaks to qb dialog styling
clpetersonucf Apr 23, 2024
28afeec
Merge pull request #39 from clpetersonucf/polish-for-1.3.0
clpetersonucf Apr 23, 2024
1adb8cb
Merge pull request #31 from ucfopen/issue/30-scorescreen-qset
clpetersonucf Apr 23, 2024
0e4804c
Small tweak to ensure creator tutorial hides in a timely manner
clpetersonucf Apr 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading