diff --git a/README.md b/README.md index 33de19a..2ffea0f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. @@ -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 diff --git a/bower.json b/bower.json index 56918ea..a962544 100644 --- a/bower.json +++ b/bower.json @@ -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", diff --git a/example.json b/example.json index d588541..2b10bd5 100644 --- a/example.json +++ b/example.json @@ -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." diff --git a/js/textEntryAudioView.js b/js/textEntryAudioView.js index b084539..0c97063 100644 --- a/js/textEntryAudioView.js +++ b/js/textEntryAudioView.js @@ -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")); @@ -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(); diff --git a/properties.schema b/properties.schema index bb1498c..05b9367 100644 --- a/properties.schema +++ b/properties.schema @@ -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", diff --git a/templates/textEntry-audio.hbs b/templates/textEntry-audio.hbs index b40bf6d..7bdc39a 100644 --- a/templates/textEntry-audio.hbs +++ b/templates/textEntry-audio.hbs @@ -11,9 +11,13 @@