MDL-73880 core_courseformat: fix section availability box

This commit is contained in:
Ferran Recio 2022-02-16 17:26:42 +01:00
parent 7fe8e34f7d
commit ce887084fe
7 changed files with 14 additions and 6 deletions

View File

@ -6,6 +6,6 @@ define("core_courseformat/local/content/section",["exports","core_courseformat/l
* @class core_courseformat/local/content/section * @class core_courseformat/local/content/section
* @copyright 2021 Ferran Recio <ferran@moodle.com> * @copyright 2021 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_header=_interopRequireDefault(_header),_dndsection=_interopRequireDefault(_dndsection);class _default extends _dndsection.default{create(){this.name="content_section",this.selectors={SECTION_ITEM:"[data-for='section_title']",CM:'[data-for="cmitem"]'},this.classes={LOCKED:"editinprogress"},this.id=this.element.dataset.id}stateReady(state){if(this.configState(state),this.reactive.isEditing&&this.reactive.supportComponents){const sectionItem=this.getElement(this.selectors.SECTION_ITEM);if(sectionItem){const headerComponent=new _header.default({...this,element:sectionItem,fullregion:this.element});this.configDragDrop(headerComponent)}}}getWatchers(){return[{watch:"section[".concat(this.id,"]:updated"),handler:this._refreshSection}]}validateDropData(dropdata){return("section"!==(null==dropdata?void 0:dropdata.type)||0==this.reactive.sectionReturn)&&super.validateDropData(dropdata)}getLastCm(){const cms=this.getElements(this.selectors.CM);return cms&&0!==cms.length?cms[cms.length-1]:null}_refreshSection(_ref){var _element$dragging,_element$locked;let{element:element}=_ref;this.element.classList.toggle(this.classes.DRAGGING,null!==(_element$dragging=element.dragging)&&void 0!==_element$dragging&&_element$dragging),this.element.classList.toggle(this.classes.LOCKED,null!==(_element$locked=element.locked)&&void 0!==_element$locked&&_element$locked),this.locked=element.locked}}return _exports.default=_default,_exports.default})); */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_header=_interopRequireDefault(_header),_dndsection=_interopRequireDefault(_dndsection);class _default extends _dndsection.default{create(){this.name="content_section",this.selectors={SECTION_ITEM:"[data-for='section_title']",CM:'[data-for="cmitem"]',SECTIONINFO:'[data-for="sectioninfo"]'},this.classes={LOCKED:"editinprogress",HASDESCRIPTION:"description"},this.id=this.element.dataset.id}stateReady(state){if(this.configState(state),this.reactive.isEditing&&this.reactive.supportComponents){const sectionItem=this.getElement(this.selectors.SECTION_ITEM);if(sectionItem){const headerComponent=new _header.default({...this,element:sectionItem,fullregion:this.element});this.configDragDrop(headerComponent)}}}getWatchers(){return[{watch:"section[".concat(this.id,"]:updated"),handler:this._refreshSection}]}validateDropData(dropdata){return("section"!==(null==dropdata?void 0:dropdata.type)||0==this.reactive.sectionReturn)&&super.validateDropData(dropdata)}getLastCm(){const cms=this.getElements(this.selectors.CM);return cms&&0!==cms.length?cms[cms.length-1]:null}_refreshSection(_ref){var _element$dragging,_element$locked;let{element:element}=_ref;this.element.classList.toggle(this.classes.DRAGGING,null!==(_element$dragging=element.dragging)&&void 0!==_element$dragging&&_element$dragging),this.element.classList.toggle(this.classes.LOCKED,null!==(_element$locked=element.locked)&&void 0!==_element$locked&&_element$locked),this.locked=element.locked;const sectioninfo=this.getElement(this.selectors.SECTIONINFO);sectioninfo&&sectioninfo.classList.toggle(this.classes.HASDESCRIPTION,element.hasrestrictions)}}return _exports.default=_default,_exports.default}));
//# sourceMappingURL=section.min.js.map //# sourceMappingURL=section.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -37,10 +37,12 @@ export default class extends DndSection {
this.selectors = { this.selectors = {
SECTION_ITEM: `[data-for='section_title']`, SECTION_ITEM: `[data-for='section_title']`,
CM: `[data-for="cmitem"]`, CM: `[data-for="cmitem"]`,
SECTIONINFO: `[data-for="sectioninfo"]`,
}; };
// Most classes will be loaded later by DndCmItem. // Most classes will be loaded later by DndCmItem.
this.classes = { this.classes = {
LOCKED: 'editinprogress', LOCKED: 'editinprogress',
HASDESCRIPTION: 'description',
}; };
// We need our id to watch specific events. // We need our id to watch specific events.
@ -120,5 +122,10 @@ export default class extends DndSection {
this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false); this.element.classList.toggle(this.classes.DRAGGING, element.dragging ?? false);
this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false); this.element.classList.toggle(this.classes.LOCKED, element.locked ?? false);
this.locked = element.locked; this.locked = element.locked;
// The description box classes depends on the section state.
const sectioninfo = this.getElement(this.selectors.SECTIONINFO);
if (sectioninfo) {
sectioninfo.classList.toggle(this.classes.HASDESCRIPTION, element.hasrestrictions);
}
} }
} }

View File

@ -128,7 +128,7 @@
class="content {{^iscoursedisplaymultipage}} class="content {{^iscoursedisplaymultipage}}
{{^sitehome}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/sitehome}} {{^sitehome}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/sitehome}}
{{/iscoursedisplaymultipage}}"> {{/iscoursedisplaymultipage}}">
<div class="{{#hasavailability}}description small{{/hasavailability}} my-3"> <div class="{{#hasavailability}}description{{/hasavailability}} my-3" data-for="sectioninfo">
{{#summary}} {{#summary}}
{{$ core_courseformat/local/content/section/summary }} {{$ core_courseformat/local/content/section/summary }}
{{> core_courseformat/local/content/section/summary }} {{> core_courseformat/local/content/section/summary }}

View File

@ -1132,7 +1132,6 @@ span.editinstructions {
} }
> div { > div {
display: inline-block;
float: right; float: right;
> div { > div {
@ -1340,6 +1339,8 @@ $activity-add-hover: theme-color-level('primary', -10) !default;
} }
.description .course-description-item { .description .course-description-item {
@include font-size($small-font-size);
background-color: $gray-100; background-color: $gray-100;
padding-left: map-get($spacers, 3); padding-left: map-get($spacers, 3);
padding-right: map-get($spacers, 3); padding-right: map-get($spacers, 3);

View File

@ -14561,7 +14561,6 @@ span.editinstructions {
display: inline-block; display: inline-block;
text-align: left; } text-align: left; }
.coursecat-management-header > div { .coursecat-management-header > div {
display: inline-block;
float: right; } float: right; }
.coursecat-management-header > div > div { .coursecat-management-header > div > div {
margin: 10px 0 10px 1em; margin: 10px 0 10px 1em;
@ -14707,6 +14706,7 @@ span.editinstructions {
display: inline-block; } display: inline-block; }
.description .course-description-item { .description .course-description-item {
font-size: 80%;
background-color: #f8f9fa; background-color: #f8f9fa;
padding-left: 1rem; padding-left: 1rem;
padding-right: 1rem; } padding-right: 1rem; }

View File

@ -14561,7 +14561,6 @@ span.editinstructions {
display: inline-block; display: inline-block;
text-align: left; } text-align: left; }
.coursecat-management-header > div { .coursecat-management-header > div {
display: inline-block;
float: right; } float: right; }
.coursecat-management-header > div > div { .coursecat-management-header > div > div {
margin: 10px 0 10px 1em; margin: 10px 0 10px 1em;
@ -14707,6 +14706,7 @@ span.editinstructions {
display: inline-block; } display: inline-block; }
.description .course-description-item { .description .course-description-item {
font-size: 80%;
background-color: #f8f9fa; background-color: #f8f9fa;
padding-left: 1rem; padding-left: 1rem;
padding-right: 1rem; } padding-right: 1rem; }