Course formats may want to preserve the existing section information,
but either change the wrapper (.section .course-section-header), or
prepend and append additional content to it.
Prior to this change, the only way to do this was by copying the entire
content of the template.
This change moves the content of the .course-section-header to a
separate template.
This means that a course format can replace the .section
.course-section-header wrapper whilst retaining its content by
overriding the content/section template and including the
content/section/content template. For example:
```
<li id="section-{{num}}"{{!
}} class="section course-section main clearfix{{!
}}{{#onlysummary}} section-summary{{/onlysummary}}{{!
}}{{#ishidden}} hidden{{/ishidden}}{{!
}}{{#iscurrent}} current{{/iscurrent}}{{!
}}{{#isstealth}} orphaned{{/isstealth}}{{!
}}"
data-sectionid="{{num}}"
data-sectionreturnid="{{sectionreturnid}}"
data-for="section"
data-id="{{id}}"
data-number="{{num}}"{{!
}}>
<!--
Add a custom div to the existing wrapper, without replacing the
entire content of the section/content.
-->
<div class="my-custom-content">
<!--
The upstream content is here:
-->
<div class="course-section-header d-flex"
data-for="section_title"
data-id="{{id}}"
data-number="{{num}}"
>
{{$ core_courseformat/local/content/cm/section/content }}
{{> core_courseformat/local/content/cm/section/content }}
{{/ core_courseformat/local/content/cm/section/content }}
</div>
</div>
</li>
```
It also means that a course format can append additional information to
this wrapper, for example:
```
{{< core_courseformat/local/content/section }}
{{$ core_courseformat/local/content/cm/section/content }}
<div class="some-custom-class">
<!--
Some custom content appended _before_ the course section
content but within the wrapper
-->
</div>
{{> core_courseformat/local/content/cm/section/content }}
<div class="some-custom-class">
<!--
Some custom content appended _after_ the course section
content but within the wrapper
-->
</div>
{{/ core_courseformat/local/content/cm/section/content }}
{{/ core_courseformat/local/content/section }}
```
Course formats may want to preserve the existing activity information,
but either change the wrapper (.activity-item), or prepend and append
additional content to it.
Prior to this change, the only way to do this was by copying the entire
content of the template.
This change moves the content of the activity-item to a separate
template.
This means that a course format can replace the activity-item wrapper
whilst retaining its content by overriding the cm template and including
the cm/activity template. For example:
```
<div class="my-custom-activity-item {{!
}}{{#modstealth}}hiddenactivity{{/modstealth}}{{!
}}{{#modhiddenfromstudents}}hiddenactivity{{/modhiddenfromstudents}}{{!
}}{{#modinline}}activityinline{{/modinline}}" data-activityname="{{activityname}}">
{{#moveicon}} {{{moveicon}}} {{/moveicon}}
{{$ core_courseformat/local/content/cm/activity }}
{{> core_courseformat/local/content/cm/activity }}
{{/ core_courseformat/local/content/cm/activity }}
</div>
```
It also means that a course format can append additional information to
this wrapper, for example:
```
{{< core_courseformat/local/content/cm }}
{{$ core_courseformat/local/content/cm/activity }}
{{> core_courseformat/local/content/cm/activity }}
{{#cmmeta}}
<div class="ct-activity-meta-container">
{{{cmmeta}}}
</div>
{{/cmmeta}}
{{/ core_courseformat/local/content/cm/activity }}
{{/ core_courseformat/local/content/cm }}
```
For legacy reasons, the course renderings uses a format setting to know
if the page is multiple sections per page or a single section per page.
This format specific dependency is not solved using a get_course_display
format method any plugin can extend.
For the three unit tests that are going to be modified in future
commit, I first changed them to use a namespace and class name
matching filename, as per current standard.
Moodle announced that support for IE would be dropped back in August
2020 with Moodle 3.9 but not active steps were taken at that time. That
decision was made in MDLSITE-6109 and this particular step was meant to
be taken in Moodle 3.10.
This is the first step taken to actively drop support for IE.
This commit also bumps the browser support pattern from 0.25% to 0.3%.
The percentage here includes any browser where at least this percentage
of users worldwide may be using a browser. In this case it causes
support for Android 4.3-4.4 to be dropped, which relate to Android
KitKat (released 2013).
This combination of changes means that all of the supported browsers in
our compatibility list support modern features including async,
for...of, classes, native Promises, and more which has a huge impact on
the ease of debugging code, and drastically reduces the minified file
size because a number of native Polyfills included by Babel are no
longer included.
Unfortunately the babel minify-mangle plugin seems to be abandoned and
in certain circumstances can be very buggy. The only safe options are to
disable it, or to switch to a different minification library.
Not minifying our javascript is not ideal, so this commit updates the
javascript tasks to use a rollup, combined with babel, and terser.
Babel still converts code from ES/UMD/AMD to AMD modules with the
relevant browser support, whilst terser minifies the code.
The rollup bundler handles tracking and creation of sourcemaps, and
supports better parallelisation of the tasks.
Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core
and eslint, which change the built files anyway, this seems like the
ideal time to make this change.
This issue is a followup for changes made in forum. And hence
addresses the following issues spotted for forum:
1. Bring back the "Forums" header in the search page.
2. Remove the stale function forum_update_subscriptions_button
3. Fix the redirection to activity tab when subscription is
changed, in the subscription tab.
Now content and course index sections have special mutations to store
the collapsed preferences. This way the backend implementation is
independent of the frontend one and can use caches or other kind of
optimizations of necessary.
Orignally, the lock icon in the course index and the course content
represents different things and it was confusing for users. Now both
section and cm state data calculate the hasRestrictions attribute the
same way as the course content lock icons.
The first week is only highlighted if course starts today or
later. So, the course will be created with startdate on
yesterday to guarantee it always passes.
Move the section visible logic to the format base class. This way format
plugins can decide whenever a section is visible or not instead of using
format custom settings from core.
The course index lock icon depends on the state hasrestrictions
attributes on both section and course module. The lock icon
should be consistent with the content availability information
and it was not. With this patch the hasrestrictions attribute
uses a similar logic than the course content.
The versioning changes will require some major changes
in the backup and restore of question bank and its
elements. This change introduces those changes to make
it compatible with the new world of versioning in question
bank. This commit also removes quiz_slots fields and
quiz_slot_tags table.
This commit will also introduce the versioning db
structure and some major changes to the quiz
and quiz attempts for the question, random
question and the view.
This commit implements the behat changes for versioning
in core question and associated locations.
The current manual completion button triggers an event to alert the page
of any completion change. This event is capture in the course page by
the core_courseformat/local/content module but it was ignored when this
happens in an activity page. Now the activity header has its own
component to capture this event and support possible future reactive
actions.