formtastic 2.1.1 → 2.2.0.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +19 -1
  3. data/Appraisals +7 -0
  4. data/CHANGELOG +18 -0
  5. data/README.textile +14 -16
  6. data/formtastic.gemspec +1 -1
  7. data/gemfiles/rails-4.gemfile +8 -0
  8. data/lib/formtastic/form_builder.rb +0 -1
  9. data/lib/formtastic/helpers/input_helper.rb +12 -26
  10. data/lib/formtastic/inputs.rb +6 -0
  11. data/lib/formtastic/inputs/base.rb +16 -4
  12. data/lib/formtastic/inputs/base/datetime_pickerish.rb +85 -0
  13. data/lib/formtastic/inputs/base/stringish.rb +10 -2
  14. data/lib/formtastic/inputs/base/timeish.rb +17 -17
  15. data/lib/formtastic/inputs/base/wrapping.rb +25 -20
  16. data/lib/formtastic/inputs/boolean_input.rb +24 -1
  17. data/lib/formtastic/inputs/date_input.rb +5 -29
  18. data/lib/formtastic/inputs/date_picker_input.rb +93 -0
  19. data/lib/formtastic/inputs/date_select_input.rb +34 -0
  20. data/lib/formtastic/inputs/datetime_input.rb +6 -8
  21. data/lib/formtastic/inputs/datetime_picker_input.rb +100 -0
  22. data/lib/formtastic/inputs/datetime_select_input.rb +12 -0
  23. data/lib/formtastic/inputs/hidden_input.rb +1 -1
  24. data/lib/formtastic/inputs/radio_input.rb +1 -1
  25. data/lib/formtastic/inputs/select_input.rb +2 -5
  26. data/lib/formtastic/inputs/time_input.rb +4 -28
  27. data/lib/formtastic/inputs/time_picker_input.rb +99 -0
  28. data/lib/formtastic/inputs/time_select_input.rb +34 -0
  29. data/lib/formtastic/version.rb +1 -1
  30. data/lib/generators/templates/formtastic.rb +0 -8
  31. data/sample/basic_inputs.html +21 -1
  32. data/spec/builder/semantic_fields_for_spec.rb +1 -1
  33. data/spec/generators/formtastic/install/install_generator_spec.rb +1 -1
  34. data/spec/helpers/input_helper_spec.rb +20 -16
  35. data/spec/helpers/semantic_errors_helper_spec.rb +10 -10
  36. data/spec/inputs/custom_input_spec.rb +5 -2
  37. data/spec/inputs/date_picker_input_spec.rb +449 -0
  38. data/spec/inputs/{date_input_spec.rb → date_select_input_spec.rb} +34 -34
  39. data/spec/inputs/datetime_picker_input_spec.rb +490 -0
  40. data/spec/inputs/{datetime_input_spec.rb → datetime_select_input_spec.rb} +33 -33
  41. data/spec/inputs/deprecated_time_date_datetime_inputs_spec.rb +48 -0
  42. data/spec/inputs/hidden_input_spec.rb +21 -17
  43. data/spec/inputs/include_blank_spec.rb +3 -3
  44. data/spec/inputs/label_spec.rb +1 -1
  45. data/spec/inputs/placeholder_spec.rb +1 -1
  46. data/spec/inputs/select_input_spec.rb +22 -14
  47. data/spec/inputs/time_picker_input_spec.rb +455 -0
  48. data/spec/inputs/{time_input_spec.rb → time_select_input_spec.rb} +35 -35
  49. data/spec/spec_helper.rb +25 -1
  50. data/spec/support/custom_macros.rb +2 -2
  51. metadata +32 -21
  52. data/lib/formtastic/helpers/buttons_helper.rb +0 -310
  53. data/spec/helpers/buttons_helper_spec.rb +0 -166
  54. data/spec/helpers/commit_button_helper_spec.rb +0 -530
data/.gitignore CHANGED
@@ -8,6 +8,7 @@ pkg
8
8
  *watchr.rb
9
9
  log/*
10
10
  .rvmrc
11
+ .ruby-version
11
12
  .bundle
12
13
  Gemfile.lock
13
14
  .yardoc
data/.travis.yml CHANGED
@@ -4,5 +4,23 @@ rvm:
4
4
  - ree
5
5
  - 1.9.2
6
6
  - 1.9.3
7
+ gemfile:
8
+ - gemfiles/rails-3.0.gemfile
9
+ - gemfiles/rails-3.1.gemfile
10
+ - gemfiles/rails-3.2.gemfile
11
+ - gemfiles/rails-4.gemfile
7
12
  env:
8
- - DEFER_GC=false
13
+ - DEFER_GC=false RAILS_EDGE=true
14
+ script: "rake spec"
15
+ matrix:
16
+ exclude:
17
+ - rvm: 1.8.7
18
+ gemfile: gemfiles/rails-4.gemfile
19
+ env: DEFER_GC=false RAILS_EDGE=true
20
+ - rvm: ree
21
+ gemfile: gemfiles/rails-4.gemfile
22
+ env: DEFER_GC=false RAILS_EDGE=true
23
+ - rvm: 1.9.2
24
+ gemfile: gemfiles/rails-4.gemfile
25
+ env: DEFER_GC=false RAILS_EDGE=true
26
+
data/Appraisals CHANGED
@@ -9,3 +9,10 @@ end
9
9
  appraise 'rails-3.2' do
10
10
  gem 'rails', '~> 3.2.0'
11
11
  end
12
+
13
+ if ENV["RAILS_EDGE"] == "true"
14
+ appraise 'rails-4' do
15
+ gem 'rails', :git => 'git://github.com/rails/rails.git'
16
+ gem 'sprockets-rails', :git => 'https://github.com/rails/sprockets-rails.git'
17
+ end
18
+ end
data/CHANGELOG CHANGED
@@ -1,3 +1,21 @@
1
+ 2.2.0.rc
2
+
3
+ * removed deprecated buttons DSL, ButtonHelper and commit_button helper
4
+ * deprecated the top-level :value option that is only used by HiddenInput
5
+ * deprecated :hint_class option (use global configuration)
6
+ * deprecated :error_class option (use global configuration)
7
+ * deprecated :group_by and :group_label (use :collection option with a HTML string generated by Rails' grouped_options_for_select())
8
+ * deprecated :find_options
9
+ * renamed TimeInput (:as => :time) to TimeSelectInput (:as => :time_select), aliased and deprecated TimeInput
10
+ * renamed DatetimeInput (:as => :datetime) to DatetimeSelectInput (:as => :datetime_select), aliased and deprecated DatetimeInput
11
+ * renamed DateInput (:as => :date) to TimeSelectInput (:as => :date_select), aliased and deprecated DateInput
12
+ * added DatePickerInput (:as => :date_picker) for HTML5 date inputs
13
+ * added TimePickerInput (:as => :time_picker) for HTML5 time inputs
14
+ * added DateTimePickerInput (:as => :datetime_picker) for HTML5 datetime and datetime-local inputs
15
+ * added support for Rails 4 (edge)
16
+ * improved error message on Formtastic::UnknownInputError
17
+ * improved documentation for asset pipeline and condition stylesheets (IE)
18
+
1
19
  2.1.1
2
20
 
3
21
  * Documentation improvements and updates
data/README.textile CHANGED
@@ -114,13 +114,17 @@ h3. Stylesheet usage in Rails < 3.1:
114
114
 
115
115
  h3. Stylesheet usage in Rails >= 3.1:
116
116
 
117
- Rails 3.1 introduces an asset pipeline that allows plugins like Formtastic to serve their own Stylesheets, Javascripts, etc without having to run generators that copy them accross to the host application. Formtastic makes three stylesheets available as an Engine, you just need to require them in your global stylesheets.
117
+ Rails 3.1 introduces an asset pipeline that allows plugins like Formtastic to serve their own Stylesheets, Javascripts, etc without having to run generators that copy them across to the host application. Formtastic makes three stylesheets available as an Engine, you just need to require them in your global stylesheets.
118
118
 
119
119
  <pre>
120
120
  # app/assets/stylesheets/application.css
121
121
  *= require formtastic
122
122
  *= require my_formtastic_changes
123
-
123
+ </pre>
124
+
125
+ Conditional stylesheets need to be compiled separately to prevent them being bundled and included with other application styles. Remove @require_tree .@ from application.css and specify required stylesheets individually.
126
+
127
+ <pre>
124
128
  # app/assets/stylesheets/ie6.css
125
129
  *= require formtastic_ie6
126
130
 
@@ -135,7 +139,10 @@ Rails 3.1 introduces an asset pipeline that allows plugins like Formtastic to se
135
139
  <!--[if IE 7]><%= stylesheet_link_tag 'ie7' %><![endif]-->
136
140
  </pre>
137
141
 
138
-
142
+ <pre>
143
+ # config/environments/production.rb
144
+ config.assets.precompile += %w( ie6.css ie7.css )
145
+ </pre>
139
146
 
140
147
  h2. Usage
141
148
 
@@ -304,16 +311,6 @@ Customize the HTML attributes for the @<li>@ wrapper around every input with the
304
311
  <% end %>
305
312
  </pre>
306
313
 
307
- Customize the default class used for hints on each attribute or globally in the @config/initializers/formtastic.rb@ file. Similarly, you can customize the error classes on an attribute level or globally.
308
-
309
- <pre>
310
- <%= semantic_form_for @post do |f| %>
311
- <%= f.inputs do %>
312
- <%= f.input :title, :hint_class => 'custom-html-class', :error_class => 'custom-error-class' %>
313
- <% end %>
314
- <% end %>
315
- </pre>
316
-
317
314
  Many inputs provide a collection of options to choose from (like @:select@, @:radio@, @:check_boxes@, @:boolean@). In many cases, Formtastic can find choices through the model associations, but if you want to use your own set of choices, the @:collection@ option is what you want. You can pass in an Array of objects, an array of Strings, a Hash... Throw almost anything at it! Examples:
318
315
 
319
316
  <pre>
@@ -329,6 +326,7 @@ Many inputs provide a collection of options to choose from (like @:select@, @:ra
329
326
  f.input :author, :as => :radio, :collection => { @justin.name => @justin.id, @kate.name => @kate.id }
330
327
  f.input :author, :as => :radio, :collection => ["Justin", "Kate", "Amelia", "Gus", "Meg"]
331
328
  f.input :admin, :as => :radio, :collection => ["Yes!", "No"]
329
+ f.input :book_id, :as => :select, :collection => Hash[Book.all.map{|b| [b.name,b.id]}]
332
330
  </pre>
333
331
 
334
332
 
@@ -342,9 +340,9 @@ The Formtastic input types:
342
340
  * @:time_zone@ - a select input. Default for column types: @:string@ with name matching @"time_zone"@.
343
341
  * @:password@ - a password input. Default for column types: @:string@ with name matching @"password"@.
344
342
  * @:text@ - a textarea. Default for column types: @:text@.
345
- * @:date@ - a date select. Default for column types: @:date@.
346
- * @:datetime@ - a date and time select. Default for column types: @:datetime@ and @:timestamp@.
347
- * @:time@ - a time select. Default for column types: @:time@.
343
+ * @:date_select@ - a date select. Default for column types: @:date@.
344
+ * @:datetime_select@ - a date and time select. Default for column types: @:datetime@ and @:timestamp@.
345
+ * @:time_select@ - a time select. Default for column types: @:time@.
348
346
  * @:boolean@ - a checkbox. Default for column types: @:boolean@.
349
347
  * @:string@ - a text field. Default for column types: @:string@.
350
348
  * @:number@ - a text field (just like string). Default for column types: @:integer@, @:float@, and @:decimal@.
data/formtastic.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
24
24
  s.rubygems_version = %q{1.3.6}
25
25
 
26
- s.add_dependency(%q<actionpack>, ["~> 3.0"])
26
+ s.add_dependency(%q<actionpack>, [">= 3.0"])
27
27
 
28
28
  s.add_development_dependency(%q<rspec-rails>, ["~> 2.8.0"])
29
29
  s.add_development_dependency(%q<rspec_tag_matchers>, [">= 1.0.0"])
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source :rubygems
4
+
5
+ gem "rails", :git=>"git://github.com/rails/rails.git"
6
+ gem "sprockets-rails", :git=>"https://github.com/rails/sprockets-rails.git"
7
+
8
+ gemspec :path=>"../"
@@ -41,7 +41,6 @@ module Formtastic
41
41
 
42
42
  include Formtastic::Helpers::InputHelper
43
43
  include Formtastic::Helpers::InputsHelper
44
- include Formtastic::Helpers::ButtonsHelper
45
44
  include Formtastic::Helpers::ActionHelper
46
45
  include Formtastic::Helpers::ActionsHelper
47
46
  include Formtastic::Helpers::ErrorsHelper
@@ -89,8 +89,8 @@ module Formtastic
89
89
  # * `:boolean` (see {Inputs::BooleanInput})
90
90
  # * `:check_boxes` (see {Inputs::CheckBoxesInput})
91
91
  # * `:country` (see {Inputs::CountryInput})
92
- # * `:datetime` (see {Inputs::DatetimeInput})
93
- # * `:date` (see {Inputs::DateInput})
92
+ # * `:datetime_select` (see {Inputs::DatetimeSelectInput})
93
+ # * `:date_select` (see {Inputs::DateSelectInput})
94
94
  # * `:email` (see {Inputs::EmailInput})
95
95
  # * `:file` (see {Inputs::FileInput})
96
96
  # * `:hidden` (see {Inputs::HiddenInput})
@@ -103,7 +103,7 @@ module Formtastic
103
103
  # * `:string` (see {Inputs::StringInput})
104
104
  # * `:text` (see {Inputs::TextInput})
105
105
  # * `:time_zone` (see {Inputs::TimeZoneInput})
106
- # * `:time` (see {Inputs::TimeInput})
106
+ # * `:time_select` (see {Inputs::TimeSelectInput})
107
107
  # * `:url` (see {Inputs::UrlInput})
108
108
  #
109
109
  # Calling `:as => :string` (for example) will call `#to_html` on a new instance of
@@ -143,34 +143,16 @@ module Formtastic
143
143
  # @option options :member_value [Symbol, Proc, Method]
144
144
  # Override the method called on each object in the `:collection` for use as the `value` attribute in the `<input>` (`:check_boxes` & `:radio` inputs) or `<option>` (`:select` inputs)
145
145
  #
146
- # @option options :hint_class [String]
147
- # Override the `class` attribute applied to the `<p>` tag used when a `:hint` is rendered for an input
148
- #
149
- # @option options :error_class [String]
150
- # Override the `class` attribute applied to the `<p>` or `<ol>` tag used when inline errors are rendered for an input
151
- #
152
146
  # @option options :multiple [Boolean]
153
147
  # Specify if the `:select` input should allow multiple selections or not (defaults to `belongs_to` associations, and `true` for `has_many` and `has_and_belongs_to_many` associations)
154
148
  #
155
- # @option options :group_by [Symbol]
156
- # TODO will probably be deprecated
157
- #
158
- # @option options :find_options [Symbol]
159
- # TODO will probably be deprecated
160
- #
161
- # @option options :group_label [Symbol]
162
- # TODO will probably be deprecated
163
- #
164
149
  # @option options :include_blank [Boolean]
165
150
  # Specify if a `:select` input should include a blank option or not (defaults to `include_blank_for_select_by_default` configuration)
166
151
  #
167
152
  # @option options :prompt [String]
168
153
  # Specify the text in the first ('blank') `:select` input `<option>` to prompt a user to make a selection (implicitly sets `:include_blank` to `true`)
169
154
  #
170
- # @todo Can we kill `:hint_class` & `:error_class`? What's the use case for input-by-input? Shift to config or burn!
171
- # @todo Can we kill `:group_by` & `:group_label`? Should be done with :collection => grouped_options_for_select(...)
172
- # @todo Can we kill `:find_options`? Should be done with MyModel.some_scope.where(...).order(...).whatever_scope
173
- # @todo Can we kill `:label`, `:hint` & `:prompt`? All strings could be shifted to i18n!
155
+ # @todo Can we deprecate & kill `:label`, `:hint` & `:prompt`? All strings could be shifted to i18n!
174
156
  #
175
157
  # @example Accept all default options
176
158
  # <%= f.input :title %>
@@ -293,8 +275,12 @@ module Formtastic
293
275
  return :number
294
276
  when :float, :decimal
295
277
  return :number
296
- when :timestamp
297
- return :datetime
278
+ when :datetime, :timestamp
279
+ return :datetime_select
280
+ when :time
281
+ return :time_select
282
+ when :date
283
+ return :date_select
298
284
  end
299
285
 
300
286
  # Try look for hints in options hash. Quite common senario: Enum keys stored as string in the database.
@@ -347,7 +333,7 @@ module Formtastic
347
333
  elsif Formtastic::Inputs.const_defined?(input_class_name)
348
334
  standard_input_class_name(as).constantize
349
335
  else
350
- raise Formtastic::UnknownInputError
336
+ raise Formtastic::UnknownInputError, "Unable to find input class #{input_class_name}"
351
337
  end
352
338
  end
353
339
 
@@ -359,7 +345,7 @@ module Formtastic
359
345
  standard_input_class_name(as).constantize
360
346
  end
361
347
  rescue NameError
362
- raise Formtastic::UnknownInputError
348
+ raise Formtastic::UnknownInputError, "Unable to find input class for #{as}"
363
349
  end
364
350
 
365
351
  # :as => :string # => StringInput
@@ -8,7 +8,11 @@ module Formtastic
8
8
  autoload :CheckBoxesInput
9
9
  autoload :CountryInput
10
10
  autoload :DateInput
11
+ autoload :DatePickerInput
12
+ autoload :DatetimePickerInput
13
+ autoload :DateSelectInput
11
14
  autoload :DatetimeInput
15
+ autoload :DatetimeSelectInput
12
16
  autoload :EmailInput
13
17
  autoload :FileInput
14
18
  autoload :HiddenInput
@@ -23,6 +27,8 @@ module Formtastic
23
27
  autoload :StringInput
24
28
  autoload :TextInput
25
29
  autoload :TimeInput
30
+ autoload :TimePickerInput
31
+ autoload :TimeSelectInput
26
32
  autoload :TimeZoneInput
27
33
  autoload :Timeish
28
34
  autoload :UrlInput
@@ -12,19 +12,29 @@ module Formtastic
12
12
  @method = method
13
13
  @options = options.dup
14
14
 
15
- removed_option!(:label_method)
16
- removed_option!(:value_method)
17
- removed_option!(:group_label_method)
15
+ warn_deprecated_option!(:value, ":input_html => { :value => '...'}")
16
+ warn_deprecated_option!(:hint_class, "default_hint_class configuration")
17
+ warn_deprecated_option!(:error_class, "default_error_class configuration")
18
+ warn_deprecated_option!(:group_by, ":collection option with a HTML string generated by Rails' grouped_options_for_select()")
19
+ warn_deprecated_option!(:group_label, ":collection option with a HTML string generated by Rails' grouped_options_for_select()")
20
+ warn_deprecated_option!(:find_options, "YourModel.find(...)")
18
21
  end
19
22
 
20
23
  # Usefull for deprecating options.
21
24
  def warn_and_correct_option!(old_option_name, new_option_name)
22
25
  if options.key?(old_option_name)
23
- ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of :#{new_option_name} and will be removed from Formtastic after 2.0")
26
+ ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of :#{new_option_name} and will be removed from Formtastic in the next version")
24
27
  options[new_option_name] = options.delete(old_option_name)
25
28
  end
26
29
  end
27
30
 
31
+ # Usefull for deprecating options.
32
+ def warn_deprecated_option!(old_option_name, instructions)
33
+ if options.key?(old_option_name)
34
+ ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of `#{instructions}` and will be removed in the next version")
35
+ end
36
+ end
37
+
28
38
  # Usefull for raising an error on previously supported option.
29
39
  def removed_option!(old_option_name)
30
40
  raise ArgumentError, ":#{old_option_name} is no longer available" if options.key?(old_option_name)
@@ -32,6 +42,7 @@ module Formtastic
32
42
 
33
43
  extend ActiveSupport::Autoload
34
44
 
45
+ autoload :DatetimePickerish
35
46
  autoload :Associations
36
47
  autoload :Collections
37
48
  autoload :Choices
@@ -54,6 +65,7 @@ module Formtastic
54
65
  include Html
55
66
  include Options
56
67
  include Database
68
+ include Database
57
69
  include Errors
58
70
  include Hints
59
71
  include Naming
@@ -0,0 +1,85 @@
1
+ module Formtastic
2
+ module Inputs
3
+ module Base
4
+ module DatetimePickerish
5
+ include Base::Placeholder
6
+
7
+ def html_input_type
8
+ raise NotImplementedError
9
+ end
10
+
11
+ def default_size
12
+ raise NotImplementedError
13
+ end
14
+
15
+ def value
16
+ raise NotImplementedError
17
+ end
18
+
19
+ def input_html_options
20
+ super.merge(extra_input_html_options)
21
+ end
22
+
23
+ def extra_input_html_options
24
+ {
25
+ :type => html_input_type,
26
+ :size => size,
27
+ :maxlength => maxlength,
28
+ :step => step,
29
+ :value => value
30
+ }
31
+ end
32
+
33
+ def size
34
+ return options[:size] if options.key?(:size)
35
+ return options[:input_html][:size] if options[:input_html] && options[:input_html].key?(:size)
36
+ default_size
37
+ end
38
+
39
+ def step
40
+ return step_from_macro(options[:input_html][:step]) if options[:input_html] && options[:input_html][:step] && options[:input_html][:step].is_a?(Symbol)
41
+ return options[:input_html][:step] if options[:input_html] && options[:input_html].key?(:step)
42
+ default_step
43
+ end
44
+
45
+ def maxlength
46
+ return options[:maxlength] if options.key?(:maxlength)
47
+ return options[:input_html][:maxlength] if options[:input_html] && options[:input_html].key?(:maxlength)
48
+ default_size
49
+ end
50
+
51
+ def default_maxlength
52
+ default_size
53
+ end
54
+
55
+ def default_step
56
+ 1
57
+ end
58
+
59
+ protected
60
+
61
+ def step_from_macro(sym)
62
+ case sym
63
+
64
+ # date
65
+ when :day then "1"
66
+ when :seven_days, :week then "7"
67
+ when :two_weeks, :fortnight then "14"
68
+ when :four_weeks then "28"
69
+ when :thirty_days then "30"
70
+
71
+ # time
72
+ when :second then "1"
73
+ when :minute then "60"
74
+ when :fifteen_minutes, :quarter_hour then "900"
75
+ when :thirty_minutes, :half_hour then "1800"
76
+ when :sixty_minutes, :hour then "3600"
77
+
78
+ else sym
79
+ end
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+ end
@@ -14,11 +14,19 @@ module Formtastic
14
14
  # Overrides standard `input_html_options` to provide a `maxlength` and `size` attribute.
15
15
  def input_html_options
16
16
  {
17
- :maxlength => options[:input_html].try(:[], :maxlength) || limit,
18
- :size => builder.default_text_field_size
17
+ :maxlength => maxlength,
18
+ :size => size
19
19
  }.merge(super)
20
20
  end
21
21
 
22
+ def size
23
+ builder.default_text_field_size
24
+ end
25
+
26
+ def maxlength
27
+ options[:input_html].try(:[], :maxlength) || limit
28
+ end
29
+
22
30
  def wrapper_html_options
23
31
  new_class = [super[:class], "stringish"].compact.join(" ")
24
32
  super.merge(:class => new_class)
@@ -1,7 +1,7 @@
1
1
  module Formtastic
2
2
  module Inputs
3
3
  module Base
4
- # Timeish inputs (`:date`, `:datetime`, `:time`) are similar to the Rails date and time
4
+ # Timeish inputs (`:date_select`, `:datetime_select`, `:time_select`) are similar to the Rails date and time
5
5
  # helpers (`date_select`, `datetime_select`, `time_select`), rendering a series of `<select>`
6
6
  # tags for each fragment (year, month, day, hour, minute, seconds). The fragments are then
7
7
  # re-combined to a date by ActiveRecord through multi-parameter assignment.
@@ -21,12 +21,12 @@ module Formtastic
21
21
  # * floating the `<li>` fragments against each other as a single line
22
22
  # * hiding the `<label>` of each fragment with `display:none`
23
23
  #
24
- # @example `:date` input with full form context and sample HTMl output
24
+ # @example `:date_select` input with full form context and sample HTMl output
25
25
  #
26
26
  # <%= semantic_form_for(@post) do |f| %>
27
27
  # <%= f.inputs do %>
28
28
  # ...
29
- # <%= f.input :publish_at, :as => :date %>
29
+ # <%= f.input :publish_at, :as => :date_select %>
30
30
  # <% end %>
31
31
  # <% end %>
32
32
  #
@@ -56,31 +56,31 @@ module Formtastic
56
56
  # </form>
57
57
  #
58
58
  #
59
- # @example `:time` input
60
- # <%= f.input :publish_at, :as => :time %>
59
+ # @example `:time_select` input
60
+ # <%= f.input :publish_at, :as => :time_select %>
61
61
  #
62
- # @example `:datetime` input
63
- # <%= f.input :publish_at, :as => :datetime %>
62
+ # @example `:datetime_select` input
63
+ # <%= f.input :publish_at, :as => :datetime_select %>
64
64
  #
65
65
  # @example Change the labels for each fragment
66
- # <%= f.input :publish_at, :as => :date, :labels => { :year => "Y", :month => "M", :day => "D" } %>
66
+ # <%= f.input :publish_at, :as => :date_select, :labels => { :year => "Y", :month => "M", :day => "D" } %>
67
67
  #
68
68
  # @example Skip a fragment (defaults to 1, skips all following fragments)
69
- # <%= f.input :publish_at, :as => :datetime, :discard_minute => true %>
70
- # <%= f.input :publish_at, :as => :datetime, :discard_hour => true %>
71
- # <%= f.input :publish_at, :as => :datetime, :discard_day => true %>
72
- # <%= f.input :publish_at, :as => :datetime, :discard_month => true %>
73
- # <%= f.input :publish_at, :as => :datetime, :discard_year => true %>
69
+ # <%= f.input :publish_at, :as => :datetime_select, :discard_minute => true %>
70
+ # <%= f.input :publish_at, :as => :datetime_select, :discard_hour => true %>
71
+ # <%= f.input :publish_at, :as => :datetime_select, :discard_day => true %>
72
+ # <%= f.input :publish_at, :as => :datetime_select, :discard_month => true %>
73
+ # <%= f.input :publish_at, :as => :datetime_select, :discard_year => true %>
74
74
  #
75
75
  # @example Change the order
76
- # <%= f.input :publish_at, :as => :date, :order => [:month, :day, :year] %>
76
+ # <%= f.input :publish_at, :as => :date_select, :order => [:month, :day, :year] %>
77
77
  #
78
78
  # @example Include seconds with times (excluded by default)
79
- # <%= f.input :publish_at, :as => :time, :include_seconds => true %>
79
+ # <%= f.input :publish_at, :as => :time_select, :include_seconds => true %>
80
80
  #
81
81
  # @example Specify if there should be a blank option at the start of each select or not. Note that, unlike select inputs, :include_blank does not accept a string value.
82
- # <%= f.input :publish_at, :as => :time, :include_blank => true %>
83
- # <%= f.input :publish_at, :as => :time, :include_blank => false %>
82
+ # <%= f.input :publish_at, :as => :time_select, :include_blank => true %>
83
+ # <%= f.input :publish_at, :as => :time_select, :include_blank => false %>
84
84
  #
85
85
  # @todo Document i18n
86
86
  # @todo Check what other Rails options are supported (`start_year`, `end_year`, `use_month_numbers`, `use_short_month`, `add_month_numbers`, `prompt`), write tests for them, and otherwise support them