mirror of
https://github.com/moodle/moodle.git
synced 2025-03-13 20:26:32 +01:00
Merge branch 'MDL-72819-master' of https://github.com/ferranrecio/moodle
This commit is contained in:
commit
c683b69855
2
course/format/amd/build/local/content.min.js
vendored
2
course/format/amd/build/local/content.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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -151,7 +151,7 @@ export default class Component extends BaseComponent {
|
||||
'sectionPreferences',
|
||||
[sectionId],
|
||||
{
|
||||
contentexpanded: isCollapsed,
|
||||
contentcollapsed: !isCollapsed,
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -177,7 +177,7 @@ export default class Component extends BaseComponent {
|
||||
'sectionPreferences',
|
||||
course.sectionlist ?? [],
|
||||
{
|
||||
contentexpanded: isAllCollapsed,
|
||||
contentcollapsed: !isAllCollapsed,
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -202,7 +202,7 @@ export default class Component extends BaseComponent {
|
||||
// Update section number and title.
|
||||
{watch: `section.number:updated`, handler: this._refreshSectionNumber},
|
||||
// Collapse and expand sections.
|
||||
{watch: `section.contentexpanded:updated`, handler: this._refreshSectionCollapsed},
|
||||
{watch: `section.contentcollapsed:updated`, handler: this._refreshSectionCollapsed},
|
||||
// Sections and cm sorting.
|
||||
{watch: `transaction:start`, handler: this._startProcessing},
|
||||
{watch: `course.sectionlist:updated`, handler: this._refreshCourseSectionlist},
|
||||
@ -231,7 +231,7 @@ export default class Component extends BaseComponent {
|
||||
const toggler = target.querySelector(this.selectors.COLLAPSE);
|
||||
const isCollapsed = toggler?.classList.contains(this.classes.COLLAPSED) ?? false;
|
||||
|
||||
if (element.contentexpanded === isCollapsed) {
|
||||
if (element.contentcollapsed !== isCollapsed) {
|
||||
toggler.click();
|
||||
}
|
||||
|
||||
@ -253,8 +253,8 @@ export default class Component extends BaseComponent {
|
||||
let allexpanded = true;
|
||||
state.section.forEach(
|
||||
section => {
|
||||
allcollapsed = allcollapsed && !section.contentexpanded;
|
||||
allexpanded = allexpanded && section.contentexpanded;
|
||||
allcollapsed = allcollapsed && section.contentcollapsed;
|
||||
allexpanded = allexpanded && !section.contentcollapsed;
|
||||
}
|
||||
);
|
||||
if (allcollapsed) {
|
||||
|
@ -258,14 +258,14 @@ export default class {
|
||||
if (section === undefined) {
|
||||
return;
|
||||
}
|
||||
let newValue = preferences.contentexpanded ?? section.contentexpanded;
|
||||
if (section.contentexpanded != newValue) {
|
||||
section.contentexpanded = newValue;
|
||||
let newValue = preferences.contentcollapsed ?? section.contentcollapsed;
|
||||
if (section.contentcollapsed != newValue) {
|
||||
section.contentcollapsed = newValue;
|
||||
updatePreferences = true;
|
||||
}
|
||||
newValue = preferences.isactive ?? section.isactive;
|
||||
if (section.isactive != newValue) {
|
||||
section.isactive = newValue;
|
||||
newValue = preferences.indexcollapsed ?? section.indexcollapsed;
|
||||
if (section.indexcollapsed != newValue) {
|
||||
section.indexcollapsed = newValue;
|
||||
updatePreferences = true;
|
||||
}
|
||||
});
|
||||
@ -281,10 +281,10 @@ export default class {
|
||||
indexcollapsed: [],
|
||||
};
|
||||
state.section.forEach(section => {
|
||||
if (!section.contentexpanded) {
|
||||
if (section.contentcollapsed) {
|
||||
preferences.contentcollapsed.push(section.id);
|
||||
}
|
||||
if (!section.isactive) {
|
||||
if (section.indexcollapsed) {
|
||||
preferences.indexcollapsed.push(section.id);
|
||||
}
|
||||
});
|
||||
|
@ -95,7 +95,7 @@ export default class Component extends BaseComponent {
|
||||
|
||||
getWatchers() {
|
||||
return [
|
||||
{watch: `section.isactive:updated`, handler: this._refreshSectionCollapsed},
|
||||
{watch: `section.indexcollapsed:updated`, handler: this._refreshSectionCollapsed},
|
||||
{watch: `cm:created`, handler: this._createCm},
|
||||
{watch: `cm:deleted`, handler: this._deleteCm},
|
||||
{watch: `section:created`, handler: this._createSection},
|
||||
@ -131,7 +131,7 @@ export default class Component extends BaseComponent {
|
||||
'sectionPreferences',
|
||||
[sectionId],
|
||||
{
|
||||
isactive: isCollapsed,
|
||||
indexcollapsed: !isCollapsed,
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -153,7 +153,7 @@ export default class Component extends BaseComponent {
|
||||
const toggler = target.querySelector(this.selectors.COLLAPSE);
|
||||
const isCollapsed = toggler?.classList.contains(this.classes.COLLAPSED) ?? false;
|
||||
|
||||
if (element.isactive === isCollapsed) {
|
||||
if (element.indexcollapsed !== isCollapsed) {
|
||||
this._expandSectionNode(element);
|
||||
}
|
||||
}
|
||||
@ -161,9 +161,9 @@ export default class Component extends BaseComponent {
|
||||
/**
|
||||
* Expand a section node.
|
||||
*
|
||||
* By default the method will use element.isactive to decide if the
|
||||
* By default the method will use element.indexcollapsed to decide if the
|
||||
* section is opened or closed. However, using forceValue it is possible
|
||||
* to open or close a section independant from the isactive attribute.
|
||||
* to open or close a section independant from the indexcollapsed attribute.
|
||||
*
|
||||
* @param {Object} element the course module state element
|
||||
* @param {boolean} forceValue optional forced expanded value
|
||||
@ -182,7 +182,7 @@ export default class Component extends BaseComponent {
|
||||
}
|
||||
|
||||
if (forceValue === undefined) {
|
||||
forceValue = (element.isactive) ? true : false;
|
||||
forceValue = (element.indexcollapsed) ? false : true;
|
||||
}
|
||||
|
||||
// Course index is based on Bootstrap 4 collapsibles. To collapse them we need jQuery to
|
||||
|
@ -168,12 +168,12 @@ class section implements renderable, templatable {
|
||||
$data->sitehome = true;
|
||||
}
|
||||
|
||||
$data->contentexpanded = true;
|
||||
$data->contentcollapsed = false;
|
||||
$preferences = $format->get_sections_preferences();
|
||||
if (isset($preferences[$thissection->id])) {
|
||||
$sectionpreferences = $preferences[$thissection->id];
|
||||
if (!empty($sectionpreferences->contentcollapsed)) {
|
||||
$data->contentexpanded = false;
|
||||
$data->contentcollapsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,16 +62,16 @@ class section implements renderable {
|
||||
$section = $this->section;
|
||||
$modinfo = $format->get_modinfo();
|
||||
|
||||
$isactive = true;
|
||||
$contentexpanded = true;
|
||||
$indexcollapsed = false;
|
||||
$contentcollapsed = false;
|
||||
$preferences = $format->get_sections_preferences();
|
||||
if (isset($preferences[$section->id])) {
|
||||
$sectionpreferences = $preferences[$section->id];
|
||||
if (!empty($sectionpreferences->contentcollapsed)) {
|
||||
$contentexpanded = false;
|
||||
$contentcollapsed = true;
|
||||
}
|
||||
if (!empty($sectionpreferences->indexcollapsed)) {
|
||||
$isactive = false;
|
||||
$indexcollapsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,8 +86,8 @@ class section implements renderable {
|
||||
'visible' => !empty($section->visible),
|
||||
'sectionurl' => course_get_url($course, $section->section)->out(),
|
||||
'current' => $format->is_section_current($section),
|
||||
'isactive' => $isactive,
|
||||
'contentexpanded' => $contentexpanded
|
||||
'indexcollapsed' => $indexcollapsed,
|
||||
'contentcollapsed' => $contentcollapsed
|
||||
];
|
||||
|
||||
// If the section availability restrictions must be displayed.
|
||||
|
@ -29,14 +29,14 @@
|
||||
"id": 42,
|
||||
"number": 1,
|
||||
"sectionurl": "#",
|
||||
"isactive": 1
|
||||
"indexcollapsed": 0
|
||||
},
|
||||
{
|
||||
"title": "City of God or Cidade de Deus",
|
||||
"id": "43",
|
||||
"number": "2",
|
||||
"sectionurl": "#",
|
||||
"isactive": 0
|
||||
"indexcollapsed": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -73,7 +73,7 @@
|
||||
"cmcontrols": "[Add an activity or resource]",
|
||||
"iscoursedisplaymultipage": true,
|
||||
"sectionreturnid": 0,
|
||||
"contentexpanded": true,
|
||||
"contentcollapsed": false,
|
||||
"insertafter": true,
|
||||
"numsections": 42,
|
||||
"sitehome": false
|
||||
@ -125,7 +125,7 @@
|
||||
</div>
|
||||
<div id="coursecontentcollapse{{num}}"
|
||||
class="content {{^iscoursedisplaymultipage}}
|
||||
{{^sitehome}}course-content-item-content collapse {{#contentexpanded}}show{{/contentexpanded}}{{/sitehome}}
|
||||
{{^sitehome}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/sitehome}}
|
||||
{{/iscoursedisplaymultipage}}">
|
||||
<div class="{{#hasavailability}}description small{{/hasavailability}} my-3">
|
||||
{{#summary}}
|
||||
|
@ -46,9 +46,11 @@
|
||||
<a role="button" data-toggle="collapse"
|
||||
href="#coursecontentcollapse{{num}}"
|
||||
id="collapssesection{{num}}"
|
||||
aria-expanded="{{#contentexpanded}}true{{/contentexpanded}}{{^contentexpanded}}false{{/contentexpanded}}"
|
||||
aria-expanded="{{^contentcollapsed}}true{{/contentcollapsed}}{{#contentcollapsed}}false{{/contentcollapsed}}"
|
||||
aria-controls="coursecontentcollapse{{num}}"
|
||||
class="btn btn-icon mr-1 icons-collapse-expand {{^editing}}stretched-link {{/editing}}{{^contentexpanded}}collapsed{{/contentexpanded}}"
|
||||
class="btn btn-icon mr-1 icons-collapse-expand
|
||||
{{^editing}} stretched-link {{/editing}}
|
||||
{{#contentcollapsed}} collapsed {{/contentcollapsed}}"
|
||||
aria-label="{{name}}">
|
||||
<span class="expanded-icon icon-no-margin p-2" title="{{#str}} collapse, core {{/str}}">
|
||||
{{#pix}} t/expandedchevron, core {{/pix}}
|
||||
|
@ -27,7 +27,6 @@
|
||||
"visible": 1,
|
||||
"isactive": 1,
|
||||
"uniqid": "0",
|
||||
"isactive": 1,
|
||||
"accessvisible": 1,
|
||||
"hascmrectrictions": 0
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
"id": 42,
|
||||
"number": 1,
|
||||
"sectionurl": "#",
|
||||
"isactive": 1,
|
||||
"indexcollapsed": 0,
|
||||
"cms": [
|
||||
{
|
||||
"name": "Glossary of characters",
|
||||
@ -64,7 +64,7 @@
|
||||
"id": "43",
|
||||
"number": "2",
|
||||
"sectionurl": "#",
|
||||
"isactive": 0,
|
||||
"indexcollapsed": 1,
|
||||
"cms": [
|
||||
{
|
||||
"name": "Resources",
|
||||
|
@ -26,7 +26,7 @@
|
||||
"uniqid": "0",
|
||||
"number": 1,
|
||||
"sectionurl": "#",
|
||||
"isactive": 1,
|
||||
"indexcollapsed": 0,
|
||||
"current": 1,
|
||||
"visible": 1,
|
||||
"hasrectrictions": 0,
|
||||
@ -73,8 +73,8 @@
|
||||
>
|
||||
<a data-toggle="collapse"
|
||||
href="#courseindexcollapse{{number}}"
|
||||
class="courseindex-link icons-collapse-expand {{^isactive}}collapsed{{/isactive}}"
|
||||
aria-expanded="{{#isactive}}true{{/isactive}}{{^isactive}}false{{/isactive}}"
|
||||
class="courseindex-link icons-collapse-expand {{#indexcollapsed}}collapsed{{/indexcollapsed}}"
|
||||
aria-expanded="{{^indexcollapsed}}true{{/indexcollapsed}}{{#indexcollapsed}}false{{/indexcollapsed}}"
|
||||
aria-controls="courseindexcollapse{{number}}"
|
||||
tabindex="-1"
|
||||
>
|
||||
@ -106,7 +106,7 @@
|
||||
<span class="dragicon ml-auto">{{#pix}}i/dragdrop{{/pix}}</span>
|
||||
</div>
|
||||
<div id="courseindexcollapse{{number}}"
|
||||
class="courseindex-item-content collapse {{#isactive}}show{{/isactive}}"
|
||||
class="courseindex-item-content collapse {{^indexcollapsed}}show{{/indexcollapsed}}"
|
||||
aria-labelledby="courseindexsection{{number}}"
|
||||
>
|
||||
<ul class="courseindex-sectioncontent unlist" data-for="cmlist" data-id="{{id}}" role="group">
|
||||
|
Loading…
x
Reference in New Issue
Block a user