-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.0][RFC] Joomla Dialog (popup) script. Free, without CC and registration #40150
Conversation
Squashed commit of the following: commit cd37244 Author: Fedik <getthesite@gmail.com> Date: Sat Mar 18 14:14:43 2023 +0200 Popup customisable buttons location commit 64c1197 Author: Fedik <getthesite@gmail.com> Date: Sat Mar 18 11:51:33 2023 +0200 Popup setCurrent commit 43e20c6 Author: Fedik <getthesite@gmail.com> Date: Sat Mar 18 11:39:51 2023 +0200 Popup setCurrent, and cancelable commit 8e68503 Author: Fedik <getthesite@gmail.com> Date: Sat Mar 18 11:29:25 2023 +0200 Popup handle anchor click, and caching commit c784170 Author: Fedik <getthesite@gmail.com> Date: Sat Mar 18 10:52:50 2023 +0200 Popup helper, aliases commit 225267f Author: Fedik <getthesite@gmail.com> Date: Fri Mar 17 18:09:40 2023 +0200 Popup basic styling commit 5071c3b Author: Fedik <getthesite@gmail.com> Date: Fri Mar 17 18:01:30 2023 +0200 Popup basic styling commit a5aeb0a Author: Fedik <getthesite@gmail.com> Date: Fri Mar 17 16:40:17 2023 +0200 Popup basic styling commit 79a2a93 Author: Fedik <getthesite@gmail.com> Date: Fri Mar 17 16:00:15 2023 +0200 Popup basic styling commit 0b739fb Author: Fedik <getthesite@gmail.com> Date: Fri Mar 17 15:40:03 2023 +0200 Popup basic styling commit 2f8d5a1 Author: Fedik <getthesite@gmail.com> Date: Fri Mar 17 14:54:17 2023 +0200 Can cancel commit b5512f9 Merge: 5d83527 cb1d517 Author: Fedik <getthesite@gmail.com> Date: Fri Mar 17 14:36:58 2023 +0200 Merge branch '4.3-dev' into jpopup commit 5d83527 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 18:45:10 2023 +0200 Joomla popup base css commit c9abff7 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 17:48:00 2023 +0200 Joomla popup destroy commit 5b42c28 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 17:45:37 2023 +0200 Joomla popup lang commit d3adea8 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 17:37:05 2023 +0200 Joomla popup jscs commit 6923750 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 17:35:34 2023 +0200 Joomla popup alert/confirm handle cancel commit 25b6b16 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 17:25:31 2023 +0200 Joomla popup cleanup commit fd01507 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 17:12:00 2023 +0200 Joomla popup jscs commit 623bffe Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 17:09:40 2023 +0200 Joomla popup alert promise commit e726f5f Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 16:51:40 2023 +0200 Joomla popup jscs commit 92a05b6 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 16:32:47 2023 +0200 Joomla popup confirm with promise commit 42895bc Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 16:26:11 2023 +0200 Joomla popup events commit e64f68a Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 16:22:23 2023 +0200 Joomla popup events commit 4bee835 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 15:39:47 2023 +0200 Joomla popup auto-create commit 394ce08 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 15:07:13 2023 +0200 Joomla popup commit ac66242 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 14:53:16 2023 +0200 Joomla popup docs commit e4d87bf Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 14:26:11 2023 +0200 Joomla popup image, ajax commit 4b10bbe Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 13:17:31 2023 +0200 Joomla popup iframe commit 839cf43 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 12:39:11 2023 +0200 Joomla popup sizes and close commit 2371cd0 Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 12:00:54 2023 +0200 Joomla popup render layout commit 7aafc4d Author: Fedik <getthesite@gmail.com> Date: Sun Mar 12 11:19:35 2023 +0200 Joomla popup statics commit 658dd88 Author: Fedik <getthesite@gmail.com> Date: Sat Mar 11 20:21:22 2023 +0200 Joomla popup commit 27486ab Author: Fedik <getthesite@gmail.com> Date: Sat Mar 11 19:03:11 2023 +0200 Joomla popup commit 7e4398d Author: Fedik <getthesite@gmail.com> Date: Sat Mar 11 17:07:02 2023 +0200 Joomla popup
LGTM I left couple of comments on |
At time when it will happen, we will be no need polifill 😄 |
Sure, so apart the innerHML part everything else are spot on on what we had discussed. Maybe the anchor shouldn't be included, for a11y reasons, ie: the dialog should be opened from a button but that's bikeshedding that someone else should do. I will try to play a bit with it tomorrow but I think it's already in very good shape |
I see, makes sense, yes I will rename |
@dgrammatiko what for a decisions you expect? If this can go into 4.4? As @Fedik already mentioned in the pr description, this should finally be merged into 5.0 as 4.4 will not get any new features. |
So 4.3 was the last minor that had new features? Well, 🤬 |
What is the problem to ship it with 5.0? They will be released at the same time. |
I guess some dev will be complaining, like the did with the WAM, that they need 2 different code snippets in order to support both v4 and v5... |
As long as the old way still works, they should then use that. And yes, when they want the new dialog/popup/modal, then they need to have different code which is dependent on the Joomla version. I don't see this as a big issue. |
The old way (bootstrap) works but devs SHOULD NOT use them for fields, editor buttons, etc that are already broken right now because this approach is doing SSR (Server Side Rendering) of the modals which are incompatible with repeatable fields. Same goes for the category fields for different reason. My point is that the script should be introduced in the 4.x so the transition would be easier... |
I think 5.x+ is fine, maybe we will get some better ideas untill then. |
I was thinking doing the first implementation with the buttons based on this PR and the #40082 but it needs also extending the Joomla.editors = {
instances: {},
buttonsCallbacks: {
['plg_editors-buttons_readmore']: () => { /* the code for the callback */ },
},
} |
I thinking about something generic, that can handle basic stuf without extra coding, and allow to be extended when needed. |
My idea for the editor buttons was:
This way on every repeatable instance the buttons will work as expected (the editor init function has the responsibility to handle those, ie: tiny will render them inside a toolbar but others could/would render them bellow the editing area) |
hmm, I thought more on a css file I can use in my own frontend template as base and not only cassiopia, what do you thing? |
By default it use a browser default styling for dialog. Backdrop also there, it is browser default. About footerText. I not very want to overload with features, and keep it simple. const dialog = new JoomlaDialog();
dialog.textHeader = 'The header';
dialog.popupContent = '<strong>blabla very strong text</strong>';
// Customise footer
dialog.getFooter().insertAdjacentElement('afterbegin', (() => {
const el = document.createElement('div');
el.innerText = 'Footer text';
return el;
})());
dialog.getFooter().classList.remove('empty');
dialog.show(); |
thanks, I think it's a starting point, even if I would add a css which is (or could be) part of the webasset with a nicer styling |
Does this issue have something to do with this topic here? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40150. |
Use Dialog for Batch windows * Batch: banners * Batch: contacts * Batch: newsfeed * Batch: fields * Batch: field groups * Batch: menu * Batch: modules * Batch: tags * Batch: users see also the reference for implementation of the Joomla.Dialog #40150
Affects: * Dashboard: add module * Menus: add/edit module * Menu item: Module Assignment tab see also the reference for implementation of the Joomla.Dialog #40150
Hey, since JoomlaDialog is now a module script I think it would be useful to have a little section in the manual that shows how this class can be used in "classic" non-module scripts, as the import function can only be called from another module script. The current manual gives the impression you can use the JoomlaDialog class in any script. For example static:
Or dynamic:
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40150. |
@Frank-MandarinFish As far as i know everybody can contribute to the manual |
Summary of Changes
This is implementation of own popup/modal/dialog independend from bootstrap and other traps.
As continue of #32473 discussion.
At current point of time the PR provides only popup implementation, the script should be ready to use.
And the integration will come.
I made it for 4.x to be able easily test on "production" codebase. However main target (If I ever finish it) probably > 5.x.The PR does not provide a separate stylesheet for popup, the styling should be done within template (example can find in _modal.scss of this PR).
(At bare it use native dialog styling)
What and why is Joomla Dialog
The script allow to create a popup/dialog programaticaly, that in oposite to current Bootstrap implementation, when modal should be prerendered in HTML. This allows more simple integration on client side without involving server side.
It basicaly a wrapper around native
dialog
element.Joomla Dialog script allows to display dialog with following content:
inline
- text or html content;iframe
- embed/remote content, in iframe;ajax
- same asinline
but the content loaded through ajax request;image
- image lightbox;Also it provides helper methods for
alert()
andconfirm()
dialogs.Provides helper to bind page button/anchor to show the popup, for basic stuff, without extra js needed.
Usage examples
Any property can be set as instance property or in class constructor. This two is equal:
Other options:
Alert and Confirm usage:
Binding button/anchor for basic stuff
Testing Instructions
Can test any of examples above.
Apply patch, run
npm install
.Then add
$wa->useScript('joomla.dialog');
in to index.php of the admin template.And one of example js/html wherever you want. Eg. in to index.php (will show 2 popup on load):
Link to documentations
Please select:
Issues for reference
@dgrammatiko I have stole some of your ideas from #39344, I hope you will not sue me :)