Skip to content
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

FR: Prompt option similar to action fields #18

Open
FrittenKeeZ opened this issue Feb 22, 2019 · 6 comments
Open

FR: Prompt option similar to action fields #18

FrittenKeeZ opened this issue Feb 22, 2019 · 6 comments

Comments

@FrittenKeeZ
Copy link

Like the native javascript prompt, it would be awesome to have this option, where you can supply any fields in a callback like action fields. If no callback is defined (or empty), a default text field should be provided.

Button::make('Cancel Account')
    ->prompt('Are you sure?', 'Please write CANCEL below to confirm', function () {
        return [
            Text::make('Confirm')->rules('required', 'in:CANCEL'),
            Text::make('Reason'),
        ];
    }),
@niladam
Copy link

niladam commented Feb 22, 2019

Personally i think this would be waaay better:

Button::make('Cancel Account')
    ->ask('Are you sure?')
    ->cancel('Nope')
    ->confirm('Yes i do!')
    ->addFields(function() {
        return [
            Text::make('Reason'),
        ];
    }),

@dillingham
Copy link
Owner

Nice idea! Yeah I can definitely see the usefulness of being able to add fields for the button. It is almost like actions in that ability.

I was planning on adding action support to this package and this may overlap and provide identical functionality.

Button::make(‘Text’)->action(ActionWithFields::class),

I’m going to think on this a bit
But thank you for pitching the idea :)

@dillingham
Copy link
Owner

dillingham commented Apr 17, 2019

My problem with this is that vue portal is used in nova for each index row to render delete modals. Adding all this markup per row of a table seems irresponsible lol 25 rows with 25 action modals with 5 fields and of course not just text fields turns into ALOT

@SerjoA
Copy link

SerjoA commented Apr 17, 2019

its a serious problem then

@YannikFirre
Copy link

@dillingham

It's not possible to execute the action with javascript trigger ?

  • Uncheck all checkbox
  • Check the checkbox of that row
  • Select the action and launch him ?

@scottgrayson
Copy link

Button triggering an action would be useful on the Detail page as well.

There would be no "flooding the markup" problem on the detail page.

Maybe that could be implemented first? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants