The selected value of the dropdown was being cleared when the dropdown
was opened, this was causing an error when submitting the form if the
field was required. The main cause was that we were emptying the
select before loading new values, this solution was created because
of an issue where we could not deselect values if the list was
reloaded. To fix this problem, I added an empty option as the first
element of the select only when deselecting a certain item.
This is a follow up of MDL-75908 because a Behat tests with the Chrome
driver was failing and it could be traced back to the changes of
MDL-750908. There was no issue with the Firefox driver and
apparently no issue when using the Chrome browser under normal
circumstances.
- Create a new 'showmore' template that receives both collapsed and expanded content.
Initially only the collapsed content will be displayed with a "Show more" button. When it is expanded,
only the expanded content will be displayed with "Show less" button.
- Add 'showmore' component to component library
Ensure we don't create nested <script> tags when rendering templates,
which triggers console errors since 1ef815cd.
Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
Rather than storing strings by an ID, we instead store them by the
string placeholder value.
This means that:
- we can fetch them by placeholder (e.g. `[[_s144]]`) rather than by
index
- we can lazily clean them on fetch
- we only clean them once, rather than on every insertion.
The old handling was extremely convoluted, and likely inefficient.
It's much clearer to use a regex with named groups and loop through in a
standard way.
This commit breaks apart the responsibilities of the core/templates
module to separate out the different constituent parts. Broadly speaking
these are:
- core/local/templates/loader - responsible for fetching, and caching,
of templates
- core/local/templates/renderer - A Moodle wrapper around the Mustache
engine
When clicked, disable the "Edit mode" button just before doing a
redirection. It's been reported that after clicling several times the
button, an inconsistent state between the button and the editing mode is
achieved. The patch mitigates the issue.