Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ git diff master FETCH_HEAD course/format/amd/src/local/content.js
- diff --git a/course/format/amd/src/local/content.js b/course/format/amd/src/local/content.js
- index 81a3ec04544..f6497345535 100644
- --- a/course/format/amd/src/local/content.js
- +++ b/course/format/amd/src/local/content.js
- @@ -48,16 +48,14 @@ export default class Component extends BaseComponent {
- CM: `[data-for='cmitem']`,
- TOGGLER: `[data-action="togglecoursecontentsection"]`,
- COLLAPSE: `[data-toggle="collapse"]`,
- + // Formats can override the activity tag but a default one is needed to create new elements.
- + ACTIVITYTAG: 'li',
- };
- // Default classes to toggle on refresh.
- this.classes = {
- COLLAPSED: `collapsed`,
- - // Formats can override the activity tag but a default one is needed to create new elements.
- - ACTIVITYTAG: 'li',
- -
- - // Course content classes.
- - ACTIVITY: `activity`,
- STATEDREADY: `stateready`,
- + ACTIVITY: `activity`,
- };
- // Array to save dettached elements during element resorting.
- this.dettachedCms = {};
- @@ -89,6 +87,16 @@ export default class Component extends BaseComponent {
- this._indexContents();
- // Activate section togglers.
- this.addEventListener(this.element, 'click', this._sectionTogglers);
- +
- + if (this.reactive.supportComponents) {
- + // Actions are only available in edit mode.
- + if (this.reactive.isEditing) {
- + new DispatchActions(this);
- + }
- +
- + // Mark content as state ready.
- + this.element.classList.add(this.classes.STATEDREADY);
- + }
- }
- /**
- @@ -123,30 +131,6 @@ export default class Component extends BaseComponent {
- }
- }
- - /**
- - *
- - * Course content elements could not provide JS Components because the elements HTML is applied
- - * directly from the course actions. To keep internal components updated this module keeps
- - * a list of the active components and mark them as "indexed". This way when any action replace
- - * the HTML this component will recreate the components an add any necessary event listener.
- - *
- - * Format plugins can override this method to provide extra logic to the course frontend.
- - *
- - */
- - stateReady() {
- - this._indexContents();
- -
- - if (this.reactive.supportComponents) {
- - // Actions are only available in edit mode.
- - if (this.reactive.isEditing) {
- - new DispatchActions(this);
- - }
- -
- - // Mark content as state ready.
- - this.element.classList.add(this.classes.STATEDREADY);
- - }
- - }
- -
- /**
- * Return the component watchers.
- *
- @@ -182,8 +166,7 @@ export default class Component extends BaseComponent {
- * Most course module HTML is still strongly backend dependant.
- * Some changes require to get a new version af the module.
- *
- - * @param {Object} param
- - * @param {Object} param.element update the state update data
- + * @param {Object} update the state update data
- */
- _reloadCm({element}) {
- const cmitem = this.getElement(this.selectors.CM, element.id);
- @@ -195,8 +178,7 @@ export default class Component extends BaseComponent {
- /**
- * Update section collapsed.
- *
- - * @param {object} args
- - * @param {Object} args.element The element to update
- + * @param {Object} details the update details.
- */
- _refreshSectionCollapsed({element}) {
- const target = this.getElement(this.selectors.SECTION, element.id);
- @@ -236,8 +218,7 @@ export default class Component extends BaseComponent {
- * Course formats can override the section title rendering so the frontend depends heavily on backend
- * rendering. Luckily in edit mode we can trigger a title update using the inplace_editable module.
- *
- - * @param {Object} param
- - * @param {Object} param.element details the update details.
- + * @param {Object} details the update details.
- */
- _refreshSectionNumber({element}) {
- // Find the element.
- @@ -275,8 +256,8 @@ export default class Component extends BaseComponent {
- /**
- * Refresh a section cm list.
- *
- - * @param {Object} param
- - * @param {Object} param.element details the update details.
- + * @param {details} details the update details
- + * @property {object} details.element the state object
- */
- _refreshSectionCmlist({element}) {
- const cmlist = element.cmlist ?? [];
- @@ -292,8 +273,7 @@ export default class Component extends BaseComponent {
- /**
- * Refresh the section list.
- *
- - * @param {Object} param
- - * @param {Object} param.element details the update details.
- + * @param {Object} details the update details.
- */
- _refreshCourseSectionlist({element}) {
- const sectionlist = element.sectionlist ?? [];
- @@ -365,8 +345,8 @@ export default class Component extends BaseComponent {
- * Most course module HTML is still strongly backend dependant.
- * Some changes require to get a new version of the module.
- *
- - * @param {object} param0 the watcher details
- - * @param {object} param0.element the state object
- + * @param {details} param0 the watcher details
- + * @property {object} param0.element the state object
- */
- _reloadCm({element}) {
- const cmitem = this.getElement(this.selectors.CM, element.id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement