Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6000 (closed enhancement: fixed)

Opened 3 years ago

Last modified 1 year ago

[PATCH] Allow HTML options for <select> helpers

Reported by: bosie.kern@gmx.net Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords: tests date_select time_select verified
Cc:

Description

<%= date_select 'item','happening', :order => [:day], :class => 'foobar'%>

this does not set the class on the select-tag. this works for month and year this way: <%= date_select 'item','happening', :order => [:year], :class => 'foobar' %> <%= date_select 'item','happening', :order => [:month], :class => 'foobar'%>

Attachments

add_html_options_to_date_and_time_select_methods.diff (53.8 kB) - added by Jakob S on 09/21/07 10:22:35.
Updated for r7523
add_html_options_to_date_and_time_select_methods_fix_for_r8950.diff (57.4 kB) - added by h-lame on 02/29/08 10:26:10.
Updated to apply as of r8950

Change History

01/22/07 08:10:15 changed by nik.wakelin

I don't think its possible to include html_options into date_select and its ilk like this (at least not on edge).

It would be nice to be able to. Unless I'm missing something and you can tell me how, that is. Maybe I'll patch it up :)

BTW: On edge, the date_select will discard the :day select if :month is not specified in the :order (or with the :discard_xxx options) so your first example doesn't show anything.

05/05/07 22:49:27 changed by Jakob S

  • version set to edge.
  • type changed from defect to enhancement.
  • summary changed from CSS-Class not assigned to [PATCH] CSS-Class not assigned.

The attached patch adds the ability to pass html_options to all date/time related select options, so they now act like pretty much every other form tag. Includes documentation and tests. This also closes #6165.

09/21/07 10:22:35 changed by Jakob S

  • attachment add_html_options_to_date_and_time_select_methods.diff added.

Updated for r7523

(follow-up: ↓ 5 ) 12/04/07 23:27:15 changed by nathany

After finally getting my collection working with a combination of select_month and select_year, it was quite disappointing to find something as simple as passing a :class through to select_html is not supported in Rails 1.2.6, nor is the code in the trunk patched. Yes, I need :class for an unobtrusive validation library, it is rather important. To find a year old patch request sitting here unacted upon... come on guys. It's in the details... consistent APIs are much more important than the latest grandiose Rails 2.0 feature.

12/05/07 09:45:32 changed by Jakob S

nathany, did you verify the patch applies and should I consider your comment a +1?

(in reply to: ↑ 3 ) 12/05/07 11:13:21 changed by chuyeow

  • summary changed from [PATCH] CSS-Class not assigned to [PATCH] Allow HTML options for <select> helpers.
  • milestone set to 2.0.

Replying to nathany:

To find a year old patch request sitting here unacted upon... come on guys. It's in the details... consistent APIs are much more important than the latest grandiose Rails 2.0 feature.

Considering the large number of tickets, the "we work on it when we have time most of the time" approach and the pure volunteer effort behind Rails, I'd say you should cut the Rails committers and contributors some slack :) It is after all an Open Source project - you can help by raising the issue to the committers attention, or like Jakob pointed out, test and verify patches (a good place to start is http://dev.rubyonrails.org/wiki). This ticket probably has gotten buried in the flurry of tickets since.

I've found that raising any issues positively in the rubyonrails-core mailing list gets the committers' attention but other methods work as well if you're passionate about seeing something fixed or getting a feature into Rails.

Anyway, +1. Patch applies cleanly and tests pass.

12/05/07 14:32:12 changed by nathany

@Jakob I looked through the patch diff to see that it would fix the problem I had, after wandering through several other related tickets. I did not apply and test the patch however.

@chuyeow Yes, my little rant is quite unnecessary. Never thought to raise the issue on the list... thanks.

12/05/07 21:35:58 changed by norbert

  • milestone changed from 2.0 to 2.x.

As stated in the description of report {68}, the 2.0 milestone should only be used by core members for real show stoppers.

02/29/08 10:26:10 changed by h-lame

  • attachment add_html_options_to_date_and_time_select_methods_fix_for_r8950.diff added.

Updated to apply as of r8950

(follow-up: ↓ 9 ) 02/29/08 10:31:39 changed by h-lame

  • keywords set to tests date_select time_select.
  • owner changed from David to core.

This seems like a good patch, if only for consistency's sake, but it didn't apply any more so I've fixed it up to apply as of r8590.

(in reply to: ↑ 8 ) 02/29/08 10:32:53 changed by h-lame

Replying to h-lame:

This seems like a good patch, if only for consistency's sake, but it didn't apply any more so I've fixed it up to apply as of r8590.

Or .. um r8950 .. curse my fingers.

02/29/08 11:29:00 changed by lazyatom

+1 - seems fine here.

02/29/08 12:08:38 changed by Jakob S

  • keywords changed from tests date_select time_select to tests date_select time_select verified.

+1, new patch works for me

03/02/08 04:41:01 changed by nzkoz

  • status changed from new to closed.
  • resolution set to fixed.

(In [8968]) Allow html_options to be passed to all the date helpers. Closes #6000 [h-lame, Jakob S]