Closed HSOtago closed 1 year ago
In lieu of making a PR I can provide this fix:
Add this method to {flexsections plugin dir}/amd/src/local/courseeditor/exporter.js
:
/**
* Return a sorted list of all sections and cms items in the state.
*
* @param {Object} state the current state.
* @returns {Array} all sections and cms items in the state.
*/
allItemsArray(state) {
const items = [];
const sectionlist = state.course.sectionlist ?? [];
const addCms = (sectioninfo) => {
const cmlist = sectioninfo.cmlist ?? [];
cmlist.forEach(cmid => {
const cminfo = state.cm.get(cmid);
items.push({type: 'cm', id: cminfo.id, url: cminfo.url});
});
};
const addChildItems = (children) => {
if (children && children.length) {
for (let i = 0; i < children.length; i++) {
const child = children[i];
items.push({type: 'section', id: child.id, url: child.sectionurl});
addCms(child);
addChildItems(child.children);
}
}
};
sectionlist.forEach(sectionid => {
const sectioninfo = state.section.get(sectionid);
items.push({type: 'section', id: sectioninfo.id, url: sectioninfo.sectionurl});
addCms(sectioninfo);
addChildItems(sectioninfo.children);
});
return items;
}
grunt amd
inside the plugin {flexsections plugin dir}/amd
directory (make sure you ran npm install
in moodle's root)Thanks very much @luttje that is incredibly useful.
Thank you very much for the patch, @luttje , It has been added to version 4.0.5 (2023-08-08) . I'm going to close this issue as resolved. Thanks
Hi there,
As the title suggests, take a look at the video below - this can be quite disorienting for our users.
https://user-images.githubusercontent.com/127059146/222991306-cc99b518-e279-4a62-b4db-83f1e6717a95.mp4
Thanks, Harry