@@ -747,6 +747,23 @@ def date_field_tag(name, value = nil, options = {})
747
747
# * <tt>:max</tt> - The maximum acceptable value.
748
748
# * <tt>:step</tt> - The acceptable value granularity.
749
749
# * <tt>:include_seconds</tt> - Include seconds and ms in the output timestamp format (true by default).
750
+ #
751
+ # ==== Examples
752
+ #
753
+ # time_field_tag 'name'
754
+ # # => <input id="name" name="name" type="time" />
755
+ #
756
+ # time_field_tag 'time', '01:01'
757
+ # # => <input id="time" name="time" type="time" value="01:01" />
758
+ #
759
+ # time_field_tag 'time', nil, class: 'special_input'
760
+ # # => <input class="special_input" id="time" name="time" type="time" />
761
+ #
762
+ # time_field_tag 'time', '01:01', include_seconds: true
763
+ # # => <input id="time" name="time" type="time" value="01:01:00.000" />
764
+ #
765
+ # time_field_tag 'time', '01:01', min: '00:00', max: '23:59', step: 1
766
+ # # => <input id="time" max="23:59" min="00:00" name="time" step="1" type="time" value="01:01" />
750
767
def time_field_tag ( name , value = nil , options = { } )
751
768
text_field_tag ( name , value , options . merge ( type : :time ) )
752
769
end
@@ -761,6 +778,20 @@ def time_field_tag(name, value = nil, options = {})
761
778
# * <tt>:max</tt> - The maximum acceptable value.
762
779
# * <tt>:step</tt> - The acceptable value granularity.
763
780
# * <tt>:include_seconds</tt> - Include seconds in the output timestamp format (true by default).
781
+ #
782
+ # ==== Examples
783
+ #
784
+ # datetime_field_tag 'name'
785
+ # # => <input id="name" name="name" type="datetime-local" />
786
+ #
787
+ # datetime_field_tag 'datetime', '2014-01-01T01:01'
788
+ # # => <input id="datetime" name="datetime" type="datetime-local" value="2014-01-01T01:01" />
789
+ #
790
+ # datetime_field_tag 'datetime', nil, class: 'special_input'
791
+ # # => <input class="special_input" id="datetime" name="datetime" type="datetime-local" />
792
+ #
793
+ # datetime_field_tag 'datetime', '2014-01-01T01:01', class: 'special_input', disabled: true
794
+ # # => <input disabled="disabled" class="special_input" id="datetime" name="datetime" type="datetime-local" value="2014-01-01T01:01" />
764
795
def datetime_field_tag ( name , value = nil , options = { } )
765
796
text_field_tag ( name , value , options . merge ( type : "datetime-local" ) )
766
797
end
@@ -776,6 +807,20 @@ def datetime_field_tag(name, value = nil, options = {})
776
807
# * <tt>:min</tt> - The minimum acceptable value.
777
808
# * <tt>:max</tt> - The maximum acceptable value.
778
809
# * <tt>:step</tt> - The acceptable value granularity.
810
+ #
811
+ # ==== Examples
812
+ #
813
+ # month_field_tag 'name'
814
+ # # => <input id="name" name="name" type="month" />
815
+ #
816
+ # month_field_tag 'month', '2014-01'
817
+ # # => <input id="month" name="month" type="month" value="2014-01" />
818
+ #
819
+ # month_field_tag 'month', nil, class: 'special_input'
820
+ # # => <input class="special_input" id="month" name="month" type="month" />
821
+ #
822
+ # month_field_tag 'month', '2014-01', class: 'special_input', disabled: true
823
+ # # => <input disabled="disabled" class="special_input" id="month" name="month" type="month" value="2014-01" />
779
824
def month_field_tag ( name , value = nil , options = { } )
780
825
text_field_tag ( name , value , options . merge ( type : :month ) )
781
826
end
@@ -789,6 +834,20 @@ def month_field_tag(name, value = nil, options = {})
789
834
# * <tt>:min</tt> - The minimum acceptable value.
790
835
# * <tt>:max</tt> - The maximum acceptable value.
791
836
# * <tt>:step</tt> - The acceptable value granularity.
837
+ #
838
+ # ==== Examples
839
+ #
840
+ # week_field_tag 'name'
841
+ # # => <input id="name" name="name" type="week" />
842
+ #
843
+ # week_field_tag 'week', '2014-W01'
844
+ # # => <input id="week" name="week" type="week" value="2014-W01" />
845
+ #
846
+ # week_field_tag 'week', nil, class: 'special_input'
847
+ # # => <input class="special_input" id="week" name="week" type="week" />
848
+ #
849
+ # week_field_tag 'week', '2014-W01', class: 'special_input', disabled: true
850
+ # # => <input disabled="disabled" class="special_input" id="week" name="week" type="week" value="2014-W01" />
792
851
def week_field_tag ( name , value = nil , options = { } )
793
852
text_field_tag ( name , value , options . merge ( type : :week ) )
794
853
end
@@ -897,6 +956,17 @@ def number_field_tag(name, value = nil, options = {})
897
956
# ==== Options
898
957
#
899
958
# Supports the same options as #number_field_tag.
959
+ #
960
+ # ==== Examples
961
+ #
962
+ # range_field_tag 'quantity', '1'
963
+ # # => <input id="quantity" name="quantity" type="range" value="1" />
964
+ #
965
+ # range_field_tag 'quantity', in: 1...10
966
+ # # => <input id="quantity" name="quantity" min="1" max="9" type="range" />
967
+ #
968
+ # range_field_tag 'quantity', min: 1, max: 10, step: 2
969
+ # # => <input id="quantity" name="quantity" min="1" max="10" step="2" type="range"
900
970
def range_field_tag ( name , value = nil , options = { } )
901
971
number_field_tag ( name , value , options . merge ( type : :range ) )
902
972
end
0 commit comments