-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
[Modules] Add user prompt #1407
Comments
Unless I’ve totally missed something, these are both covered in the docs.... Modal has callbacks for approving and denying Toast also has the same callbacks |
@jamessampford I think u've missed the main idea))
As you can see this is not so hard to implement but this is not actually in modal module scope now. |
In my mind, what you have in your example is easier (and quicker) than adding a whole new module/feature that will bloat the underlining Fomantic JS to do essentially the same thing but with a different name If something, on the other hand, can be made easier where logic is needed to do various calculations, take into account other various things to stitch different aspects together, then that would be cool (like my Sidebar idea #1243) Perhaps some kind of widget/extension factory/thingamajig could be useful to define/repurpose what you’re looking for 🤔 |
@jamessampford as you've mentioned in #1370 both the jQuery and HTML approaches are used for small size user dialogs. But why for large size user dialogs can't jQuery exists?
Contributors would better decide whether Fomantic is UI or Framework then to not make others confused. |
Hello, I have started a discussion about an eventual alert plugin that may be relevant for you: #1716 ! |
I added the same functionality from toast to modal to create them out of JS properties or reuse existing modals as templates |
@baterflyrity Maybe, once my PR is approved and merged, we can think about how/if additional and configurable templates for a prompt/alert could work/make sense. The fui-alert plugin by @prudho is currently a much better approach using promises |
@lubber-de, no problems until you close this issue with wrong PR. |
My current PR solves what you initially suggested
Dynamic content and actions with callbacks are now possible using js given properties just as in toast title: 'MyTitle',
content: 'MyContent'
actions: [{
text: 'Alright',
class: 'green',
click: function() {
// do something when clicked
}
}] We definately won't create a completely additional module such as The only thing i can think of is an However, it would still be $('body').modal('alert','MyTitle','MyText',function(){/* my callback code*/});
$('body').modal('confirm','MyTitle','MyText',function(confirmed){/* my callback code depending if confirmed is true/false*/});
$('body').modal('prompt','MyTitle','MyText',function(inputValue){/* my callback code using the entered value from an input field*/}); which matches the base functionaliy of existing JS confirm/prompt/alert methods. btw, i was also thinking of adding a centered and dimmer option to the toast module, which should then satisfy most use cases |
This is closer to correct user dialog box. I'd be great to also see p.s.
All things can be done easily but think what about writing 5 more higher level lines to save 5 minutes in future scaled by projects and users. |
alert, confirm, prompt and any custom predefined modal are now possible by #1869. For examples and explanation see the PR. |
@lubber-de great job, i like it! |
Feature Request
Since Fomantic UI presents not only UI but some interactive modules it would be great to add a user prompt module.
The module should ask user for some decision like "File 1.txt already exists. Would you like to overwrite this file?" And also can be invoked from js with text, label and buttons (actions) with callbacks.
Example
From one hand poor prompt is already can be constructed via toast actions but it displays only toast but prompt (no dimmer, no visual highlights). From another hand prompt can be displayed via modal but with no dynamic content, actions and callbacks.
So I suggest to merge modal UI with toast actions.
Example
Run
confirm('Implement this?')
in browser console to see default implementation.The text was updated successfully, but these errors were encountered: