Skip to content

Commit

Permalink
MDL-73880 core_courseformat: fix section availability box
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranrecio committed Mar 2, 2022
1 parent 7fe8e34 commit ce88708
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion course/format/amd/build/local/content/section.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion course/format/amd/build/local/content/section.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions course/format/amd/src/local/content/section.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export default class extends DndSection {
this.selectors = {
SECTION_ITEM: `[data-for='section_title']`,
CM: `[data-for="cmitem"]`,
SECTIONINFO: `[data-for="sectioninfo"]`,
};
// Most classes will be loaded later by DndCmItem.
this.classes = {
LOCKED: 'editinprogress',
HASDESCRIPTION: 'description',
};

// We need our id to watch specific events.
Expand Down Expand Up @@ -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.LOCKED, element.locked ?? false);
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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
class="content {{^iscoursedisplaymultipage}}
{{^sitehome}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/sitehome}}
{{/iscoursedisplaymultipage}}">
<div class="{{#hasavailability}}description small{{/hasavailability}} my-3">
<div class="{{#hasavailability}}description{{/hasavailability}} my-3" data-for="sectioninfo">
{{#summary}}
{{$ core_courseformat/local/content/section/summary }}
{{> core_courseformat/local/content/section/summary }}
Expand Down
3 changes: 2 additions & 1 deletion theme/boost/scss/moodle/course.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,6 @@ span.editinstructions {
}

> div {
display: inline-block;
float: right;

> div {
Expand Down Expand Up @@ -1340,6 +1339,8 @@ $activity-add-hover: theme-color-level('primary', -10) !default;
}

.description .course-description-item {
@include font-size($small-font-size);

background-color: $gray-100;
padding-left: map-get($spacers, 3);
padding-right: map-get($spacers, 3);
Expand Down
2 changes: 1 addition & 1 deletion theme/boost/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -14561,7 +14561,6 @@ span.editinstructions {
display: inline-block;
text-align: left; }
.coursecat-management-header > div {
display: inline-block;
float: right; }
.coursecat-management-header > div > div {
margin: 10px 0 10px 1em;
Expand Down Expand Up @@ -14707,6 +14706,7 @@ span.editinstructions {
display: inline-block; }

.description .course-description-item {
font-size: 80%;
background-color: #f8f9fa;
padding-left: 1rem;
padding-right: 1rem; }
Expand Down
2 changes: 1 addition & 1 deletion theme/classic/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -14561,7 +14561,6 @@ span.editinstructions {
display: inline-block;
text-align: left; }
.coursecat-management-header > div {
display: inline-block;
float: right; }
.coursecat-management-header > div > div {
margin: 10px 0 10px 1em;
Expand Down Expand Up @@ -14707,6 +14706,7 @@ span.editinstructions {
display: inline-block; }

.description .course-description-item {
font-size: 80%;
background-color: #f8f9fa;
padding-left: 1rem;
padding-right: 1rem; }
Expand Down

0 comments on commit ce88708

Please sign in to comment.