actionview 4.2.11.1 → 7.0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +229 -215
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +9 -8
  5. data/lib/action_view/base.rb +116 -43
  6. data/lib/action_view/buffers.rb +20 -3
  7. data/lib/action_view/cache_expiry.rb +66 -0
  8. data/lib/action_view/context.rb +8 -12
  9. data/lib/action_view/dependency_tracker/erb_tracker.rb +154 -0
  10. data/lib/action_view/dependency_tracker/ripper_tracker.rb +59 -0
  11. data/lib/action_view/dependency_tracker.rb +21 -122
  12. data/lib/action_view/digestor.rb +92 -85
  13. data/lib/action_view/flows.rb +15 -16
  14. data/lib/action_view/gem_version.rb +6 -4
  15. data/lib/action_view/helpers/active_model_helper.rb +17 -12
  16. data/lib/action_view/helpers/asset_tag_helper.rb +356 -101
  17. data/lib/action_view/helpers/asset_url_helper.rb +180 -74
  18. data/lib/action_view/helpers/atom_feed_helper.rb +21 -19
  19. data/lib/action_view/helpers/cache_helper.rb +156 -43
  20. data/lib/action_view/helpers/capture_helper.rb +21 -14
  21. data/lib/action_view/helpers/controller_helper.rb +16 -5
  22. data/lib/action_view/helpers/csp_helper.rb +26 -0
  23. data/lib/action_view/helpers/csrf_helper.rb +8 -6
  24. data/lib/action_view/helpers/date_helper.rb +288 -132
  25. data/lib/action_view/helpers/debug_helper.rb +9 -6
  26. data/lib/action_view/helpers/form_helper.rb +956 -173
  27. data/lib/action_view/helpers/form_options_helper.rb +178 -97
  28. data/lib/action_view/helpers/form_tag_helper.rb +220 -101
  29. data/lib/action_view/helpers/javascript_helper.rb +33 -19
  30. data/lib/action_view/helpers/number_helper.rb +88 -63
  31. data/lib/action_view/helpers/output_safety_helper.rb +38 -6
  32. data/lib/action_view/helpers/rendering_helper.rb +21 -10
  33. data/lib/action_view/helpers/sanitize_helper.rb +31 -32
  34. data/lib/action_view/helpers/tag_helper.rb +332 -71
  35. data/lib/action_view/helpers/tags/base.rb +123 -99
  36. data/lib/action_view/helpers/tags/check_box.rb +21 -20
  37. data/lib/action_view/helpers/tags/checkable.rb +4 -2
  38. data/lib/action_view/helpers/tags/collection_check_boxes.rb +12 -34
  39. data/lib/action_view/helpers/tags/collection_helpers.rb +69 -36
  40. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +6 -12
  41. data/lib/action_view/helpers/tags/collection_select.rb +5 -3
  42. data/lib/action_view/helpers/tags/color_field.rb +4 -3
  43. data/lib/action_view/helpers/tags/date_field.rb +3 -2
  44. data/lib/action_view/helpers/tags/date_select.rb +38 -37
  45. data/lib/action_view/helpers/tags/datetime_field.rb +4 -3
  46. data/lib/action_view/helpers/tags/datetime_local_field.rb +3 -2
  47. data/lib/action_view/helpers/tags/datetime_select.rb +2 -0
  48. data/lib/action_view/helpers/tags/email_field.rb +2 -0
  49. data/lib/action_view/helpers/tags/file_field.rb +18 -0
  50. data/lib/action_view/helpers/tags/grouped_collection_select.rb +4 -2
  51. data/lib/action_view/helpers/tags/hidden_field.rb +6 -0
  52. data/lib/action_view/helpers/tags/label.rb +7 -2
  53. data/lib/action_view/helpers/tags/month_field.rb +3 -2
  54. data/lib/action_view/helpers/tags/number_field.rb +2 -0
  55. data/lib/action_view/helpers/tags/password_field.rb +3 -1
  56. data/lib/action_view/helpers/tags/placeholderable.rb +3 -1
  57. data/lib/action_view/helpers/tags/radio_button.rb +7 -6
  58. data/lib/action_view/helpers/tags/range_field.rb +2 -0
  59. data/lib/action_view/helpers/tags/search_field.rb +14 -9
  60. data/lib/action_view/helpers/tags/select.rb +11 -10
  61. data/lib/action_view/helpers/tags/tel_field.rb +2 -0
  62. data/lib/action_view/helpers/tags/text_area.rb +4 -2
  63. data/lib/action_view/helpers/tags/text_field.rb +8 -8
  64. data/lib/action_view/helpers/tags/time_field.rb +12 -2
  65. data/lib/action_view/helpers/tags/time_select.rb +2 -0
  66. data/lib/action_view/helpers/tags/time_zone_select.rb +3 -1
  67. data/lib/action_view/helpers/tags/translator.rb +15 -16
  68. data/lib/action_view/helpers/tags/url_field.rb +2 -0
  69. data/lib/action_view/helpers/tags/week_field.rb +3 -2
  70. data/lib/action_view/helpers/tags/weekday_select.rb +28 -0
  71. data/lib/action_view/helpers/tags.rb +5 -2
  72. data/lib/action_view/helpers/text_helper.rb +80 -51
  73. data/lib/action_view/helpers/translation_helper.rb +120 -69
  74. data/lib/action_view/helpers/url_helper.rb +398 -171
  75. data/lib/action_view/helpers.rb +29 -27
  76. data/lib/action_view/layouts.rb +68 -63
  77. data/lib/action_view/log_subscriber.rb +77 -10
  78. data/lib/action_view/lookup_context.rb +137 -113
  79. data/lib/action_view/model_naming.rb +4 -2
  80. data/lib/action_view/path_set.rb +28 -32
  81. data/lib/action_view/railtie.rb +74 -13
  82. data/lib/action_view/record_identifier.rb +53 -26
  83. data/lib/action_view/render_parser.rb +188 -0
  84. data/lib/action_view/renderer/abstract_renderer.rb +152 -15
  85. data/lib/action_view/renderer/collection_renderer.rb +196 -0
  86. data/lib/action_view/renderer/object_renderer.rb +34 -0
  87. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +102 -0
  88. data/lib/action_view/renderer/partial_renderer.rb +51 -333
  89. data/lib/action_view/renderer/renderer.rb +68 -11
  90. data/lib/action_view/renderer/streaming_template_renderer.rb +60 -56
  91. data/lib/action_view/renderer/template_renderer.rb +87 -74
  92. data/lib/action_view/rendering.rb +73 -47
  93. data/lib/action_view/ripper_ast_parser.rb +198 -0
  94. data/lib/action_view/routing_url_for.rb +35 -24
  95. data/lib/action_view/tasks/cache_digests.rake +25 -0
  96. data/lib/action_view/template/error.rb +151 -41
  97. data/lib/action_view/template/handlers/builder.rb +12 -13
  98. data/lib/action_view/template/handlers/erb/erubi.rb +89 -0
  99. data/lib/action_view/template/handlers/erb.rb +29 -89
  100. data/lib/action_view/template/handlers/html.rb +11 -0
  101. data/lib/action_view/template/handlers/raw.rb +4 -4
  102. data/lib/action_view/template/handlers.rb +14 -10
  103. data/lib/action_view/template/html.rb +12 -13
  104. data/lib/action_view/template/inline.rb +22 -0
  105. data/lib/action_view/template/raw_file.rb +25 -0
  106. data/lib/action_view/template/renderable.rb +24 -0
  107. data/lib/action_view/template/resolver.rb +139 -300
  108. data/lib/action_view/template/sources/file.rb +17 -0
  109. data/lib/action_view/template/sources.rb +13 -0
  110. data/lib/action_view/template/text.rb +10 -12
  111. data/lib/action_view/template/types.rb +28 -26
  112. data/lib/action_view/template.rb +123 -91
  113. data/lib/action_view/template_details.rb +66 -0
  114. data/lib/action_view/template_path.rb +64 -0
  115. data/lib/action_view/test_case.rb +70 -53
  116. data/lib/action_view/testing/resolvers.rb +25 -35
  117. data/lib/action_view/unbound_template.rb +57 -0
  118. data/lib/action_view/version.rb +3 -1
  119. data/lib/action_view/view_paths.rb +73 -58
  120. data/lib/action_view.rb +16 -11
  121. data/lib/assets/compiled/rails-ujs.js +746 -0
  122. metadata +52 -32
  123. data/lib/action_view/helpers/record_tag_helper.rb +0 -108
  124. data/lib/action_view/tasks/dependencies.rake +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71fb7b73001ccc9220ba0da089fc3336a3a18620ca13a18730fa91d4799fbf58
4
- data.tar.gz: a87ef6a72900a81c7cff2d00f3fac65006c0f95935b7bf366c1f4bfa1210b6d1
3
+ metadata.gz: 05b202fb72d79b08cc80097deb5e09fda321f310a8a06c361599e95a76c16cfc
4
+ data.tar.gz: 64d8271b6a06f9de6f6692b96a1ba3016b53d10b068df1c41db4c81094e642d3
5
5
  SHA512:
6
- metadata.gz: ea93cb6a5de3af579900cf1534b50842c6d197062ee7a01a9f499287dbbb8f6f3d9c32abfadba3c2d1868b8deddc70594c3e5767744031e47961d5da15cb5e54
7
- data.tar.gz: e59b44cf756ed5bf55ef96709055a04413dfba03fa083c32ef709eb266267ac774bc7d83c08c696a16c98e5dd93a412a531372eee7546bcc8e856e1304dcf618
6
+ metadata.gz: 42594ba6f50e9611210173d7a4e42351c928acf1024ea33858d91679b20df6d8fb5b49aa7f21ee147827efcf005ffdb60025cc15293d4f462c1927c3c251155e
7
+ data.tar.gz: ac02f50538a88bc0fec35186567e376c95908cc791b500b24fbcdcbc9ae0a0c839a0f9245e9fae67ea6dde9304e53fe62ad30f0ad4bdf96aced044651df7f4f8
data/CHANGELOG.md CHANGED
@@ -1,357 +1,371 @@
1
- ## Rails 4.2.11.1 (March 11, 2019) ##
1
+ ## Rails 7.0.2.4 (April 26, 2022) ##
2
2
 
3
- * No changes.
4
-
5
-
6
- ## Rails 4.2.11 (November 27, 2018) ##
3
+ * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
7
4
 
8
- * No changes.
5
+ Escape dangerous characters in names of tags and names of attributes in the
6
+ tag helpers, following the XML specification. Rename the option
7
+ `:escape_attributes` to `:escape`, to simplify by applying the option to the
8
+ whole tag.
9
9
 
10
+ *Álvaro Martín Fraguas*
10
11
 
11
- ## Rails 4.2.10 (September 27, 2017) ##
12
+ ## Rails 7.0.2.3 (March 08, 2022) ##
12
13
 
13
14
  * No changes.
14
15
 
15
16
 
16
- ## Rails 4.2.9 (June 26, 2017) ##
17
+ ## Rails 7.0.2.2 (February 11, 2022) ##
17
18
 
18
19
  * No changes.
19
20
 
20
21
 
21
- ## Rails 4.2.8 (February 21, 2017) ##
22
+ ## Rails 7.0.2.1 (February 11, 2022) ##
22
23
 
23
24
  * No changes.
24
25
 
25
26
 
26
- ## Rails 4.2.7 (July 12, 2016) ##
27
-
28
- * No changes.
29
-
30
-
31
- ## Rails 4.2.6 (March 07, 2016) ##
32
-
33
- * Fix stripping the digest from the automatically generated img tag alt
34
- attribute when assets are handled by Sprockets >=3.0.
35
-
36
- *Bart de Water*
37
-
38
- * Create a new `ActiveSupport::SafeBuffer` instance when `content_for` is flushed.
27
+ ## Rails 7.0.2 (February 08, 2022) ##
39
28
 
40
- Fixes #19890
29
+ * Ensure `preload_link_tag` preloads JavaScript modules correctly.
41
30
 
42
- *Yoong Kang Lim*
31
+ *Máximo Mussini*
43
32
 
44
- * Respect value of `:object` if `:object` is false when rendering.
33
+ * Fix `stylesheet_link_tag` and similar helpers are being used to work in objects with
34
+ a `response` method.
45
35
 
46
- Fixes #22260.
36
+ *dark-panda*
47
37
 
48
- *Yuichiro Kaneko*
49
38
 
50
- * Generate `week_field` input values using a 1-based index and not a 0-based index
51
- as per the W3 spec: http://www.w3.org/TR/html-markup/datatypes.html#form.data.week
39
+ ## Rails 7.0.1 (January 06, 2022) ##
52
40
 
53
- *Christoph Geschwind*
41
+ * Fix `button_to` to work with a hash parameter as URL.
54
42
 
43
+ *MingyuanQin*
55
44
 
56
- ## Rails 4.2.5.2 (February 26, 2016) ##
45
+ * Fix `link_to` with a model passed as an argument twice.
57
46
 
58
- * Do not allow render with unpermitted parameter.
47
+ *Alex Ghiculescu*
59
48
 
60
- Fixes CVE-2016-2098.
61
49
 
62
- *Arthur Neves*
50
+ ## Rails 7.0.0 (December 15, 2021) ##
63
51
 
52
+ * Support `include_hidden:` option in calls to
53
+ `ActionView::Helper::FormBuilder#file_field` with `multiple: true` to
54
+ support submitting an empty collection of files.
64
55
 
65
- ## Rails 4.2.5.1 (January 25, 2015) ##
56
+ ```ruby
57
+ form.file_field :attachments, multiple: true
58
+ # => <input type="hidden" autocomplete="off" name="post[attachments][]" value="">
59
+ <input type="file" multiple="multiple" id="post_attachments" name="post[attachments][]">
66
60
 
67
- * Adds boolean argument outside_app_allowed to `ActionView::Resolver#find_templates`
68
- method.
61
+ form.file_field :attachments, multiple: true, include_hidden: false
62
+ # => <input type="file" multiple="multiple" id="post_attachments" name="post[attachments][]">
63
+ ```
69
64
 
70
- *Aaron Patterson*
65
+ *Sean Doyle*
71
66
 
67
+ * Fix `number_with_precision(raise: true)` always raising even on valid numbers.
72
68
 
73
- ## Rails 4.2.5 (November 12, 2015) ##
69
+ *Pedro Moreira*
74
70
 
75
- * Fix `mail_to` when called with `nil` as argument.
76
71
 
77
- *Rafael Mendonça França*
72
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
78
73
 
79
- * `url_for` does not modify its arguments when generating polymorphic URLs.
80
-
81
- *Bernerd Schaefer*
82
-
83
-
84
- ## Rails 4.2.4 (August 24, 2015) ##
85
-
86
- * No Changes *
87
-
88
-
89
- ## Rails 4.2.3 (June 25, 2015) ##
90
-
91
- * `translate` should handle `raise` flag correctly in case of both main and default
92
- translation is missing.
74
+ * No changes.
93
75
 
94
- Fixes #19967
95
76
 
96
- *Bernard Potocki*
77
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
97
78
 
98
- * `translate` allows `default: [[]]` again for a default value of `[]`.
79
+ * No changes.
99
80
 
100
- Fixes #19640.
81
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
101
82
 
102
- *Adam Prescott*
83
+ * Support `fields model: [@nested, @model]` the same way as `form_with model:
84
+ [@nested, @model]`.
103
85
 
104
- * `translate` should accept nils as members of the `:default`
105
- parameter without raising a translation missing error. Fixes a
106
- regression introduced 362557e.
86
+ *Sean Doyle*
107
87
 
108
- Fixes #19419
88
+ * Infer HTTP verb `[method]` from a model or Array with model as the first
89
+ argument to `button_to` when combined with a block:
109
90
 
110
- *Justin Coyne*
91
+ ```ruby
92
+ button_to(Workshop.find(1)){ "Update" }
93
+ #=> <form method="post" action="/workshops/1" class="button_to">
94
+ #=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
95
+ #=> <button type="submit">Update</button>
96
+ #=> </form>
111
97
 
112
- * `number_to_percentage` does not crash with `Float::NAN` or `Float::INFINITY`
113
- as input when `precision: 0` is used.
98
+ button_to([ Workshop.find(1), Session.find(1) ]) { "Update" }
99
+ #=> <form method="post" action="/workshops/1/sessions/1" class="button_to">
100
+ #=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
101
+ #=> <button type="submit">Update</button>
102
+ #=> </form>
103
+ ```
114
104
 
115
- Fixes #19227.
105
+ *Sean Doyle*
116
106
 
117
- *Yves Senn*
107
+ * Support passing a Symbol as the first argument to `FormBuilder#button`:
118
108
 
109
+ ```ruby
110
+ form.button(:draft, value: true)
111
+ # => <button name="post[draft]" value="true" type="submit">Create post</button>
119
112
 
120
- ## Rails 4.2.2 (June 16, 2015) ##
113
+ form.button(:draft, value: true) do
114
+ content_tag(:strong, "Save as draft")
115
+ end
116
+ # => <button name="post[draft]" value="true" type="submit">
117
+ # <strong>Save as draft</strong>
118
+ # </button>
119
+ ```
121
120
 
122
- * No Changes *
121
+ *Sean Doyle*
123
122
 
123
+ * Introduce the `field_name` view helper, along with the
124
+ `FormBuilder#field_name` counterpart:
124
125
 
125
- ## Rails 4.2.1 (March 19, 2015) ##
126
+ ```ruby
127
+ form_for @post do |f|
128
+ f.field_tag :tag, name: f.field_name(:tag, multiple: true)
129
+ # => <input type="text" name="post[tag][]">
130
+ end
131
+ ```
126
132
 
127
- * Default translations that have a lower precedence than an html safe default,
128
- but are not themselves safe, should not be marked as html_safe.
133
+ *Sean Doyle*
129
134
 
130
- *Justin Coyne*
135
+ * Execute the `ActionView::Base.field_error_proc` within the context of the
136
+ `ActionView::Base` instance:
131
137
 
132
- * Added an explicit error message, in `ActionView::PartialRenderer`
133
- for partial `rendering`, when the value of option `as` has invalid characters.
138
+ ```ruby
139
+ config.action_view.field_error_proc = proc { |html| content_tag(:div, html, class: "field_with_errors") }
140
+ ```
134
141
 
135
- *Angelo Capilleri*
142
+ *Sean Doyle*
136
143
 
144
+ * Add support for `button_to ..., authenticity_token: false`
137
145
 
138
- ## Rails 4.2.0 (December 20, 2014) ##
146
+ ```ruby
147
+ button_to "Create", Post.new, authenticity_token: false
148
+ # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button></form>
139
149
 
140
- * Local variable in a partial is now available even if a falsy value is
141
- passed to `:object` when rendering a partial.
150
+ button_to "Create", Post.new, authenticity_token: true
151
+ # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="abc123..." autocomplete="off" /></form>
142
152
 
143
- Fixes #17373.
153
+ button_to "Create", Post.new, authenticity_token: "secret"
154
+ # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="secret" autocomplete="off" /></form>
155
+ ```
144
156
 
145
- *Agis Anastasopoulos*
157
+ *Sean Doyle*
146
158
 
147
- * Add support for `:enforce_utf8` option in `form_for`.
159
+ * Support rendering `<form>` elements _without_ `[action]` attributes by:
148
160
 
149
- This is the same option that was added in 06388b0 to `form_tag` and allows
150
- users to skip the insertion of the UTF8 enforcer tag in a form.
161
+ * `form_with url: false` or `form_with ..., html: { action: false }`
162
+ * `form_for ..., url: false` or `form_for ..., html: { action: false }`
163
+ * `form_tag false` or `form_tag ..., action: false`
164
+ * `button_to "...", false` or `button_to(false) { ... }`
151
165
 
152
- * claudiob *
166
+ *Sean Doyle*
153
167
 
154
- * Fix a bug that <%= foo(){ %> and <%= foo()do %> in view templates were not regarded
155
- as Ruby block calls.
168
+ * Add `:day_format` option to `date_select`
156
169
 
157
- * Akira Matsuda *
170
+ date_select("article", "written_on", day_format: ->(day) { day.ordinalize })
171
+ # generates day options like <option value="1">1st</option>\n<option value="2">2nd</option>...
158
172
 
159
- * Update `select_tag` to work correctly with `:include_blank` option passing a string.
173
+ *Shunichi Ikegami*
160
174
 
161
- Fixes #16483.
175
+ * Allow `link_to` helper to infer link name from `Model#to_s` when it
176
+ is used with a single argument:
162
177
 
163
- *Frank Groeneveld*
178
+ link_to @profile
179
+ #=> <a href="/profiles/1">Eileen</a>
164
180
 
165
- * Changed the meaning of `render "foo/bar"`.
181
+ This assumes the model class implements a `to_s` method like this:
166
182
 
167
- Previously, calling `render "foo/bar"` in a controller action is equivalent
168
- to `render file: "foo/bar"`. In Rails 4.2, this has been changed to mean
169
- `render template: "foo/bar"` instead. If you need to render a file, please
170
- change your code to use the explicit form (`render file: "foo/bar"`) instead.
183
+ class Profile < ApplicationRecord
184
+ # ...
185
+ def to_s
186
+ name
187
+ end
188
+ end
171
189
 
172
- *Jeremy Jackson*
190
+ Previously you had to supply a second argument even if the `Profile`
191
+ model implemented a `#to_s` method that called the `name` method.
173
192
 
174
- * Add support for ARIA attributes in tags.
193
+ link_to @profile, @profile.name
194
+ #=> <a href="/profiles/1">Eileen</a>
175
195
 
176
- Example:
196
+ *Olivier Lacan*
177
197
 
178
- <%= f.text_field :name, aria: { required: "true", hidden: "false" } %>
198
+ * Support svg unpaired tags for `tag` helper.
179
199
 
180
- now generates:
200
+ tag.svg { tag.use('href' => "#cool-icon") }
201
+ # => <svg><use href="#cool-icon"></svg>
181
202
 
182
- <input aria-hidden="false" aria-required="true" id="user_name" name="user[name]" type="text">
203
+ *Oleksii Vasyliev*
183
204
 
184
- *Paola Garcia Casadiego*
185
205
 
186
- * Provide a `builder` object when using the `label` form helper in block form.
206
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
187
207
 
188
- The new `builder` object responds to `translation`, allowing I18n fallback support
189
- when you want to customize how a particular label is presented.
208
+ * No changes.
190
209
 
191
- *Alex Robbin*
192
210
 
193
- * Add I18n support for input/textarea placeholder text.
211
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
194
212
 
195
- Placeholder I18n follows the same convention as `label` I18n.
213
+ * Improves the performance of ActionView::Helpers::NumberHelper formatters by avoiding the use of
214
+ exceptions as flow control.
196
215
 
197
- *Alex Robbin*
216
+ *Mike Dalessio*
198
217
 
199
- * Fix that render layout: 'messages/layout' should also be added to the dependency tracker tree.
218
+ * `preload_link_tag` properly inserts `as` attributes for files with `image` MIME types, such as JPG or SVG.
200
219
 
201
- *DHH*
220
+ *Nate Berkopec*
202
221
 
203
- * Add `PartialIteration` object used when rendering collections.
222
+ * Add `weekday_options_for_select` and `weekday_select` helper methods. Also adds `weekday_select` to `FormBuilder`.
204
223
 
205
- The iteration object is available as the local variable
206
- `#{template_name}_iteration` when rendering partials with collections.
224
+ *Drew Bragg*, *Dana Kashubeck*, *Kasper Timm Hansen*
207
225
 
208
- It gives access to the `size` of the collection being iterated over,
209
- the current `index` and two convenience methods `first?` and `last?`.
226
+ * Add `caching?` helper that returns whether the current code path is being cached and `uncacheable!` to denote helper methods that can't participate in fragment caching.
210
227
 
211
- *Joel Junström*, *Lucas Uyezu*
228
+ *Ben Toews*, *John Hawthorn*, *Kasper Timm Hansen*, *Joel Hawksley*
212
229
 
213
- * Return an absolute instead of relative path from an asset url in the case
214
- of the `asset_host` proc returning nil.
230
+ * Add `include_seconds` option for `time_field`.
215
231
 
216
- *Jolyon Pawlyn*
232
+ <%= form.time_field :foo, include_seconds: false %>
233
+ # => <input value="16:22" type="time" />
217
234
 
218
- * Fix `html_escape_once` to properly handle hex escape sequences (e.g. &#x1a2b;).
235
+ Default includes seconds:
219
236
 
220
- *John F. Douthat*
237
+ <%= form.time_field :foo %>
238
+ # => <input value="16:22:01.440" type="time" />
221
239
 
222
- * Added String support for min and max properties for date field helpers.
240
+ This allows you to take advantage of [different rendering options](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time#time_value_format) in some browsers.
223
241
 
224
- *Todd Bealmear*
242
+ *Alex Ghiculescu*
225
243
 
226
- * The `highlight` helper now accepts a block to be used instead of the `highlighter`
227
- option.
244
+ * Improve error messages when template file does not exist at absolute filepath.
228
245
 
229
- *Lucas Mazza*
246
+ *Ted Whang*
230
247
 
231
- * The `except` and `highlight` helpers now accept regular expressions.
248
+ * Add `:country_code` option to `sms_to` for consistency with `phone_to`.
232
249
 
233
- *Jan Szumiec*
250
+ *Jonathan Hefner*
234
251
 
235
- * Flatten the array parameter in `safe_join`, so it behaves consistently with
236
- `Array#join`.
252
+ * OpenSSL constants are now used for Digest computations.
237
253
 
238
- *Paul Grayson*
254
+ *Dirkjan Bussink*
239
255
 
240
- * Honor `html_safe` on array elements in tag values, as we do for plain string
241
- values.
256
+ * The `translate` helper now passes `default` values that aren't
257
+ translation keys through `I18n.translate` for interpolation.
242
258
 
243
- *Paul Grayson*
259
+ *Jonathan Hefner*
244
260
 
245
- * Add `ActionView::Template::Handler.unregister_template_handler`.
261
+ * Adds option `extname` to `stylesheet_link_tag` to skip default
262
+ `.css` extension appended to the stylesheet path.
246
263
 
247
- It performs the opposite of `ActionView::Template::Handler.register_template_handler`.
264
+ Before:
248
265
 
249
- *Zuhao Wan*
266
+ ```ruby
267
+ stylesheet_link_tag "style.less"
268
+ # <link href="/stylesheets/style.less.scss" rel="stylesheet">
269
+ ```
250
270
 
251
- * Bring `cache_digest` rake tasks up-to-date with the latest API changes.
271
+ After:
252
272
 
253
- *Jiri Pospisil*
273
+ ```ruby
274
+ stylesheet_link_tag "style.less", extname: false, skip_pipeline: true, rel: "stylesheet/less"
275
+ # <link href="/stylesheets/style.less" rel="stylesheet/less">
276
+ ```
254
277
 
255
- * Allow custom `:host` option to be passed to `asset_url` helper that
256
- overwrites `config.action_controller.asset_host` for particular asset.
278
+ *Abhay Nikam*
257
279
 
258
- *Hubert Łępicki*
280
+ * Deprecate `render` locals to be assigned to instance variables.
259
281
 
260
- * Deprecate `AbstractController::Base.parent_prefixes`.
261
- Override `AbstractController::Base.local_prefixes` when you want to change
262
- where to find views.
282
+ *Petrik de Heus*
263
283
 
264
- *Nick Sutterer*
284
+ * Remove legacy default `media=screen` from `stylesheet_link_tag`.
265
285
 
266
- * Take label values into account when doing I18n lookups for model attributes.
286
+ *André Luis Leal Cardoso Junior*
267
287
 
268
- The following:
288
+ * Change `ActionView::Helpers::FormBuilder#button` to transform `formmethod`
289
+ attributes into `_method="$VERB"` Form Data to enable varied same-form actions:
269
290
 
270
- # form.html.erb
271
- <%= form_for @post do |f| %>
272
- <%= f.label :type, value: "long" %>
291
+ <%= form_with model: post, method: :put do %>
292
+ <%= form.button "Update" %>
293
+ <%= form.button "Delete", formmethod: :delete %>
273
294
  <% end %>
295
+ <%# => <form action="posts/1">
296
+ => <input type="hidden" name="_method" value="put">
297
+ => <button type="submit">Update</button>
298
+ => <button type="submit" formmethod="post" name="_method" value="delete">Delete</button>
299
+ => </form>
300
+ %>
274
301
 
275
- # en.yml
276
- en:
277
- activerecord:
278
- attributes:
279
- post/long: "Long-form Post"
280
-
281
- Used to simply return "long", but now it will return "Long-form
282
- Post".
283
-
284
- *Joshua Cody*
285
-
286
- * Change `asset_path` to use File.join to create proper paths:
287
-
288
- Before:
289
-
290
- https://some.host.com//assets/some.js
291
-
292
- After:
293
-
294
- https://some.host.com/assets/some.js
302
+ *Sean Doyle*
295
303
 
296
- *Peter Schröder*
304
+ * Change `ActionView::Helpers::UrlHelper#button_to` to *always* render a
305
+ `<button>` element, regardless of whether or not the content is passed as
306
+ the first argument or as a block.
297
307
 
298
- * Change `favicon_link_tag` default mimetype from `image/vnd.microsoft.icon` to
299
- `image/x-icon`.
308
+ <%= button_to "Delete", post_path(@post), method: :delete %>
309
+ # => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
300
310
 
301
- Before:
302
-
303
- # => favicon_link_tag 'myicon.ico'
304
- <link href="/assets/myicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
305
-
306
- After:
307
-
308
- # => favicon_link_tag 'myicon.ico'
309
- <link href="/assets/myicon.ico" rel="shortcut icon" type="image/x-icon" />
310
-
311
- *Geoffroy Lorieux*
311
+ <%= button_to post_path(@post), method: :delete do %>
312
+ Delete
313
+ <% end %>
314
+ # => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
312
315
 
313
- * Remove wrapping div with inline styles for hidden form fields.
316
+ *Sean Doyle*, *Dusan Orlovic*
314
317
 
315
- We are dropping HTML 4.01 and XHTML strict compliance since input tags directly
316
- inside a form are valid HTML5, and the absence of inline styles help in validating
317
- for Content Security Policy.
318
+ * Add `config.action_view.preload_links_header` to allow disabling of
319
+ the `Link` header being added by default when using `stylesheet_link_tag`
320
+ and `javascript_include_tag`.
318
321
 
319
- *Joost Baaij*
322
+ *Andrew White*
320
323
 
321
- * `collection_check_boxes` respects `:index` option for the hidden field name.
324
+ * The `translate` helper now resolves `default` values when a `nil` key is
325
+ specified, instead of always returning `nil`.
322
326
 
323
- Fixes #14147.
327
+ *Jonathan Hefner*
324
328
 
325
- *Vasiliy Ermolovich*
329
+ * Add `config.action_view.image_loading` to configure the default value of
330
+ the `image_tag` `:loading` option.
326
331
 
327
- * `date_select` helper with option `with_css_classes: true` does not overwrite other classes.
332
+ By setting `config.action_view.image_loading = "lazy"`, an application can opt in to
333
+ lazy loading images sitewide, without changing view code.
328
334
 
329
- *Izumi Wong-Horiuchi*
335
+ *Jonathan Hefner*
330
336
 
331
- * `number_to_percentage` does not crash with `Float::NAN` or `Float::INFINITY`
332
- as input.
337
+ * `ActionView::Helpers::FormBuilder#id` returns the value
338
+ of the `<form>` element's `id` attribute. With a `method` argument, returns
339
+ the `id` attribute for a form field with that name.
333
340
 
334
- Fixes #14405.
341
+ <%= form_for @post do |f| %>
342
+ <%# ... %>
335
343
 
336
- *Yves Senn*
344
+ <% content_for :sticky_footer do %>
345
+ <%= form.button(form: f.id) %>
346
+ <% end %>
347
+ <% end %>
337
348
 
338
- * Add `include_hidden` option to `collection_check_boxes` helper.
349
+ *Sean Doyle*
339
350
 
340
- *Vasiliy Ermolovich*
351
+ * `ActionView::Helpers::FormBuilder#field_id` returns the value generated by
352
+ the FormBuilder for the given attribute name.
341
353
 
342
- * Fixed a problem where the default options for the `button_tag` helper are not
343
- applied correctly.
354
+ <%= form_for @post do |f| %>
355
+ <%= f.label :title %>
356
+ <%= f.text_field :title, aria: { describedby: f.field_id(:title, :error) } %>
357
+ <%= tag.span("is blank", id: f.field_id(:title, :error) %>
358
+ <% end %>
344
359
 
345
- Fixes #14254.
360
+ *Sean Doyle*
346
361
 
347
- *Sergey Prikhodko*
362
+ * Add `tag.attributes` to transform a Hash into HTML Attributes, ready to be
363
+ interpolated into ERB.
348
364
 
349
- * Take variants into account when calculating template digests in ActionView::Digestor.
365
+ <input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
366
+ # => <input type="text" aria-label="Search">
350
367
 
351
- The arguments to ActionView::Digestor#digest are now being passed as a hash
352
- to support variants and allow more flexibility in the future. The support for
353
- regular (required) arguments is deprecated and will be removed in Rails 5.0 or later.
368
+ *Sean Doyle*
354
369
 
355
- *Piotr Chmolowski, Łukasz Strzałkowski*
356
370
 
357
- Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/actionview/CHANGELOG.md) for previous changes.
371
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionview/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2014 David Heinemeier Hansson
1
+ Copyright (c) 2004-2022 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the