This project is archived and is in readonly mode.
Date select helpers should have a :prompt option
-
Joff Williams
+1 from me. date select is a great helper but lacks this prompt option.
-
josh
- State changed from new to stale
Interesting, I will have to go in after 2.2 though. Lets relook at it then.
-
grant
Thanks! I'm glad I searched before writing that myself. Here's a version of the patch that applies cleanly to 2.1.2.
-
Jatinder Singh
+1 We should probably have a similar approach to assign different CSS class name to each select generated. or is that something possible already?
-
Martijn Vos
+1
Why exactly is this stale, and not already in Rails?
Also +1 on doing something similar for class name, although I think that should be a separate ticket.
-
josh
- State changed from stale to open
-
Pratik
- Assigned user set to Pratik
I like the feature/patch. I couldn't apply it cleanly on the lastest edge, could you please upload a new patch and I'll commit it.
Thanks.
-
Sam Oliver
This new patch applies cleanly on to the latest edge
-
Repository
- State changed from open to resolved
(from [389534c38c3baaa63ce5cc2ba3bd169415419167]) Added prompt options to date helpers [#561 Date select helpers should have a :prompt option state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
-
Sam Oliver
This new patch uses I18n for the text in the default prompts and can be cleanly applied to edge.
-
Pratik
We need tests for I18 as well.
-
Sven Fuchs
the i18n patch looks good to me :)
-
Sven Fuchs
... probably should test that the translations can be looked up though
-
Sam Oliver
New patch which includes tests for I18n
-
Pratik
- State changed from resolved to open
-
Martijn Vos
add_prompts_to_date_helpers_2.3.0.diff doesn't entirely fix this issue when applied to 2.2.2. It still uses today as default value instead of nil.
In date_helper.rb, in class InstanceTag
private def default_datetime(options) return if options[:include_blank]should be changed to
private def default_datetime(options) return if options[:include_blank] || options[:prompt]I haven't tested against the latest edge yet, but I'd be surprised if it works properly there.
-
Sam Oliver
This new patch applies the suggested change from Martijn and updates the tests to cover this issue.
-
Martijn Vos
Another minor but ugly issue that remains is that when I use the "year" select box, it starts at dates in the distant past. I want those to be available, but they're not the obvious choices.
I'm not sure what the best fix would be here, though. Perhaps reversing the order of the years? Or putting the prompt (with nil value) at the bottom instead of the top? How much control does a developer currently have over such things?
-
Sam Oliver
This is a good point but I think that it might be taking it a bit too far. You can always create your own helper to get absolute control. The :prompt option is fairly fundamental and is used in other select helpers so it's a natural inclusion. Maybe you could open a new ticket for this suggestion.
-
Sam Oliver
Could this ticket be re-opened as it's not quite working in edge (see my last patch)?
-
Pratik
- State changed from resolved to open
-
jonathan
+1
-
Joe F.
+1 - we are currently running on a patched version of Rails for this fix. We are required to use custom prompts in our date selects. Is there any way we could this fix in 2.3?
Thanks!
-
Pratik
- Milestone cleared.
-
Sam Oliver
I tested my last patch again on edge today - it still applies cleanly and the tests pass.
http://rails.lighthouseapp.com/a...
It's a small change that will hopefully close this ticket
-
Repository
- State changed from open to resolved
(from [f04346d8b999476113d5e5a30661e07899e3ff80]) Stops date select helpers from defaulting the selected date to today if :prompt option has been used
Signed-off-by: Michael Koziarski michael@koziarski.com [#561 Date select helpers should have a :prompt option state:resolved] http://github.com/rails/rails/co...
