MDL-81050 course: Fix section renaming in section page

Fix section page heading title update when the section name has been
modified using inplace editable.
This commit is contained in:
Mikel Martín 2024-03-04 10:11:39 +01:00
parent b73a685ef7
commit 34ab1582cb
4 changed files with 7 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -994,7 +994,7 @@ define(
// The section and activity names are edited using inplace editable.
// The "update" jQuery event must be captured in order to update the course state.
$('body').on('updated', `${SELECTOR.SECTIONLI} ${SELECTOR.SECTIONITEM} [data-inplaceeditable]`, function(e) {
$('body').on('updated', `${SELECTOR.SECTIONITEM} [data-inplaceeditable]`, function(e) {
if (e.ajaxreturn && e.ajaxreturn.itemid) {
const state = courseeditor.state;
const section = state.section.get(e.ajaxreturn.itemid);

View File

@ -148,7 +148,10 @@ if ($format->show_editor()) {
$renderable = $sectionclass->export_for_template($renderer);
$controlmenuhtml = $renderable->controlmenu->menu;
$PAGE->add_header_action($controlmenuhtml);
$sectionheading = $OUTPUT->render($format->inplace_editable_render_section_name($sectioninfo, false));
$sectionheading = $OUTPUT->container(
$OUTPUT->render($format->inplace_editable_render_section_name($sectioninfo, false)),
attributes: ['data-for' => 'section_title'],
);
$PAGE->set_heading($sectionheading, false, false);
} else {
$PAGE->set_heading($sectiontitle);