Commit Graph

44 Commits

Author SHA1 Message Date
Ferran Recio
5e445c0e3a MDL-77420 core: fix modal close button on remove on close 2023-03-07 13:13:44 +01:00
Ferran Recio
b1ad8480fe MDL-76848 core: add disable buttons to modals 2023-02-17 10:07:32 +01:00
Laurent David
377c962f11 MDL-75337 core: Single button - API changes
* Update component library for new features of single_button and modal
    * Update core_notification javascript
2023-01-23 13:45:21 +01:00
Huong Nguyen
887f193c38 MDL-72523 javascript: Introduce setReturnElement for core/modal 2022-12-28 11:14:38 +00:00
Andrew Nicols
e1b9d5f3cd MDL-73915 js: Drop support for IE and android
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.
2022-02-23 08:55:20 +08:00
Andrew Nicols
0a4047ab31 MDL-73915 js: Switch amd minification to terser
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.
2022-02-23 08:55:09 +08:00
Andrew Nicols
aa7f7957ea MDL-73915 js: Upgrade babel and eslint 2022-02-23 08:53:54 +08:00
Andrew Nicols
d4c6ac20c7 MDL-70990 core_filter: Add new native filterContentUpdated event
The legacy M.core.event.FILTER_CONTENT_UPDATED event has been replaced with a
new core_filter/events::filterContentUpdated native DOM event.

The new event can be triggered using the `notifyFilterContentUpdated`
function, and by providing with an Array containing the HTMLElements
that were updated, for example:

```
import {notifyFilterContentUpdated} from 'core_filter/events';

const someHandler = e => {
    // ...
    const nodeList = Array.from(document.querySelectorAll('div'));
    notifyFilterContentUpdated(nodeList);
};
```

The new event can be listened to at any point in the DOM using the
following syntax:

```
import {eventTypes} from 'core_filter/events';

const handler = e => {
    // The list of HTMLElements in an Array.
    e.detail.nodes;
};

document.addEventListener(eventTypes.filterContentUpdated, handler);
```

A backward-compatabibility layer is included to ensure that any legacy
YUI event listener, or jQuery event listener are still called with the
same arguments.

This legacy bridges will be removed after Moodle 4.3.
2021-05-26 10:47:15 +08:00
Paul Holden
11099c15bb MDL-70962 forms: catch modal exceptions when getting body content.
They are thrown in the following circumstances:

 * The dynamic form class doesn't exist;
 * It does exist but it's `check_access` method throws exception

Co-Authored-By: Andrew Nicols <andrew@nicols.co.uk>
2021-03-25 17:26:36 +00:00
Marina Glancy
72be49c473 MDL-64554 core_form: new API for modal forms 2021-02-17 18:06:49 +01:00
Dmitrii Metelkin
21789c7168 MDL-70352 core: attach modal to a specific element 2020-12-31 14:02:20 +11:00
Andrew Nicols
78962293ef MDL-67513 core: Only move modal to body if currently attached
A previous change as part of this commitset was intended to move the
modal to the document.body, but where the modal had been destroyed it
was instead added back to the body.
2020-11-16 15:19:32 +08:00
Neill Magill
524253382c MDL-67513 forum: View conversations while fullscreen grading
Before this change when a modal was shown and an element on the page
was fullscreen the modal would be created behind it.

This change ensures that the modal will be inside an element that is
fullscreen so that it will be correctly displayed.
2020-11-12 08:35:55 +00:00
Marina Glancy
7740c45de4 MDL-69166 core_form: allow modals to prevent closing on accidental click 2020-10-27 14:37:28 +11:00
Andrew Nicols
7cc18dc2ad MDL-68390 js: Update to use Aria mod 2020-07-15 14:40:49 +08:00
Andrew Nicols
4f1c8ce764 MDL-68390 aria: Add new core_aria module 2020-07-15 14:40:49 +08:00
Mihail Geshoski
e13cbf9e27 MDL-60621 js: Add ability to set a modal to be scrollable or not
With this change the modal can be configured to be scrollable or not.
If enabled to be 'scrollable', the modal's body will become scrollable
when the modal's height exceeds the browser's height. This is useful
in cases where the content in the modal is quite large and extends the
modal beyond the browser's height, which usually results in a bad UI.
If 'scrollable' is not explicitely configured, it will be set as 'true'
by default as in most cases it would be the expected behaviour.
2020-06-30 10:18:19 +08:00
Jun Pataleta
2a202f3b97 Merge branch 'MDL-68529' of https://github.com/Chocolate-lightning/moodle 2020-05-14 12:51:35 +08:00
Mathew May
f2d033a2bb MDL-68529 course: Refactor chooser to include loading 2020-05-12 16:59:54 +08:00
Andrew Nicols
f879cc518e MDL-66109 js: Build changes for NodeJS upgrade
This change includes a build to fix all minified file changes in Moodle
as a result of upgrades to our build process.
2020-05-11 10:55:54 +08:00
Andrew Nicols
fc3d7d693a MDL-68409 js: Fix eslint failure in modal 2020-05-04 15:07:48 +08:00
Andrew Nicols
92810f7af9 MDL-68409 js: Add setButtonText modal helper 2020-05-04 15:07:48 +08:00
Andrew Nicols
fa6101ba27 MDL-68409 js: Add helper to register close event on save/cancel 2020-05-04 15:07:48 +08:00
Andrew Nicols
604887ce8f MDL-67827 behat: Pending JS improvements for dialogues 2020-03-06 12:59:38 +08:00
Mathew May
e6a5298394 MDL-67264 lib modal: Add deffered promises to content promises 2020-02-13 09:15:41 +08:00
Andrew Nicols
c50bc1bf7c MDL-67207 core: Use focus lock manager in modals 2019-11-13 14:30:54 +08:00
Ryan Wyllie
035bd996cb MDL-66893 mod_forum: show expand conversation in nested view 2019-11-07 14:53:37 +08:00
Ryan Wyllie
195ea4480b MDL-62497 javascript: build AMD modules with new transpiler 2019-07-19 14:12:49 +08:00
Damyon Wiese
cdc7390446 MDL-64331 modals: Be careful closing modals
Don't close a modal when the user clicks outside of it and the modal contains a form.
2019-04-02 10:02:26 +08:00
Shamim Rezaie
b6ece79d81 MDL-63722 javascript: misinterpret as outside click if DOM is modified 2018-12-19 16:01:09 +11:00
Andrew Nicols
4d1a42fb7c MDL-63094 js: Do not check visibility before hiding backdrop
It's possible for the backdrop to be created during the show, before the
modal is actually fully shown.

This check is unnecessary because the getBackdrop() function always
returns a value and will always succeed.
2018-08-22 10:23:30 +08:00
Treu Quan
30e1f5a023 MDL-60207 javascript: close modal when user touch/click outside it 2018-05-29 10:04:37 +08:00
Bas Brands
ae0629d284 MDL-62171 Theme boost: modal accessibility focus 2018-05-03 11:54:26 +02:00
Ryan Wyllie
2328bcccde MDL-61135 javascript: fix modal body height resizing when loading 2018-02-02 03:57:25 +00:00
Ryan Wyllie
368832d51c MDL-59936 javascript: hide modal footer without content 2017-10-30 08:33:54 +08:00
Andrew Nicols
4c250a5b79 MDL-60489 javascript: Add missing promise fails 2017-10-23 20:26:57 +08:00
Ryan Wyllie
946f9d0a4e MDL-60489 javascript: add animations to modal setBody 2017-10-23 07:57:03 +00:00
Andrew Nicols
e5bdf51ce5 MDL-59784 core: Check for non-promises rather than string
If a malformed value was passed, it may be that we can still display it.
We should not assume that, if a string is not passed, that we are
dealing with a promise.
2017-08-23 10:25:15 +08:00
Andrew Nicols
e2b503043e MDL-59784 core: Modal should accept title as a promise 2017-08-18 22:51:47 +08:00
Ryan Wyllie
4defa05fdc MDL-59382 javascript: fix large styling for modals 2017-08-02 04:47:42 +00:00
Simey Lameze
97c4a29d41 MDL-59384 core_modal: trigger bodyRendered event
Part of MDL-59333.
2017-07-12 19:57:22 +08:00
Simey Lameze
f02e119afd MDL-59383 core_modal: trigger event on modal module 2017-07-12 18:57:55 +08:00
Mark Nelson
d4b2c195e1 MDL-54682 core: build amd modules 2016-10-11 14:39:24 +08:00
Ryan Wyllie
2bcef5594a MDL-55727 javascript: Add modal module 2016-09-13 02:44:30 +00:00