Class: Clot::TimeSelect
- Inherits:
-
ModelMultiDateTag
- Object
- Liquid::Tag
- ClotTag
- MultiDateTag
- ModelMultiDateTag
- Clot::TimeSelect
- Defined in:
- lib/clot/model_date_tags.rb
Instance Method Summary collapse
Methods inherited from ModelMultiDateTag
#fill_zeros, #get_unit_order, #set_unit
Methods included from ModelTag
#render, #set_primary_attributes
Methods inherited from MultiDateTag
#personal_attributes, #render, #render_units, #set_primary_attributes, #set_unit, #time_unit
Methods inherited from ClotTag
Methods included from TagHelper
Methods included from AttributeSetter
#personal_attributes, #set_attributes, #set_primary_attributes
Constructor Details
This class inherits a constructor from Clot::ClotTag
Instance Method Details
#render_nested(context) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/clot/model_date_tags.rb', line 43 def render_nested(context) @time = @value_string || Time.zone.now time_units = ["hour", "minute"] if @include_seconds time_units << "second" end time_result = render_units(time_units, context, @time_separator) year = %{<input id="#{@first_attr}_#{@attribute_name}_1i" name="#{@first_attr}[#{@attribute_name}(1i)]" type="hidden" value="#{@time.year}" />} month = %{<input id="#{@first_attr}_#{@attribute_name}_2i" name="#{@first_attr}[#{@attribute_name}(2i)]" type="hidden" value="#{@time.month}" />} day = %{<input id="#{@first_attr}_#{@attribute_name}_3i" name="#{@first_attr}[#{@attribute_name}(3i)]" type="hidden" value="#{@time.day}" />} year + month + day + time_result end |