Skip to content

Commit

Permalink
Release/v5 (#150)
Browse files Browse the repository at this point in the history
* Converted tabs to spaces, indentation amends

* Naming refactor

* Updated merge with naming refactor

* Moved positional less to theme, zindex bug fix

* _canShowMarking false icon support

* Bower, example and readme updates

* Removed unnecessary space

* Updated license and cross platform coverage
  • Loading branch information
guywillis authored Nov 13, 2019
1 parent 61b6b3e commit 27104e2
Show file tree
Hide file tree
Showing 7 changed files with 409 additions and 479 deletions.
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,72 +34,72 @@ In addition to the attributes specifically listed below, [*question components*]
+ [**core model attributes**](https://github.com/adaptlearning/adapt_framework/wiki/Core-model-attributes): These are inherited by every Adapt component. They have no default values. Like the attributes below, their values are assigned in *components.json*.
+ [**core buttons**](https://github.com/adaptlearning/adapt_framework/wiki/Core-Buttons): Default values are found in *course.json*, but may be overridden by **MCQ's** model in *components.json*.

**_component** (string): This value must be: `mcq`.
**\_component** (string): This value must be: `mcq`.

**_classes** (string): CSS class name to be applied to **MCQ**’s containing `div`. The class must be predefined in one of the Less files. Separate multiple classes with a space.
**\_classes** (string): CSS class name to be applied to **MCQ**’s containing `div`. The class must be predefined in one of the Less files. Separate multiple classes with a space.

**_layout** (string): This defines the horizontal position of the component in the block. Acceptable values are `full`, `left` or `right`.
**\_layout** (string): This defines the horizontal position of the component in the block. Acceptable values are `full`, `left` or `right`.

**instruction** (string): This optional text appears above the component. It is frequently used to
guide the learner’s interaction with the component.

**_attempts** (integer): This specifies the number of times a learner is allowed to submit an answer. The default is `1`.
**\_attempts** (integer): This specifies the number of times a learner is allowed to submit an answer. The default is `1`.

**_shouldDisplayAttempts** (boolean): Determines whether or not the text set in **remainingAttemptText** and **remainingAttemptsText** will be displayed. These two attributes are part of the [core buttons](https://github.com/adaptlearning/adapt_framework/wiki/Core-Buttons) attribute group. The default is `false`.
**\_shouldDisplayAttempts** (boolean): Determines whether or not the text set in **remainingAttemptText** and **remainingAttemptsText** will be displayed. These two attributes are part of the [core buttons](https://github.com/adaptlearning/adapt_framework/wiki/Core-Buttons) attribute group. The default is `false`.

**_isRandom** (boolean): Setting this value to `true` will cause the `_items` to appear in a random order each time the component is loaded. The default is `false`.
**\_isRandom** (boolean): Setting this value to `true` will cause the `_items` to appear in a random order each time the component is loaded. The default is `false`.

**_questionWeight** (number): A number which reflects the significance of the question in relation to the other questions in the course. This number is used in calculations of the final score reported to the LMS.
**\_questionWeight** (number): A number which reflects the significance of the question in relation to the other questions in the course. This number is used in calculations of the final score reported to the LMS.

**_selectable** (integer): Defines the number of **_items**, or answers, that can be selected. If the value of **_selectable** is `1`, **_items** will be presented with HTML radio buttons. If the value is greater than `1`, they will be presented with HTML checkboxes. This number must match or exceed the number of **_items** whose **_shouldBeSelected** is set to `true`. The default is `1`.
**\_selectable** (integer): Defines the number of **\_items**, or answers, that can be selected. If the value of **\_selectable** is `1`, **\_items** will be presented with HTML radio buttons. If the value is greater than `1`, they will be presented with HTML checkboxes. This number must match or exceed the number of **\_items** whose **\_shouldBeSelected** is set to `true`. The default is `1`.

**_canShowModelAnswer** (boolean): Setting this to `false` prevents the [**_showCorrectAnswer** button](https://github.com/adaptlearning/adapt_framework/wiki/Core-Buttons) from being displayed. The default is `true`.
**\_canShowModelAnswer** (boolean): Setting this to `false` prevents the [**_showCorrectAnswer** button](https://github.com/adaptlearning/adapt_framework/wiki/Core-Buttons) from being displayed. The default is `true`.

**_canShowFeedback** (boolean): Setting this to `false` disables feedback, so it is not shown to the user. The default is `true`.
**\_canShowFeedback** (boolean): Setting this to `false` disables feedback, so it is not shown to the user. The default is `true`.

**_canShowMarking** (boolean): Setting this to `false` prevents ticks and crosses being displayed on question completion. The default is `true`.
**\_canShowMarking** (boolean): Setting this to `false` prevents ticks and crosses being displayed on question completion. The default is `true`.

**_recordInteraction** (boolean) Determines whether or not the learner's answers will be recorded to the LMS via cmi.interactions. Default is `true`. For further information, see the entry for `_shouldRecordInteractions` in the README for [adapt-contrib-spoor](https://github.com/adaptlearning/adapt-contrib-spoor).
**\_recordInteraction** (boolean) Determines whether or not the learner's answers will be recorded to the LMS via cmi.interactions. Default is `true`. For further information, see the entry for `_shouldRecordInteractions` in the README for [adapt-contrib-spoor](https://github.com/adaptlearning/adapt-contrib-spoor).

**_items** (array): Each *item* represents one choice for the multiple choice question and contains values for **text**, **_shouldBeSelected**, and **feedback**.
**\_items** (array): Each *item* represents one choice for the multiple choice question and contains values for **text**, **\_shouldBeSelected**, and **feedback**.

>**text** (string): Text that comprises the multiple choice option.
>**_shouldBeSelected** (boolean): Determines whether the *item* must be selected for the answer to be correct. Value can be `true` or `false`. The value of **_selectable** must correspond to the total number of **_items** where **_shouldBeSelected** is set to `true`.
>**\_shouldBeSelected** (boolean): Determines whether the *item* must be selected for the answer to be correct. Value can be `true` or `false`. The value of **\_selectable** must correspond to the total number of **\_items** where **\_shouldBeSelected** is set to `true`.
>**feedback** (string): This attribute is used only when the value for **_selectable** is set to `1` (i.e., radio button style questions). This text will be shown if the learner selects this item, and it is an incorrect answer.
>**feedback** (string): This attribute is used only when the value for **\_selectable** is set to `1` (i.e., radio button style questions). This text will be shown if the learner selects this item, and it is an incorrect answer.
**_feedback** (object): If the [**Tutor** extension](https://github.com/adaptlearning/adapt-contrib-tutor) is enabled, these various texts will be displayed depending on the submitted answer. **_feedback**
contains values for three types of answers: **correct**, **_incorrect**, and **_partlyCorrect**. Some attributes are optional. If they are not supplied, the default that is noted below will be used.
**\_feedback** (object): If the [**Tutor** extension](https://github.com/adaptlearning/adapt-contrib-tutor) is enabled, these various texts will be displayed depending on the submitted answer. **\_feedback**
contains values for three types of answers: **correct**, **\_incorrect**, and **\_partlyCorrect**. Some attributes are optional. If they are not supplied, the default that is noted below will be used.

>**title** (string): If not set, the component's **displayTitle** is used as the feedback title. If **displayTitle** is not set , **title** will be used instead.
>**correct** (string): Text that will be displayed when the submitted answer is correct.
>**_incorrect** (object): Texts that will be displayed when the submitted answer is incorrect. It contains values that are displayed under differing conditions: **final** and **notFinal**.
>**\_incorrect** (object): Texts that will be displayed when the submitted answer is incorrect. It contains values that are displayed under differing conditions: **final** and **notFinal**.
>>**final** (string): Text that will be displayed when the submitted answer is incorrect and no more attempts are permitted.
>>**notFinal** (string): Text that will be displayed when the submitted answer is incorrect while more attempts are permitted. This is optional—if you do not supply it, the **_incorrect.final** feedback will be shown instead.
>>**notFinal** (string): Text that will be displayed when the submitted answer is incorrect while more attempts are permitted. This is optional—if you do not supply it, the **\_incorrect.final** feedback will be shown instead.
>**_partlyCorrect** (object): Texts that will be displayed when the submitted answer is partially correct. It contains values that are displayed under differing conditions: **final** and **notFinal**.
>**\_partlyCorrect** (object): Texts that will be displayed when the submitted answer is partially correct. It contains values that are displayed under differing conditions: **final** and **notFinal**.
>>**final** (string): Text that will be displayed when the submitted answer is partly correct and no more attempts are permitted. This is optional—if you do not supply it, the **_incorrect.final** feedback will be shown instead.
>>**final** (string): Text that will be displayed when the submitted answer is partly correct and no more attempts are permitted. This is optional—if you do not supply it, the **\_incorrect.final** feedback will be shown instead.
>>**notFinal** (string): Text that will be displayed when the submitted answer is partly correct while more attempts are permitted. This is optional—if you do not supply it, the **_incorrect.notFinal** feedback will be shown instead.
>>**notFinal** (string): Text that will be displayed when the submitted answer is partly correct while more attempts are permitted. This is optional—if you do not supply it, the **\_incorrect.notFinal** feedback will be shown instead.
### Accessibility
**Multiple Choice Question** has been assigned a label using the [aria-label](https://github.com/adaptlearning/adapt_framework/wiki/Aria-Labels) attribute: **ariaRegion**. This label is not a visible element. It is utilized by assistive technology such as screen readers. Should the region's text need to be customised, it can be found within the **globals** object in [*properties.schema*](https://github.com/adaptlearning/adapt-contrib-mcq/blob/master/properties.schema).
<div float align=right><a href="#top">Back to Top</a></div>

## Limitations
No known limitations.

No known limitations.

----------------------------
**Version number:** 3.0.0 <a href="https://community.adaptlearning.org/" target="_blank"><img src="https://github.com/adaptlearning/documentation/blob/master/04_wiki_assets/plug-ins/images/adapt-logo-mrgn-lft.jpg" alt="adapt learning logo" align="right"></a>
**Framework versions:** 4+
**Version number:** 4.0.0 <a href="https://community.adaptlearning.org/" target="_blank"><img src="https://github.com/adaptlearning/documentation/blob/master/04_wiki_assets/plug-ins/images/adapt-logo-mrgn-lft.jpg" alt="adapt learning logo" align="right"></a>
**Framework versions:** 5+
**Author / maintainer:** Adapt Core Team with [contributors](https://github.com/adaptlearning/adapt-contrib-mcq/graphs/contributors)
**Accessibility support:** WAI AA
**RTL support:** yes
**Cross-platform coverage:** Chrome, Chrome for Android, Firefox (ESR + latest version), Edge, IE11, IE Mobile 11, Safari 11+12 for macOS+iOS, Opera
**Accessibility support:** WAI AA
**RTL support:** Yes
**Cross-platform coverage:** Chrome, Chrome for Android, Firefox (ESR + latest version), Edge, IE11, Safari 12+13 for macOS/iOS/iPadOS, Opera
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "adapt-contrib-mcq",
"version": "3.0.0",
"framework": ">=4",
"version": "4.0.0",
"framework": ">=5",
"homepage": "https://github.com/adaptlearning/adapt-contrib-mcq",
"issues": "https://github.com/adaptlearning/adapt_framework/issues/new",
"displayName" : "Multiple Choice Question",
"component" : "mcq",
"displayName" : "Multiple Choice Question",
"description": "A multiple choice question component",
"main": "/js/adapt-contrib-mcq.js",
"keywords": [
"adapt-plugin",
"adapt-component"
],
"license": "GPLv3"
"license": "GPL-3.0"
}
156 changes: 78 additions & 78 deletions example.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
{
"_id": "c-105",
"_parentId": "b-55",
"_type": "component",
"_component": "mcq",
"_classes": "",
"_layout": "left",
"_attempts": 1,
"_shouldDisplayAttempts": false,
"_questionWeight": 1,
"_isRandom": false,
"_selectable": 1,
"_canShowModelAnswer": true,
"_canShowFeedback": true,
"_canShowMarking": true,
"_recordInteraction": true,
"title": "MCQ",
"displayTitle": "MCQ",
"body": "Which of the following options would you consider to be correct?",
"instruction": "",
"_items": [
{
"text": "This is option 1.",
"_shouldBeSelected": true
},
{
"text": "This is option 2.",
"_shouldBeSelected": false,
"feedback": "Option two incorrect feedback"
},
{
"text": "This is option 3.",
"_shouldBeSelected": false
},
{
"text": "This is option 4.",
"_shouldBeSelected": false
}
],
"_feedback":{
"title": "Feedback",
"correct": "Congratulations, this is the correct feedback.",
"_incorrect": {
"notFinal": "",
"final": "This feedback will appear if you answered the question incorrectly."
},
"_partlyCorrect": {
"notFinal": "",
"final": "This feedback will appear if you answered the question correctly."
"_id": "c-05",
"_parentId": "b-05",
"_type": "component",
"_component": "mcq",
"_classes": "",
"_layout": "left",
"title": "MCQ",
"displayTitle": "MCQ",
"body": "Which of the following options would you consider to be correct?",
"instruction": "",
"_attempts": 1,
"_shouldDisplayAttempts": false,
"_isRandom": false,
"_questionWeight": 1,
"_selectable": 1,
"_canShowModelAnswer": true,
"_canShowFeedback": true,
"_canShowMarking": true,
"_recordInteraction": true,
"_items": [
{
"text": "This is option 1 (Correct)",
"_shouldBeSelected": true
},
{
"text": "This is option 2",
"_shouldBeSelected": false,
"feedback": "Option two incorrect feedback"
},
{
"text": "This is option 3",
"_shouldBeSelected": false
},
{
"text": "This is option 4",
"_shouldBeSelected": false
}
],
"_feedback":{
"title": "Feedback",
"correct": "Congratulations, this is the correct feedback.",
"_incorrect": {
"notFinal": "",
"final": "This feedback will appear if you answered the question incorrectly."
},
"_partlyCorrect": {
"notFinal": "",
"final": "This feedback will appear if you answered the question correctly."
}
},
"_comment": "You only need to include _buttons if you want to override the button labels that are set in course.json",
"_buttons": {
"_submit": {
"buttonText": "Submit",
"ariaLabel": "Select here to submit your answer."
},
"_reset": {
"buttonText": "Reset",
"ariaLabel": ""
},
"_showCorrectAnswer": {
"buttonText": "Correct Answer",
"ariaLabel": ""
},
"_hideCorrectAnswer": {
"buttonText": "My Answer",
"ariaLabel": ""
},
"_showFeedback": {
"buttonText": "Show feedback",
"ariaLabel": ""
},
"remainingAttemptsText": "attempts remaining",
"remainingAttemptText": "final attempt"
},
"_pageLevelProgress": {
"_isEnabled": true
}
}
},
"_comment": "You only need to include _buttons if you want to override the button labels that are set in course.json",
"_buttons": {
"_submit": {
"buttonText": "Submit",
"ariaLabel": "Select here to submit your answer."
},
"_reset": {
"buttonText": "Reset",
"ariaLabel": ""
},
"_showCorrectAnswer": {
"buttonText": "Correct Answer",
"ariaLabel": ""
},
"_hideCorrectAnswer": {
"buttonText": "My Answer",
"ariaLabel": ""
},
"_showFeedback": {
"buttonText": "Show feedback",
"ariaLabel": ""
},
"remainingAttemptsText": "attempts remaining",
"remainingAttemptText": "final attempt"
},
"_pageLevelProgress": {
"_isEnabled": true
}
}
18 changes: 9 additions & 9 deletions js/adapt-contrib-mcq.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
define([
'core/js/adapt',
'./mcqView',
'core/js/models/itemsQuestionModel'
'core/js/adapt',
'./mcqView',
'core/js/models/itemsQuestionModel'
], function(Adapt, McqView, ItemsQuestionModel) {

return Adapt.register("mcq", {
view: McqView,
// Extend ItemsQuestionModel to distinguish McqModel in
// the inheritance chain and allow targeted model extensions.
model: ItemsQuestionModel.extend({})
});
return Adapt.register("mcq", {
view: McqView,
// Extend ItemsQuestionModel to distinguish McqModel in
// the inheritance chain and allow targeted model extensions.
model: ItemsQuestionModel.extend({})
});

});
Loading

0 comments on commit 27104e2

Please sign in to comment.