EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
4.09k stars 1.03k forks source link

How to work with pretty urls in JS ? #6508

Open zorn-v opened 3 weeks ago

zorn-v commented 3 weeks ago

As pretty urls seems to be the only option in 5.0, how to work with them from js ? I have several places where I set entityId "search param" on some form select change event to some base url.

For example I have relation like "customer" and button like "show", which open modal "preview" (detail page without menu etc) of selected customer.

Maybe add some public router related methods to window.EasyAdminApp ?

javiereguiluz commented 3 weeks ago

Can't you just use the route name directly in JS code?

If you can't, maybe you can use the ea_url() function dynamically in Twig to generate the URL that later is used in JS code.

zorn-v commented 3 weeks ago

If you can't, maybe you can use the ea_url() function dynamically in Twig to generate the URL that later is used in JS code.

I do this already ("some base url" about this), but I need to change part of that url (entityId param) on JS event. Yes, I can split url by "/" and change part of it, but I would like to make some universal solution that works with ugly and pretty urls.

I check documentation and realize that it almost impossible (create js route helper) because pretty urls may be configured via attributes and can look like anything.