diff options
author | neumayr <neumayr@users.noreply.github.com> | 2016-03-17 17:57:57 +0100 |
---|---|---|
committer | neumayr <neumayr@users.noreply.github.com> | 2016-04-05 13:36:17 +0200 |
commit | d7b60544960399fd589770364c3e81a866593324 (patch) | |
tree | 1c858aa4c33a1fc42d94238b33534c65f18b5ec9 /activerecord/test/models/reference.rb | |
parent | 3108e0809f36eb1afebd70211335435fdc600655 (diff) | |
download | rails-d7b60544960399fd589770364c3e81a866593324.tar.gz rails-d7b60544960399fd589770364c3e81a866593324.tar.bz2 rails-d7b60544960399fd589770364c3e81a866593324.zip |
date_select helper with_css_classes option also accept a hash
`date_select` helper `:with_css_classes` option now accepts a hash of strings
for `:year`, `:month`, `:day`, `:hour`, `:minute`, `:second` that will extend
the select type with the given css class value.
```erb
<%= f.date_select :birthday, with_css_classes: { month: "my-month", year: "my-year" } %>
```
```html
<select id="user_birthday_3i" name="user[birthday(3i)]">…</select>
<select id="user_birthday_2i" name="user[birthday(2i)]" class="my-month">…</select>
<select id="user_birthday_1i" name="user[birthday(1i)]" class="my-year">…</select>
```
Optional, add global `html_options` to modify every select tag in the set.
```erb
<%= f.date_select :birthday, with_css_classes: { month: "my-month", year: "my-year" }, { class: "my-date optional" } %>
```
Supported DateHelper methods: `select_day`, `select_month`, `select_year`,
`select_hour`, `select_minute`, `select_second`, `select_datetime`, `select_time`,
`time_select`, `date_select` and `datetime_select`.
`:with_css_classes` option was added to the `date_select` with #7975.
Diffstat (limited to 'activerecord/test/models/reference.rb')
0 files changed, 0 insertions, 0 deletions