mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-73952-master' of https://github.com/bmbrands/moodle
This commit is contained in:
commit
a313795354
2
course/amd/build/actions.min.js
vendored
2
course/amd/build/actions.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -616,13 +616,13 @@ define(
|
|||||||
replaceActionItem(actionItem, 'i/marked',
|
replaceActionItem(actionItem, 'i/marked',
|
||||||
'highlightoff', 'core', 'removemarker');
|
'highlightoff', 'core', 'removemarker');
|
||||||
courseeditor.dispatch('legacySectionAction', action, sectionid);
|
courseeditor.dispatch('legacySectionAction', action, sectionid);
|
||||||
setSectionBadge(sectionElement[0], 'highlighted', true);
|
setSectionBadge(sectionElement[0], 'iscurrent', true);
|
||||||
} else if (action === 'removemarker') {
|
} else if (action === 'removemarker') {
|
||||||
sectionElement.removeClass('current');
|
sectionElement.removeClass('current');
|
||||||
replaceActionItem(actionItem, 'i/marker',
|
replaceActionItem(actionItem, 'i/marker',
|
||||||
'highlight', 'core', 'setmarker');
|
'highlight', 'core', 'setmarker');
|
||||||
courseeditor.dispatch('legacySectionAction', action, sectionid);
|
courseeditor.dispatch('legacySectionAction', action, sectionid);
|
||||||
setSectionBadge(sectionElement[0], 'highlighted', false);
|
setSectionBadge(sectionElement[0], 'iscurrent', false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -739,15 +739,17 @@ define(
|
|||||||
if (!sectionbadges) {
|
if (!sectionbadges) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const badge = sectionbadges.querySelector('[data-type="' + badgetype + '"]');
|
||||||
|
if (!badge) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (add) {
|
if (add) {
|
||||||
templates.render('core_courseformat/local/content/section/badges', {[badgetype]: 1})
|
document.querySelectorAll('[data-type="' + badgetype + '"]').forEach((b) => {
|
||||||
.then(function(html, js) {
|
b.classList.add('d-none');
|
||||||
templates.prependNodeContents(sectionbadges, html, js);
|
});
|
||||||
return true;
|
badge.classList.remove('d-none');
|
||||||
}).catch(notification.exception);
|
|
||||||
} else {
|
} else {
|
||||||
const badge = sectionbadges.querySelector('[data-type="' + badgetype + '"]');
|
badge.classList.add('d-none');
|
||||||
badge.remove();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class section implements named_templatable, renderable {
|
|||||||
* @return stdClass data context for a mustache template
|
* @return stdClass data context for a mustache template
|
||||||
*/
|
*/
|
||||||
public function export_for_template(renderer_base $output): stdClass {
|
public function export_for_template(renderer_base $output): stdClass {
|
||||||
global $USER;
|
global $USER, $PAGE;
|
||||||
|
|
||||||
$format = $this->format;
|
$format = $this->format;
|
||||||
$course = $format->get_course();
|
$course = $format->get_course();
|
||||||
@ -145,6 +145,7 @@ class section implements named_templatable, renderable {
|
|||||||
'summary' => $summary->export_for_template($output),
|
'summary' => $summary->export_for_template($output),
|
||||||
'highlightedlabel' => $format->get_section_highlighted_name(),
|
'highlightedlabel' => $format->get_section_highlighted_name(),
|
||||||
'sitehome' => $course->id == SITEID,
|
'sitehome' => $course->id == SITEID,
|
||||||
|
'editing' => $PAGE->user_is_editing()
|
||||||
];
|
];
|
||||||
|
|
||||||
$haspartials = [];
|
$haspartials = [];
|
||||||
|
@ -29,12 +29,25 @@
|
|||||||
"highlightedlabel" : "Highlighted"
|
"highlightedlabel" : "Highlighted"
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
{{#iscurrent}}
|
{{#editing}}
|
||||||
<span class="badge badge-pill badge-primary order-1" data-type="highlighted">{{ highlightedlabel }}</span>
|
<span class="badge badge-pill badge-primary order-1 {{^iscurrent}}d-none{{/iscurrent}}" data-type="iscurrent">
|
||||||
{{/iscurrent}}
|
{{ highlightedlabel }}
|
||||||
{{#hiddenfromstudents}}
|
</span>
|
||||||
<span class="badge badge-pill badge-warning order-2" data-type="hiddenfromstudents">{{#str}}hiddenfromstudents{{/str}}</span>
|
<span class="badge badge-pill badge-warning order-2 {{^hiddenfromstudents}}d-none{{/hiddenfromstudents}}" data-type="hiddenfromstudents">
|
||||||
{{/hiddenfromstudents}}
|
{{#str}}hiddenfromstudents{{/str}}
|
||||||
{{#notavailable}}
|
</span>
|
||||||
<span class="badge badge-pill badge-secondary order-3">{{#str}}notavailable{{/str}}</span>
|
<span class="badge badge-pill badge-secondary order-3 {{^notavailable}}d-none{{/notavailable}}">
|
||||||
{{/notavailable}}
|
{{#str}}notavailable{{/str}}
|
||||||
|
</span>
|
||||||
|
{{/editing}}
|
||||||
|
{{^editing}}
|
||||||
|
{{#iscurrent}}
|
||||||
|
<span class="badge badge-pill badge-primary order-1">{{ highlightedlabel }}</span>
|
||||||
|
{{/iscurrent}}
|
||||||
|
{{#hiddenfromstudents}}
|
||||||
|
<span class="badge badge-pill badge-warning order-2">{{#str}}hiddenfromstudents{{/str}}</span>
|
||||||
|
{{/hiddenfromstudents}}
|
||||||
|
{{#notavailable}}
|
||||||
|
<span class="badge badge-pill badge-secondary order-3">{{#str}}notavailable{{/str}}</span>
|
||||||
|
{{/notavailable}}
|
||||||
|
{{/editing}}
|
||||||
|
@ -444,6 +444,7 @@ class behat_course extends behat_base {
|
|||||||
// Ensures the section exists.
|
// Ensures the section exists.
|
||||||
$xpath = $this->section_exists($sectionnumber);
|
$xpath = $this->section_exists($sectionnumber);
|
||||||
|
|
||||||
|
$this->execute('behat_general::should_exist_in_the', ['Highlighted', 'text', $xpath, 'xpath_element']);
|
||||||
// The important checking, we can not check the img.
|
// The important checking, we can not check the img.
|
||||||
$this->execute('behat_general::should_exist_in_the', ['Remove highlight', 'link', $xpath, 'xpath_element']);
|
$this->execute('behat_general::should_exist_in_the', ['Remove highlight', 'link', $xpath, 'xpath_element']);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user