Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Replacing the datepicker with bootstrap-datepicker #1551

Closed
jasonm23 opened this Issue Mar 5, 2013 · 18 comments

Comments

Projects
None yet
6 participants

jasonm23 commented Mar 5, 2013

http://www.eyecon.ro/bootstrap-datepicker/

(improved in this fork.)

https://github.com/eternicode/bootstrap-datepicker

It would be good if the old JQueryUI datepicker was replaced with the bootstrap-datepicker, I am currently looking at this in the source, and will issue a pull request if I get it working.

I'm posting this in case anyone else is already working on this / or has thoughts.

Contributor

jgrevich commented Mar 29, 2013

@jasonm23 +1 to this idea.

Any progress on the pull request or should someone else give it a go? Did you get stuck somewhere? Let's get this working.

Contributor

scarfacedeb commented Jun 20, 2013

What about this one: http://tarruda.github.io/bootstrap-datetimepicker/?
The only problem that I see is that it would make timepicker a part of date field. (Now it's a separate input field).
What do you think of that? - @sferik

One of the possible advantages is that this datetimepicker in theory could be used directly on date fields (without the hacks with the generated date and time fields in ra.datetimepicker).

update: I've found at least 1 serious problem: this version can't output month names in dates.
Another similar plugin: http://eternicode.github.io/bootstrap-datepicker/ can format dates with month names, but it doesn't support time.
I'm going to think about what would be easier - adding time to the second plugin, or adding month names to the first.

Contributor

scarfacedeb commented Jun 21, 2013

Also we can leave the same 2-inputs layout for date and time if we'd use:
http://eternicode.github.io/bootstrap-datepicker/ for dates, and
http://jdewit.github.io/bootstrap-timepicker/ for time.

The only drawback is that it would require the same kind of 'magic' with ra.datetimepick that is used now. (specifically, we have hidden input for the original value, and 2 separate inputs for widgets. I don't really like this idea, especially the part where you need to provide value in data-option's json object, istead of using native value attribute).


In the end, what would be the optimal way of doing things?
2 separate widgets or 1 combined?

(I'm messing with the both plugins right now, but I'm going to write rails_admin integration in 2-3 days. So, it would be great to have some definitive views on this issue.)

Ideal? I think a choice is better, and allowing a field directive to select
which one, with the default remaining as is.

ie.

  field :date_of_birth, :bootstrap_datepicker

Or

  field :show_time, :bootstrap_timepicker

Or

  field :publish_date

(Using current default.)

My 2c

I suppose the other way around legacy usability would be to allow the old date picker as an optional, so devs with "uncomfortable" users could roll back.

Just food for thought. I think making the new ones optional will be a better way to go though. Perhaps deprecating the current default later?

Contributor

jgrevich commented Jun 22, 2013

@jasonm23 👍 Right on, I think that sounds great! Keep it as it is with options to use the new features. Later on we can depreciate the current default when we feel it's appropriate.

Contributor

scarfacedeb commented Jun 23, 2013

@jasonm23, @jgrevich Sounds good to me.
The problem is that we can't use these plugins at the same time, because they have the same names. ( $.fn.datepicker and $.fn.timepicker )
As a workaround, I suggest using this hack: http://stackoverflow.com/questions/11898992/conflict-between-two-jquery-plugins-with-same-function-name

For example, I can name them: bootstrap_datepicker, bootstrap_timepicker

@scarfacedeb sounds good, will that significantly impact time to re-integrate when these externals are updated?

Contributor

scarfacedeb commented Jun 24, 2013

@jasonm23 I think, replacing a couple of strings in ra.bootstrap_datetimepicker shouldn't cause a lot of issues.
The only problem is if they would use boostrap_datepicker as a standalone plugin. (without ra.bootstrap_datetimepicker wrapper).

If there's support in ra for the other plugins already(?) that could pose a
problem, but we'd patch the docs around date/time to note the plugin(s)
we're using.

I'm assuming you'd use just the bootstrap_datetime plugin, and supply the
time, date switches?

Sent from Gmail Mobile

Contributor

scarfacedeb commented Jun 24, 2013

@jasonm23 no, I'm implementing it the same way as it's now - 2 separate inputs for date and time using datepicker and timepicker respectively.
bootstrap_datetime don't support month names and bootstrap_datepicker by @eternicode has better support and cleaner code. (in my opinion)
I'm thinking about forking this datepicker and adding timepicker to it (copying datetimepicker functionality, but on the better basis), but not in this moment.


There's ra.datepicker plugin, that uses jqueryUI datepicker and timepicker, but it shouldn't be a problem, because I'm implementing separate ra.bootstrap_datepicker plugin.
We can rename it later anyway.

Sounds good.

Sent from Gmail Mobile

Collaborator

caboteria commented Aug 30, 2013

Look forward to the pull request, in the mean time it looks as if we can close this issue.

@caboteria caboteria closed this Aug 30, 2013

towfiq commented Sep 24, 2014

Did this ever wind up in a PR? I couldn't find one, but maybe I missed it?

Contributor

scarfacedeb commented Sep 25, 2014

Unfortunately, it turned out more difficult, than I expected.
There's an issue with passing dates from ruby to a javascript datepicker, that I couldn't figure out at that moment. (especially, relating to non-english locales)

towfiq commented Sep 26, 2014

Gotcha. Thanks for the update!

Contributor

jgrevich commented Sep 27, 2014

@scarfacedeb perhaps it would be useful to post what you have in a PR so someone can pickup where you left off.

Contributor

dalpo commented Aug 26, 2015

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