Skip to content

Fix Input HTML Value Default and Non Date Time Inputs #58

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

Closed

Conversation

HoyaBoya
Copy link

@HoyaBoya HoyaBoya commented Aug 1, 2019

This PR does two things that have regressed in active_admin_datetimepicker in 0.7.2.

The first issue is that we could previously pass in integers, String, etc for a model attribute and the date picker will still render. With this change however https://github.com/activeadmin-plugins/active_admin_datetimepicker/blob/master/lib/active_admin_datetimepicker/base.rb#L34, we now get an error that min is not a method on the value. It may seem wonky that we would want to render a date picker for a non date field but that was our use case. We'd massage the value pack to the integer in the AA controller. Perhaps this should be a configuration with an explicit warning or raise, vs attempting to call min when it will fail.

The second seems like a straight up bug, with the input_html: { value: X } no longer being set in the date picker.

This PR attempts to fix both.

@coveralls
Copy link

Coverage Status

Coverage decreased (-9.7%) to 85.417% when pulling 9406550 on HoyaBoya:fix_input_html_value into 9b4051b on activeadmin-plugins:master.

@workgena
Copy link
Contributor

workgena commented Aug 2, 2019

Hello 🙂

The use-case is not clear for me. Can you, please, provide an usage example(AA code), what value do you pass to <input> and how DateTimePicker reacts to it (screenshot is welcome).

filter :starts_at, as: :date_time_range, html_options: { your_use_case_here }

Do you expect the same behavior in forms f.input :starts_at, as: :date_time_picker ?

Than we could collaborate together to write appropriate RSpec test-case, to make sure this regression won't happen again.

@HoyaBoya HoyaBoya closed this Sep 17, 2020
@HoyaBoya HoyaBoya deleted the fix_input_html_value branch September 17, 2020 14:15
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

Successfully merging this pull request may close these issues.

3 participants