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

Upgrade Datetime library #320

Closed
jordisala1991 opened this issue May 3, 2022 · 5 comments
Closed

Upgrade Datetime library #320

jordisala1991 opened this issue May 3, 2022 · 5 comments
Milestone

Comments

@jordisala1991
Copy link
Member

jordisala1991 commented May 3, 2022

Feature Request

We are somehow stuck with the DateTime form type, since it is coupled with the library we are using at the frontend to render it:

https://github.com/Eonasdan/bootstrap-datetimepicker/ -> version 3.1.3

Not only is outdated (there is a version 4, 5, 6 on that repository), but also it got a name change, at least one major rewrite, some options changed a lot, etc...

Also there is another problem here, the form type is defined here, but the library is added here: https://github.com/sonata-project/SonataAdminBundle/tree/4.x/assets/vendor
which is a problem because:

  1. Can't be added via package.json since that older version does not provide the required assets
  2. Can't be upgraded since there is a circular dependency hidden: Form extension requires the js + css on admin, and admin requires the form type here.

I think we should find a solution before release 2.0, wdyt @VincentLanglet ?

There are also some really old PRs and issues on CoreBundle (when everything was together):

sonata-project/SonataCoreBundle#138
sonata-project/SonataCoreBundle#149

@VincentLanglet VincentLanglet added this to the 2.0 milestone May 3, 2022
@VincentLanglet
Copy link
Member

I see two solutions:

  • Moving the DateTimeType to SonataAdmin.
  • Adding the JS/CSS to the form-extension library.

I prefer the second solution ; do you think it's possible ?

@jordisala1991
Copy link
Member Author

The first option involves some / lot of classes, since there are multiple types related to "dates"

The second option I like it, but I am not sure how to do it. Should we expose a raw css/js file and then on the admin we capture it with encore and add it to the build?

I add a third option.

  • Make this library agnostic of the css/js part, and have something on AdminBundle that overrides it to show a pretty date picker

@VincentLanglet
Copy link
Member

Make this library agnostic of the css/js part, and have something on AdminBundle that overrides it to show a pretty date picker

I don't see how a DatePickerType will be agnostic of the datepicker library. To me it's the main purpose of this Type.

Should we expose a raw css/js file and then on the admin we capture it with encore and add it to the build?

Cant we have webpack on this project to build css/js, and then we add the file here:
https://github.com/sonata-project/SonataAdminBundle/blob/4.x/src/DependencyInjection/Configuration.php#L637

@jordisala1991
Copy link
Member Author

We have to make sure we remain compatible with both v1 and v2 of this bundle, but yes I think it can be done that way.

@jordisala1991
Copy link
Member Author

First part of the issue is solved (well we need to integrate it with AdminBundle). Now we need to merge to branch v2 and upgrade the library.

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

No branches or pull requests

2 participants