sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Remove x-editable without any replacement #8110

Closed core23 closed 6 months ago

core23 commented 1 year ago

Subject

I am targeting this branch, because feature removal is a breaking change.

Relates to https://github.com/sonata-project/SonataAdminBundle/issues/7156

Changelog

### Removed
- Remove `x-editable` without any replacement

The library is no longer maintained and this blocks the overall (frontend) upgrade process.

jordisala1991 commented 1 year ago

IMO we should make sure to deprecate this stuff on 4.x. (Also would be nice to do it before this PR, to avoid conflicts on upmerge)

wbloszyk commented 1 year ago

I looked through the x-editable code and sonata-admin code. It is possible to replace x-editable by own js. We have something simmilar in ModelListType (with add button).

Also IMHO we should avoid using js in *.html.twig files and move current js to stimulus.

My solution

Result

BTW I can wrote stimulus to replace x-editable.

core23 commented 1 year ago

I looked through the x-editable code and sonata-admin code. It is possible to replace x-editable by own js. We have something simmilar in ModelListType (with add button).

Also IMHO we should avoid using js in *.html.twig files and move current js to stimulus.

My solution

  • deprecate unnesessery js
  • add new stimulus controller equal to js from templates
  • add sonata_admin.options.js_type: inline(default)|stimulus(dedicated to 5.x)

Result

  • no inline JS in 5.x branch
  • JS will be independed with templates

Totally agree, we should use stimulus or web components where possible.

So should we deprecate all editable related components and add a new solution later on or should we directly replace it?

wbloszyk commented 1 year ago

We talk about: ListMapper::add(string $name, ?string $type = null, array $fieldDescriptionOptions = []): static.
$fieldDescriptionOptions['editable'] are use in 4 places. (3 times in templates and 1 in SetObjectFieldAction.php).

SetObjectFieldAction allow for AJAX POST call only, so it ready backend endpoint for update field. x-editable is used for generate form (I dont see call for getting form in devTools) and send it to SetObjectFieldAdmin. So x-editable is only frontend thing.

IMO:

I think about How to introduce new temple(s). The best solution for me will be improve current system. Pool for global templates registry and allow add own registry will be powerfull thing. With shwicher user could be able to change template in site. Downside of this solution will be overrided Admin templates, but it will be possible to fix/improve.

github-actions[bot] commented 6 months ago

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.