Commit Graph

24 Commits

Author SHA1 Message Date
Eric Sullivan 867f1f75d1 fix label on dates if HTML5 compatibility is explicitly enbled 2014-12-26 13:25:22 -05:00
Rafael Mendonça França 15f0101545 Pass the options hash instead of the Leaf object
Right now we only care about the options so lets make the code simpler
2014-03-11 19:41:25 -03:00
Rafael Mendonça França e9384fb4bd Whitespaces 2014-03-11 19:13:59 -03:00
Rafael Mendonça França 4a13b2f99c Move the context check down to the method 2014-03-11 16:39:24 -03:00
Rafael Mendonça França 3992cfc57d Extract the wrapper options merge behavior to their own module
This make easier to share the same behavior between all the components
2014-03-11 16:33:51 -03:00
Rafael Mendonça França 44f22ca3fb Make context optional
We plan to make it required in the future but it is optional now to make
easier to implement backwards compatibility
2014-03-11 15:22:45 -03:00
Rafael Mendonça França df47a8599d Merge the context options with the input options 2014-03-11 10:30:49 -03:00
Rafael Mendonça França 645988a855 Pass the context when rendering the component 2014-03-10 18:41:36 -03:00
Volmer Soares df4efa2e93 Just `input_options[:html5]` is enough. 2013-11-18 22:23:27 -02:00
Volmer Soares 5590f85ee1 Use classic datetime selects unless HTML5 is explicitly enabled. 2013-11-16 02:25:24 -02:00
Volmer Soares 5dff6f29ae Remove unecessary `enable` call. 2013-11-15 16:46:43 -02:00
Volmer Soares fb1f52dbc5 Support to date, datetime and time inputs.
I changed `DateTimeInput` to support the new HTML5 form helpers that
comes with Rails 4 (`date_input`, `datetime_input` and `time_input`)
instead of rendering datetime selects:

For example, this input:
```erb
<%= f.input :born_on, as: :date %>
```
Will render:
```html
<input id="user_born_on" name="user[born_on]" type="date" />
```

Datetime selects are still present, but only when HTML5 compatibility
is disabled. It's also possible to render selects even with HTML5 on,
by setting the `html5` option to false.

If we wanted to use an old date select on the example above, we should do:
```erb
<%= f.input :born_on, as: :date, html5: false %>
```

Closes #844.
2013-11-13 14:44:42 -02:00
Carlos Antonio da Silva 91a07f587c Just symbolize the date order value when necessary 2013-07-18 11:48:51 -03:00
Matt Jankowski c00533bf7c Handle situation when I18n date.order values are strings
Rails 4 changes the `date.order` I18n setting to return strings, which
resulted in a missed lookup in POSITION, and a value like `date_i`
instead of `date_1i` for the `for` attribute on `label` elements.
2013-07-17 10:56:42 -04:00
Vasiliy Ermolovich 77b6c821d2 generate required attribute for `date_time` input
closes #730
2013-01-19 14:16:28 +03:00
Carlos Antonio da Silva 08f2badc1e Refactor label target for date time input 2012-02-09 11:21:22 -02:00
George Hemmings 151b0d8fb9 Fix label for datetime inputs, point to first select
Point the label for datetime inputs at the first select. The date order can be
overridden by i18n and on a per-input basis. Use the specified order to
discover the first select.
2012-02-04 14:49:44 +00:00
José Valim e8749ae07e Add class default options to avoid has_*? checks. 2011-12-04 13:29:59 +01:00
José Valim 6bf59dd508 Get rid of the enabled/disabled in favor of has_*? syntax. 2011-12-04 12:29:53 +01:00
José Valim 5d6d977fc8 Break up mapping input and also provide an enable API. 2011-09-03 11:13:29 +02:00
Carlos Antonio da Silva bc2f3e73e8 Only add the "required" HTML 5 attribute for valid inputs, disable in selects (not allowed). Closes #141 2010-12-10 20:57:22 -02:00
Carlos Antonio da Silva 66555b1e60 Small refactor and review some private methods 2010-09-26 23:21:30 -03:00
José Valim 1ef232cf6d Numberic type inputs now have type=number for HTML5. 2010-06-01 23:40:12 +02:00
José Valim 7d7c6cda72 Code refactoring finished. Now tests one. 2010-01-09 16:05:02 +01:00