Skip to content

Commit

Permalink
Removes the Reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertPeek committed Apr 14, 2021
1 parent 0b09ae5 commit edb3e8f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 75 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Text Entry** is a *presentation component* for the [Adapt framework](https://github.com/adaptlearning/adapt_framework).

This component displays a simple text entry box with no tracking or data saving.
This component displays a text entry box which captures user input text.

## Settings Overview

Expand Down Expand Up @@ -46,12 +46,6 @@ The attributes listed below are used in *components.json* to configure **Text En
>>**ariaLabel** (string): This text becomes the button’s `Aria label` attribute.
>**_reset** (object): This `_reset` attributes group stores the properties for the Reset button. It contains values for **buttonText**, and **ariaLabel**.
>>**buttonText** (string): Sets the text to be displayed in the Submit button.
>>**ariaLabel** (string): This text becomes the button’s `Aria label` attribute.
>**_showFeedback** (object): This `_showFeedback` attributes group stores the properties for the Feedback button. It contains values for **buttonText**, and **ariaLabel**.
>>**buttonText** (string): Sets the text to be displayed in the Feedback button.
Expand Down Expand Up @@ -86,7 +80,7 @@ Several elements of **Text Entry** have been assigned a label using the [aria-la
No known limitations.

----------------------------
**Version number:** 4.2.1
**Version number:** 4.3.0
**Framework versions supported:** 4+
**Author / maintainer:** DeltaNet with [contributors](https://github.com/deltanet/adapt-textEntry-audio/graphs/contributors)
**Accessibility support:** yes
Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "adapt-textEntry-audio",
"version": "4.2.1",
"version": "4.3.0",
"framework": ">=4",
"homepage": "https://github.com/deltanet/adapt-textEntry-audio",
"issues": "https://github.com/deltanet/adapt-textEntry-audio/issues",
"description": "A simple text entry component with optional audio",
"description": "A text entry component to capture user text",
"main": "/js/adapt-textEntry-audio.js",
"displayName" : "Text Entry Audio",
"displayName" : "Text Entry",
"component" : "textEntry-audio",
"keywords": [
"adapt-plugin",
Expand Down
4 changes: 0 additions & 4 deletions example.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
"buttonText": "Submit",
"ariaLabel": "Select here to submit your answer."
},
"_reset": {
"buttonText": "Reset",
"ariaLabel": "Select here to reset your answer."
},
"_showFeedback": {
"buttonText": "Show feedback",
"ariaLabel": "Select here to see the answer."
Expand Down
44 changes: 12 additions & 32 deletions js/textEntryAudioView.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,17 @@ define([

if (this.$('.textEntry-audio-item-textbox').val() == "") return;

if (this.model.get('_isSubmitted')) {
this.userAnswer = this.$('.textEntry-audio-item-textbox').val();
this.model.set("userAnswer", this.userAnswer);

$(event.currentTarget).html(this.model.get("_buttons")._submit.buttonText);
$(event.currentTarget).attr('aria-label', this.model.get("_buttons")._submit.ariaLabel);
this.initFeedback();

this.resetUserAnswer();
this.model.set('_isSubmitted', true);

} else {
this.$('.buttons-action').addClass('disabled').attr('disabled', true);
this.$('.buttons-action-fullwidth').addClass('disabled').attr('disabled', true);

this.userAnswer = this.$('.textEntry-audio-item-textbox').val();
this.model.set("userAnswer", this.userAnswer);

this.initFeedback();

$(event.currentTarget).html(this.model.get("_buttons")._reset.buttonText);
$(event.currentTarget).attr('aria-label', this.model.get("_buttons")._reset.ariaLabel);

this.model.set('_isSubmitted', true);
}
this.$('.textEntry-audio-item-textbox').attr('disabled', true);

Adapt.offlineStorage.set(this.model.get('_id'), this.model.get("userAnswer"));

Expand Down Expand Up @@ -114,30 +106,18 @@ define([

this.model.set('_isSubmitted', true);

if (this.model.get('_canShowFeedback')) {
this.$('.buttons-action').html(this.model.get("_buttons")._reset.buttonText);
this.$('.buttons-action').attr('aria-label', this.model.get("_buttons")._reset.ariaLabel);
this.$('.buttons-action').addClass('disabled').attr('disabled', true);
this.$('.buttons-action-fullwidth').addClass('disabled').attr('disabled', true);

this.$('.textEntry-audio-item-textbox').attr('disabled', true);

if (this.model.get('_canShowFeedback')) {
this.$('.buttons-feedback').attr('disabled', false);
} else {
this.$('.buttons-action-fullwidth').html(this.model.get("_buttons")._reset.buttonText);
this.$('.buttons-action-fullwidth').attr('aria-label', this.model.get("_buttons")._reset.ariaLabel);
}

this.updateCounter();
},

resetUserAnswer: function() {
this.model.set('_isSubmitted', false);
this.model.set('userAnswer', '');

this.$('.textEntry-audio-item-textbox').val('');

this.$('.buttons-feedback').attr('disabled', true);

this.updateCounter();
},

onInputChanged: function(event) {
if (event) event.preventDefault();

Expand Down
26 changes: 0 additions & 26 deletions properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -143,32 +143,6 @@
}
}
},
"_reset": {
"type": "object",
"title": "Reset",
"properties": {
"buttonText": {
"type": "string",
"required": true,
"default": "Reset",
"title": "",
"inputType": "QuestionButton",
"validators": [],
"help": "Button label text for the reset button.",
"translatable": true
},
"ariaLabel": {
"type": "string",
"required": false,
"default": "",
"title": "",
"inputType": "Text",
"validators": [],
"help": "Aria label for the reset button.",
"translatable": true
}
}
},
"_showFeedback": {
"type": "object",
"title": "Show Feedback",
Expand Down
8 changes: 6 additions & 2 deletions templates/textEntry-audio.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
<div class="buttons">
<div class="buttons-inner">
<div class="buttons-cluster clearfix">
<button class="{{#if _canShowFeedback}}buttons-action{{else}}buttons-action-fullwidth{{/if}}" aria-label="{{_buttons._submit.ariaLabel}}">{{_buttons._submit.buttonText}}</button>
<button class="{{#if _canShowFeedback}}buttons-action{{else}}buttons-action-fullwidth{{/if}}" aria-label="{{_buttons._submit.ariaLabel}}">
{{_buttons._submit.buttonText}}
</button>
{{#if _canShowFeedback}}
<button class="buttons-feedback" aria-label="{{_buttons._showFeedback.ariaLabel}}" disabled="true">{{_buttons._showFeedback.buttonText}}</button>
<button class="buttons-feedback" aria-label="{{_buttons._showFeedback.ariaLabel}}" disabled="true">
{{_buttons._showFeedback.buttonText}}
</button>
{{/if}}
</div>
</div>
Expand Down

0 comments on commit edb3e8f

Please sign in to comment.