Commit graph

951 commits

Author SHA1 Message Date
Andrew Nicols
fe80eecc44
MDL-79064 core: Improve Native promise support
As we migrate to primarily using natives promises, we should make it
easier to use and consume them.

This change:
- updates core/str to add new methods for:
  - getString
  - getStrings
- accept Native promises into Modal setters
2023-08-29 10:57:06 +08:00
Sara Arjona
67f225429b
Merge branch 'MDL-78248' of https://github.com/paulholden/moodle 2023-08-28 13:52:50 +02:00
Paul Holden
c1a3e17a0b
MDL-78248 libraries: upgrade to version 4.4.0 of ChartJS. 2023-08-24 17:22:09 +01:00
Mark Johnson
e81a8381a8 MDL-72321 core: Allow datafilters to be marked required
Required datafilters cannot be removed. There will be no remove button
on the filter row, and the "Clear filters" button will ignore them.
2023-08-24 11:09:37 +01:00
Mark Johnson
1d64f468d1 MDL-72321 core: Allow custom filteroptions to be passed by datafilters
This allows datafilters to include additional fields other than the standard list of selected values.
For example they may wish to include an additional select or checkbox to change how the values are used in the resulting query.
2023-08-24 11:09:34 +01:00
Ilya Tregubov
4bed4ea8f3
Merge branch 'MDL-71212-collapse-expand-all-sections-in-course-index-drawer' of https://github.com/stopfstedt/moodle 2023-08-24 09:22:23 +08:00
Safat
4b9438431e MDL-75318 core: JS updates for sharing course to MoodleNet 2023-08-22 11:00:06 +10:00
Stefan Topfstedt
7b04638c52 MDL-71212 core_course: adds controls to the course index drawer. 2023-08-18 11:00:55 -07:00
Jun Pataleta
4ef1f2fabd
Merge branch 'MDL-78962' of https://github.com/timhunt/moodle 2023-08-10 18:32:22 +07:00
Tim Hunt
788580c9dd MDL-78962 core/loadingicon: remove jQuery requirement in the API 2023-08-09 21:10:13 +01:00
Jun Pataleta
51e86626d1
Merge branch 'MDL-77174-master' of https://github.com/andrewnicols/moodle 2023-08-08 15:15:32 +08:00
Ferran Recio
105324e6fd MDL-78665 output: add subpanels to action menu
Many times the action menu item triggers modals to show more information
to the user. In most cases this is enough, however, a modal will close
the menu and the user is not able to see the modal content in the page
context. To solve this now menus can define subpanels that are displayed
next the the menu item when the item is focused or hover. This will be
used to group options like the group mode in activities or to replace
the adhoc solution implemented to select language in the user menu.
2023-08-04 16:09:29 +02:00
Ferran Recio
3b53616321 MDL-78665 libs: page helpers global amd module
Add a new global module to get information from the page. Some methods
are just local functions moved to as a global library. For example, the
drawers isSmall or isLarge to detect the page width. The other funcionts
added are to detect focusable elements and they are needed to loop on
elements, especially when accessibility keyboard navigation is implemented.
2023-08-04 16:07:59 +02:00
Mathew May
a4b3b0d044 MDL-77991 core: Move tertiary search dropdown component 2023-08-03 09:07:18 +08:00
Andrew Nicols
cad1c7d008
MDL-77174 core: Modal z-index calc should ignore hidden items
When an AMD dialogue is opened from a YUI dialogue, the YUI dialogue is
not actually removed from the DOM, but was counted in z-index
calculation.

We need to stop including it otherwise nested AMD => YUI => AMD
dialogues get broken.
2023-07-31 10:57:09 +08:00
Andrew Nicols
dbf3bccf99
MDL-77174 core: Add support for button sources to modal utility 2023-07-31 10:56:22 +08:00
Andrew Nicols
715902c9c0
MDL-77174 core: Provide default anchor support to modal utility 2023-07-31 10:56:22 +08:00
Andrew Nicols
96dfb8382e
MDL-77174 core: Provide default strings for modal utility 2023-07-31 10:56:22 +08:00
Andrew Nicols
42d3e7de14
MDL-77174 core: Add getElement to core/normalise 2023-07-31 10:56:04 +08:00
Jun Pataleta
844257a539
Merge branch 'MDL-76046-master' of https://github.com/stevandoMoodle/moodle 2023-07-13 16:51:37 +02:00
Ilya Tregubov
09c7cd98f4
Merge branch 'MDL-73213' of https://github.com/pedrojordao/moodle 2023-07-13 16:49:58 +02:00
Andrew Nicols
3ff84d3eb7
MDL-78316 core: Improve jsdoc typedef for icons 2023-07-07 16:31:54 +08:00
Andrew Nicols
f57af194fb
MDL-78316 core: Update async promises
Writing a Promise as:
```
const promise = new Promise(async (resolve, reject) => {
  return await 'foo';
});
```

Is equivalent to an IIFE:
```
const promise = (async () => {
  return await 'foo';
})();
```

A recent change introduced by MDL-74301 picks this up.

This commit addresses this flagged issue.
2023-07-07 16:23:26 +08:00
Andrew Nicols
5b54ac43b1
MDL-78316 core: Move IconSystem init to Factory
This is throwback to times when we understood JS less.

We should not have the factory method for the IconSystem in
core/templates.
2023-07-07 16:13:28 +08:00
Andrew Nicols
c0043004e1
MDL-78316 core: Convert IconSystems to ESM 2023-07-07 16:13:27 +08:00
Pedro Jordao
8658b4937f MDL-73213 autocomplete: keep selected value when the state changes.
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.
2023-07-06 14:52:18 -03:00
Ilya Tregubov
048edee1e2
Merge branch 'MDL-74301-master' of https://github.com/kabalin/moodle 2023-07-06 09:06:31 +08:00
Huong Nguyen
54d470c313
Merge branch 'MDL-77732-master' of https://github.com/lameze/moodle 2023-07-04 17:10:26 +07:00
Stephan Robotta
1468ecf294
MDL-77732 navigation: fix active flag in navigation for custom menus
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.
2023-07-04 17:10:15 +07:00
Stephan Robotta
a617b9f6d7
MDL-77732 navigation: fix active flag in navigation for custom menus 2023-07-04 17:09:59 +07:00
Ruslan Kabalin
572ca40ce7 MDL-74301 eslint: Enable 'reportUnusedDisableDirectives' eslint setting
This will warn on unused /* eslint-disable */ statements.
2023-07-03 15:21:53 +01:00
Ruslan Kabalin
80a111d25e MDL-74301 eslint: Address issues reported by eslint 2023-07-03 15:21:53 +01:00
Stevani Andolo
db76214e5d MDL-76046 core: Fixed secondary navigation on smaller screen 2023-06-30 06:30:47 +08:00
Mikel Martín
fb49de8875 MDL-78204 core: Add new showmore/showless UI component
- 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
2023-06-26 09:32:39 +02:00
Andrew Nicols
0dfcb91ca2 Merge branch 'MDL-78350' of https://github.com/paulholden/moodle 2023-06-22 14:29:40 +02:00
Paul Holden
40cc1e53c2
MDL-78350 output: parse returned dynamic tab javascript when loading.
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>
2023-06-21 17:25:34 +01:00
Mathew May
0fb1152345 MDL-78274 modal: Enable modals to be vertically centered 2023-06-21 14:51:26 +08:00
Andrew Nicols
9ce8a9e637
MDL-78306 core: Correct modal jsdoc 2023-06-14 21:52:55 +08:00
Andrew Nicols
af604082df
MDL-78306 core: Migrate core/config to ESM 2023-06-14 21:52:55 +08:00
Andrew Nicols
80780f755a
MDL-78306 core: Convert modal_backdrop to ESM 2023-06-14 21:52:55 +08:00
Andrew Nicols
a571b7c8bf
MDL-78306 core: Convert modal_events to ESM 2023-06-14 21:52:55 +08:00
Andrew Nicols
c6c871e2ce
MDL-78306 core: Convert modal_factory to ESM 2023-06-14 21:52:54 +08:00
Andrew Nicols
77b4d0236f
MDL-78306 core: Provide helper method to register modals classes 2023-06-14 21:41:49 +08:00
Andrew Nicols
fcb6fdf393
MDL-78306 core: Convert core/modal to ESM 2023-06-14 21:41:49 +08:00
Ilya Tregubov
59cd47c02f
Merge branch 'MDL-62859' of https://github.com/paulholden/moodle 2023-06-01 10:12:14 +08:00
Ilya Tregubov
accddabca3
Merge branch 'MDL-77168-master' of https://github.com/andrewnicols/moodle 2023-05-31 10:22:02 +08:00
Andrew Nicols
18dc795907
MDL-78266 core: Simplify string fetching/storing/retrieval
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.
2023-05-25 13:42:15 +08:00
Andrew Nicols
a438e2c72d
MDL-78266 core: Simplify string treatment in core/templates
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.
2023-05-25 13:42:08 +08:00
Andrew Nicols
1ef815cd97
MDL-78266 core: Break apart core/templates
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
2023-05-25 13:42:00 +08:00
Andrew Nicols
16dee82ce5
MDL-78266 core: Migrate core/templates to esm 2023-05-25 12:09:46 +08:00