-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
feat(modal): dynamic modal content #1774
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lubber-de
added
type/feat
Any feature requests or improvements
lang/javascript
Anything involving JavaScript
state/awaiting-reviews
Pull requests which are waiting for reviews
labels
Nov 19, 2020
lubber-de
requested review from
exoego,
ko2in,
ColinFrick,
prudho and
y0hami
November 19, 2020 09:53
lubber-de
added
the
state/awaiting-docs
Pull requests which need doc changes/additions
label
Nov 19, 2020
prudho
reviewed
Nov 20, 2020
prudho
requested changes
Nov 20, 2020
prudho
approved these changes
Nov 20, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
ko2in
approved these changes
Nov 20, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice feature 🥇
lubber-de
changed the title
[Modal] Create dynamic modals out of pure JS properties, use DOM modals as template with dynamic content
feat(modal): dynamic modal content
Nov 22, 2020
lubber-de
removed
the
state/awaiting-reviews
Pull requests which are waiting for reviews
label
Nov 22, 2020
lubber-de
added a commit
that referenced
this pull request
Feb 25, 2021
This PR adds the possibility of using JS config templates for the modal module. That means you can declare a reusable dynamic template function which returns predefined config settings (modified depending of your input to the template function) as the modal is already prepared to create dynamic content out of pure js since #1774 For this reason modal now also has an optional autoshow option, which enables you to immediatly show the modal on instantiation time, so no more need for $(.ui.modal).modal({closable:false}).modal('show') but $(.ui.modal).modal({closable:false, autoShow:true}) Modal now also can use the transition methods for show/hide individually (backwards compatible) (just like in toast and for dimmer in #1867)
lubber-de
added a commit
that referenced
this pull request
Jun 23, 2021
While preparing the docs for #1774 , i recognized that modal does not create action buttons at all when the actions container is not available in the DOM does always stack action buttons on DOM modals when reused Co-authored-by: TATSUNO Yasuhiro <[email protected]>
Docs added by fomantic/Fomantic-UI-Docs#287 |
lubber-de
added
state/has-docs
A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo
and removed
state/awaiting-docs
Pull requests which need doc changes/additions
labels
Jun 23, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
lang/javascript
Anything involving JavaScript
state/has-docs
A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo
type/feat
Any feature requests or improvements
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the same dynamic functionality like toast to create a modal just out of properties or reuse a DOM node modal as a template with its content being dynamically set via js properties.
Everything is optional and backward compatible 🙂
Most of the code is copied /adopted from the toast component so the usage is equal.
This goes along with @prudho fui-alert plugin approach (#1716) which could be more simplified then
Create a temporary modal just by JS properties
By providing new properties to the modal module and targeting to body you create temporary modals without the need to create markup on your own. The modal is temporary and will be removed from the DOM once closed.
Reuse an existing modal
Also, you can still prepare a modal markup in your domtree as usual, but set the related content via js properties to reuse the general style
Testcase
https://jsfiddle.net/lubber/eo8bdyp3/48/
Screenshot
Closes
#1407