lib/formtastic/inputs/base/timeish.rb in formtastic-2.1.1 vs lib/formtastic/inputs/base/timeish.rb in formtastic-2.2.0.rc

- old
+ new

@@ -1,9 +1,9 @@ module Formtastic module Inputs module Base - # Timeish inputs (`:date`, `:datetime`, `:time`) are similar to the Rails date and time + # Timeish inputs (`:date_select`, `:datetime_select`, `:time_select`) are similar to the Rails date and time # helpers (`date_select`, `datetime_select`, `time_select`), rendering a series of `<select>` # tags for each fragment (year, month, day, hour, minute, seconds). The fragments are then # re-combined to a date by ActiveRecord through multi-parameter assignment. # # The mark-up produced by Rails is simple but far from ideal, with no way to label the @@ -19,16 +19,16 @@ # # * styling the legend to look like the other labels (to the left hand side of the selects) # * floating the `<li>` fragments against each other as a single line # * hiding the `<label>` of each fragment with `display:none` # - # @example `:date` input with full form context and sample HTMl output + # @example `:date_select` input with full form context and sample HTMl output # # <%= semantic_form_for(@post) do |f| %> # <%= f.inputs do %> # ... - # <%= f.input :publish_at, :as => :date %> + # <%= f.input :publish_at, :as => :date_select %> # <% end %> # <% end %> # # <form...> # <fieldset class="inputs"> @@ -54,34 +54,34 @@ # </ol> # </fieldset> # </form> # # - # @example `:time` input - # <%= f.input :publish_at, :as => :time %> + # @example `:time_select` input + # <%= f.input :publish_at, :as => :time_select %> # - # @example `:datetime` input - # <%= f.input :publish_at, :as => :datetime %> + # @example `:datetime_select` input + # <%= f.input :publish_at, :as => :datetime_select %> # # @example Change the labels for each fragment - # <%= f.input :publish_at, :as => :date, :labels => { :year => "Y", :month => "M", :day => "D" } %> + # <%= f.input :publish_at, :as => :date_select, :labels => { :year => "Y", :month => "M", :day => "D" } %> # # @example Skip a fragment (defaults to 1, skips all following fragments) - # <%= f.input :publish_at, :as => :datetime, :discard_minute => true %> - # <%= f.input :publish_at, :as => :datetime, :discard_hour => true %> - # <%= f.input :publish_at, :as => :datetime, :discard_day => true %> - # <%= f.input :publish_at, :as => :datetime, :discard_month => true %> - # <%= f.input :publish_at, :as => :datetime, :discard_year => true %> + # <%= f.input :publish_at, :as => :datetime_select, :discard_minute => true %> + # <%= f.input :publish_at, :as => :datetime_select, :discard_hour => true %> + # <%= f.input :publish_at, :as => :datetime_select, :discard_day => true %> + # <%= f.input :publish_at, :as => :datetime_select, :discard_month => true %> + # <%= f.input :publish_at, :as => :datetime_select, :discard_year => true %> # # @example Change the order - # <%= f.input :publish_at, :as => :date, :order => [:month, :day, :year] %> + # <%= f.input :publish_at, :as => :date_select, :order => [:month, :day, :year] %> # # @example Include seconds with times (excluded by default) - # <%= f.input :publish_at, :as => :time, :include_seconds => true %> + # <%= f.input :publish_at, :as => :time_select, :include_seconds => true %> # # @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. - # <%= f.input :publish_at, :as => :time, :include_blank => true %> - # <%= f.input :publish_at, :as => :time, :include_blank => false %> + # <%= f.input :publish_at, :as => :time_select, :include_blank => true %> + # <%= f.input :publish_at, :as => :time_select, :include_blank => false %> # # @todo Document i18n # @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 # @todo Could we take the rendering from Rails' helpers and inject better HTML in and around it rather than re-inventing the whee? module Timeish \ No newline at end of file