Forum: Ruby on Rails date_select css options

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
gabordemeter (Guest)
on 2007-06-13 20:20
(Received via mailing list)
Just looked at the Date helper in the rails API and noticed that none
of the functions there (i.e. date_select) allow me to specify html
options (i.e. class) for the generated selects.

I was wondering how do other group members css format date select
dropdowns?


Best,

Gabor
Bob Showalter (Guest)
on 2007-06-13 20:36
(Received via mailing list)
On 6/13/07, gabordemeter <gabordemeter@myway.com> wrote:
>
> Just looked at the Date helper in the rails API and noticed that none
> of the functions there (i.e. date_select) allow me to specify html
> options (i.e. class) for the generated selects.
>
> I was wondering how do other group members css format date select
> dropdowns?

Use a wrapper element and then style using CSS selectors:

  content_tag(:div, date_select(:widget, :date), :class =>
'date_select')

CSS:

  .date_select select { ... }
gabordemeter (Guest)
on 2007-06-14 00:22
(Received via mailing list)
Thanks Bob. I thought of that myself but wanted to double check that
there's no other more direct way to do it.
Bob Showalter (Guest)
on 2007-06-14 03:04
(Received via mailing list)
On 6/13/07, gabordemeter <gabordemeter@myway.com> wrote:
>
> Thanks Bob. I thought of that myself but wanted to double check that
> there's no other more direct way to do it.

It looks like you'll be able to set html options in the future:

http://dev.rubyonrails.org/ticket/6000
This topic is locked and can not be replied to.