mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-68231 core_formats: conditionally swap controls on section drop
When using section drag and drop, the topics and weeks formats expected the '.section_add_menus' element to be present so it could update it on section drop. Due to MDL-68056, this control is only sometimes present. This has been updated to conditionally swap to address this.
This commit is contained in:
parent
f2fc4a9fa1
commit
b3f19d3547
@ -40,8 +40,10 @@ M.course.format.swap_sections = function(Y, node1, node2) {
|
||||
};
|
||||
|
||||
var sectionlist = Y.Node.all('.'+CSS.COURSECONTENT+' '+M.course.format.get_section_selector(Y));
|
||||
// Swap menus.
|
||||
sectionlist.item(node1).one('.'+CSS.SECTIONADDMENUS).swap(sectionlist.item(node2).one('.'+CSS.SECTIONADDMENUS));
|
||||
// Swap the non-ajax menus, noting these are not always present (depends on theme and user prefs).
|
||||
if (sectionlist.item(node1).one('.'+CSS.SECTIONADDMENUS)) {
|
||||
sectionlist.item(node1).one('.'+CSS.SECTIONADDMENUS).swap(sectionlist.item(node2).one('.'+CSS.SECTIONADDMENUS));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,6 +11,9 @@ Overview of this plugin type at http://docs.moodle.org/dev/Course_formats
|
||||
- format_weeks_upgrade_remove_numsections()
|
||||
- format_weeks_upgrade_hide_extra_sections()
|
||||
- format_weeks_upgrade_add_empty_sections()
|
||||
* The non-ajax controls to add resources and activities are now rendered only when needed, such as when the user
|
||||
preference is set, or when the theme sets $THEME->enablecourseajaxtheme to false. Formats which directly access
|
||||
the '.section_add_menus' element or its children should be updated accordingly.
|
||||
|
||||
=== 3.8 ===
|
||||
|
||||
|
@ -40,8 +40,10 @@ M.course.format.swap_sections = function(Y, node1, node2) {
|
||||
};
|
||||
|
||||
var sectionlist = Y.Node.all('.'+CSS.COURSECONTENT+' '+M.course.format.get_section_selector(Y));
|
||||
// Swap menus.
|
||||
sectionlist.item(node1).one('.'+CSS.SECTIONADDMENUS).swap(sectionlist.item(node2).one('.'+CSS.SECTIONADDMENUS));
|
||||
// Swap the non-ajax menus, noting these are not always present (depends on theme and user prefs).
|
||||
if (sectionlist.item(node1).one('.'+CSS.SECTIONADDMENUS)) {
|
||||
sectionlist.item(node1).one('.' + CSS.SECTIONADDMENUS).swap(sectionlist.item(node2).one('.' + CSS.SECTIONADDMENUS));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user