mirror of
https://github.com/moodle/moodle.git
synced 2025-04-25 18:35:14 +02:00
MDL-33546: course: Fix current week hightlighting after dragging the section
This commit is contained in:
parent
5883de26ae
commit
f81d63553e
@ -75,6 +75,7 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
|
||||
for (var i = sectionfrom; i <= sectionto; i++) {
|
||||
// Update section title.
|
||||
sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
|
||||
|
||||
// Update move icon.
|
||||
ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE);
|
||||
str = ele.getAttribute('alt');
|
||||
@ -82,6 +83,14 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
|
||||
newstr = str.substr(0, stridx +1) + i;
|
||||
ele.setAttribute('alt', newstr);
|
||||
ele.setAttribute('title', newstr); // For FireFox as 'alt' is not refreshed.
|
||||
|
||||
// Remove the current class as section has been moved.
|
||||
sectionlist.item(i).removeClass('current');
|
||||
}
|
||||
// If there is a current section, apply corresponding class in order to highlight it.
|
||||
if (response.current !== -1) {
|
||||
// Add current class to the required section.
|
||||
sectionlist.item(response.current).addClass('current');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,15 +162,19 @@ class format_weeks extends format_base {
|
||||
function ajax_section_move() {
|
||||
global $PAGE;
|
||||
$titles = array();
|
||||
$current = -1;
|
||||
$course = $this->get_course();
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
$renderer = $this->get_renderer($PAGE);
|
||||
if ($renderer && ($sections = $modinfo->get_section_info_all())) {
|
||||
foreach ($sections as $number => $section) {
|
||||
$titles[$number] = $renderer->section_title($section, $course);
|
||||
if ($this->is_section_current($section)) {
|
||||
$current = $number;
|
||||
}
|
||||
}
|
||||
}
|
||||
return array('sectiontitles' => $titles, 'action' => 'move');
|
||||
return array('sectiontitles' => $titles, 'current' => $current, 'action' => 'move');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user