From c1dfb05747e9c66dc13dcd6bf714e25514b5e182 Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Tue, 21 May 2024 08:48:34 -0600 Subject: [PATCH] Fix: General cleanup (fixes #97) (#98) --- .github/pull_request_template.md | 2 +- README.md | 23 +++++++++------- js/adapt-languagePicker.js | 2 +- js/languagePickerNavView.js | 46 -------------------------------- 4 files changed, 15 insertions(+), 58 deletions(-) delete mode 100644 js/languagePickerNavView.js diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 750a692..f641119 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,7 +8,7 @@ * A sentence describing each fix ### Update -* A sentence describing each udpate +* A sentence describing each update ### New * A sentence describing each new feature diff --git a/README.md b/README.md index 2352058..d38a52d 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ With the [Adapt CLI](https://github.com/adaptlearning/adapt-cli) installed, run This extension is configured in *config.json* with the attributes that follow. The attributes are properly formatted as JSON in [*example.json*](https://github.com/adaptlearning/adapt-contrib-languagePicker/blob/master/example.json). -## Attributes +## Attributes (config.json) The following attributes are set within *config.json*. @@ -96,17 +96,17 @@ Label for the button that cancels the switch languages dialog.
Back to Top
-### Attributes +## Attributes (course.json) -Add to _course.json_ under _\_globals.\_extensions_. +The following attributes should be added to _course.json_ under _\_globals.\_extensions_. ### \_languagePicker (object): The languagePicker object that contains values for `navigationBarLabel`, `languageSelector` and `_navTooltip` that contains `_isEnabled`, `text`. -#### \navigationBarLabel (string): +#### navigationBarLabel (string): Label shown next to the language picker button when navigation bar labels are enabled. Defaults to Language picker. -#### \languageSelector (string): +#### languageSelector (string): Aria label that appears at the top of the drawer displayed when language picker button is clicked. Defaults to Language selector. #### \_navTooltip (object): @@ -115,20 +115,23 @@ The _navTooltip object that contains values for `_isEnabled` and `text`. #### \_isEnabled (boolean): Enables/disables tooltips for the language picker button in the navigation bar. The default value is `true`. -#### \text (string): +#### text (string): Text to be displayed in the tooltip when the user hovers over the language picker button in the navigation bar. Defaults to 'Language selector' ## Limitations + - If the [**Spoor**](https://github.com/adaptlearning/adapt-contrib-spoor) extension is disabled (or not installed), **Language Picker** will not remember the learner's language choice from the previous session. - Switching languages during an [**Assessment**](https://github.com/adaptlearning/adapt-contrib-assessment) will reset assessment attempts. - Language Picker is not yet compatible with the Adapt Authoring Tool. ## Notes + If the [**Spoor**](https://github.com/adaptlearning/adapt-contrib-spoor) extension is enabled and the course is being run from an LMS that has support for the `cmi.student_preference.language` data model element, the spoor extension will record the learner's choice of language to that data model element. Note that this is for reporting purposes only: as support for that data model element is not mandatory in SCORM 1.2 it cannot be relied upon for saving/restoring the learner's choice of language - the `cmi.suspend_data` data model element will be used for that, even when `cmi.student_preference.language` is available. ---------------------------- + adapt learning logo -**Author / maintainer:** Adapt Core Team with [contributors](https://github.com/adaptlearning/adapt-contrib-bookmarking/graphs/contributors) -**Accessibility support:** WAI AA -**RTL support:** Yes -**Cross-platform coverage:** Chrome, Chrome for Android, Firefox (ESR + latest version), Edge, Safari 14 for macOS/iOS/iPadOS, Opera +**Author / maintainer:** Adapt Core Team with [contributors](https://github.com/adaptlearning/adapt-contrib-bookmarking/graphs/contributors)
+**Accessibility support:** WAI AA
+**RTL support:** Yes
+**Cross-platform coverage:** Chrome, Chrome for Android, Firefox (ESR + latest version), Edge, Safari for macOS/iOS/iPadOS, Opera
diff --git a/js/adapt-languagePicker.js b/js/adapt-languagePicker.js index 2ad0119..105bca3 100644 --- a/js/adapt-languagePicker.js +++ b/js/adapt-languagePicker.js @@ -97,7 +97,7 @@ class LanguagePicker extends Backbone.Controller { _navTooltip }); navigation.addButton(new LanguagePickerNavigationButton({ - model: model, + model, drawerModel: this.languagePickerModel })); } diff --git a/js/languagePickerNavView.js b/js/languagePickerNavView.js deleted file mode 100644 index be999ae..0000000 --- a/js/languagePickerNavView.js +++ /dev/null @@ -1,46 +0,0 @@ -import Adapt from 'core/js/adapt'; -import drawer from 'core/js/drawer'; -import LanguagePickerDrawerView from './languagePickerDrawerView'; -import tooltips from 'core/js/tooltips'; - -export default class LanguagePickerNavView extends Backbone.View { - - tagName() { - return 'button'; - } - - className() { - const classNames = 'btn-icon nav__btn nav__languagepicker-btn js-languagepicker-nav-btn icon'; - const customClass = this.model.get('_languagePickerIconClass') || 'icon-language-2'; - - return `${classNames} ${customClass}`; - } - - events() { - return { - click: 'onClick' - }; - } - - initialize() { - this.listenTo(Adapt, { - remove: this.remove, - 'drawer:closed': this.onClose - }); - - tooltips.register({ - _id: 'languagePicker', - ...Adapt.course.get('_globals')?._extensions?._languagePicker?._navTooltip || {} - }); - } - - onClose() { - this.$el.attr('aria-expanded', false); - } - - onClick(event) { - this.$el.attr('aria-expanded', true); - drawer.triggerCustomView(new LanguagePickerDrawerView({ model: this.model }).$el, false); - } - -}