actionview 6.1.7.2 → 7.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +265 -261
  3. data/MIT-LICENSE +1 -0
  4. data/lib/action_view/base.rb +4 -7
  5. data/lib/action_view/buffers.rb +2 -2
  6. data/lib/action_view/cache_expiry.rb +46 -32
  7. data/lib/action_view/dependency_tracker/erb_tracker.rb +154 -0
  8. data/lib/action_view/dependency_tracker/ripper_tracker.rb +59 -0
  9. data/lib/action_view/dependency_tracker.rb +6 -147
  10. data/lib/action_view/digestor.rb +7 -4
  11. data/lib/action_view/flows.rb +4 -4
  12. data/lib/action_view/gem_version.rb +5 -5
  13. data/lib/action_view/helpers/active_model_helper.rb +2 -2
  14. data/lib/action_view/helpers/asset_tag_helper.rb +95 -39
  15. data/lib/action_view/helpers/asset_url_helper.rb +16 -16
  16. data/lib/action_view/helpers/atom_feed_helper.rb +3 -4
  17. data/lib/action_view/helpers/cache_helper.rb +52 -3
  18. data/lib/action_view/helpers/capture_helper.rb +4 -4
  19. data/lib/action_view/helpers/controller_helper.rb +2 -2
  20. data/lib/action_view/helpers/csp_helper.rb +1 -1
  21. data/lib/action_view/helpers/csrf_helper.rb +2 -2
  22. data/lib/action_view/helpers/date_helper.rb +111 -43
  23. data/lib/action_view/helpers/debug_helper.rb +3 -1
  24. data/lib/action_view/helpers/form_helper.rb +211 -85
  25. data/lib/action_view/helpers/form_options_helper.rb +70 -33
  26. data/lib/action_view/helpers/form_tag_helper.rb +150 -53
  27. data/lib/action_view/helpers/javascript_helper.rb +3 -5
  28. data/lib/action_view/helpers/number_helper.rb +17 -16
  29. data/lib/action_view/helpers/output_safety_helper.rb +4 -4
  30. data/lib/action_view/helpers/rendering_helper.rb +5 -6
  31. data/lib/action_view/helpers/sanitize_helper.rb +3 -3
  32. data/lib/action_view/helpers/tag_helper.rb +37 -8
  33. data/lib/action_view/helpers/tags/base.rb +5 -25
  34. data/lib/action_view/helpers/tags/check_box.rb +1 -1
  35. data/lib/action_view/helpers/tags/collection_select.rb +1 -1
  36. data/lib/action_view/helpers/tags/file_field.rb +16 -0
  37. data/lib/action_view/helpers/tags/select.rb +1 -1
  38. data/lib/action_view/helpers/tags/time_field.rb +10 -1
  39. data/lib/action_view/helpers/tags/weekday_select.rb +28 -0
  40. data/lib/action_view/helpers/tags.rb +3 -2
  41. data/lib/action_view/helpers/text_helper.rb +25 -14
  42. data/lib/action_view/helpers/translation_helper.rb +12 -43
  43. data/lib/action_view/helpers/url_helper.rb +194 -123
  44. data/lib/action_view/helpers.rb +25 -25
  45. data/lib/action_view/layouts.rb +7 -4
  46. data/lib/action_view/lookup_context.rb +33 -52
  47. data/lib/action_view/model_naming.rb +2 -2
  48. data/lib/action_view/path_set.rb +16 -22
  49. data/lib/action_view/railtie.rb +19 -7
  50. data/lib/action_view/record_identifier.rb +1 -1
  51. data/lib/action_view/render_parser.rb +188 -0
  52. data/lib/action_view/renderer/abstract_renderer.rb +2 -2
  53. data/lib/action_view/renderer/partial_renderer.rb +1 -35
  54. data/lib/action_view/renderer/renderer.rb +4 -4
  55. data/lib/action_view/renderer/streaming_template_renderer.rb +3 -3
  56. data/lib/action_view/renderer/template_renderer.rb +6 -2
  57. data/lib/action_view/rendering.rb +3 -3
  58. data/lib/action_view/ripper_ast_parser.rb +198 -0
  59. data/lib/action_view/routing_url_for.rb +8 -5
  60. data/lib/action_view/template/error.rb +108 -13
  61. data/lib/action_view/template/handlers/erb.rb +6 -0
  62. data/lib/action_view/template/handlers.rb +3 -3
  63. data/lib/action_view/template/html.rb +3 -3
  64. data/lib/action_view/template/inline.rb +3 -3
  65. data/lib/action_view/template/raw_file.rb +3 -3
  66. data/lib/action_view/template/resolver.rb +89 -314
  67. data/lib/action_view/template/text.rb +3 -3
  68. data/lib/action_view/template/types.rb +14 -12
  69. data/lib/action_view/template.rb +18 -2
  70. data/lib/action_view/template_details.rb +66 -0
  71. data/lib/action_view/template_path.rb +64 -0
  72. data/lib/action_view/test_case.rb +7 -3
  73. data/lib/action_view/testing/resolvers.rb +11 -12
  74. data/lib/action_view/unbound_template.rb +33 -7
  75. data/lib/action_view/version.rb +1 -1
  76. data/lib/action_view/view_paths.rb +4 -4
  77. data/lib/action_view.rb +2 -3
  78. data/lib/assets/compiled/rails-ujs.js +36 -5
  79. metadata +23 -16
data/CHANGELOG.md CHANGED
@@ -1,439 +1,443 @@
1
- ## Rails 6.1.7.2 (January 24, 2023) ##
2
-
3
- * No changes.
1
+ ## Rails 7.0.5 (May 24, 2023) ##
4
2
 
3
+ * `FormBuilder#id` finds id set by `form_for` and `form_with`.
5
4
 
6
- ## Rails 6.1.7.1 (January 17, 2023) ##
7
-
8
- * No changes.
5
+ *Matt Polito*
9
6
 
7
+ * Allow all available locales for template lookups.
10
8
 
11
- ## Rails 6.1.7 (September 09, 2022) ##
9
+ *Ben Dilley*
12
10
 
13
- * No changes.
11
+ * Choices of `select` can optionally contain html attributes as the last element
12
+ of the child arrays when using grouped/nested collections
14
13
 
14
+ ```erb
15
+ <%= form.select :foo, [["North America", [["United States","US"],["Canada","CA"]], { disabled: "disabled" }]] %>
16
+ # => <select><optgroup label="North America" disabled="disabled"><option value="US">United States</option><option value="CA">Canada</option></optgroup></select>
17
+ ```
15
18
 
16
- ## Rails 6.1.6.1 (July 12, 2022) ##
19
+ *Chris Gunther*
17
20
 
18
- * No changes.
19
21
 
22
+ ## Rails 7.0.4.3 (March 13, 2023) ##
20
23
 
21
- ## Rails 6.1.6 (May 09, 2022) ##
24
+ * Ignore certain data-* attributes in rails-ujs when element is contenteditable
22
25
 
23
- * No changes.
26
+ [CVE-2023-23913]
24
27
 
25
28
 
26
- ## Rails 6.1.5.1 (April 26, 2022) ##
29
+ ## Rails 7.0.4.2 (January 24, 2023) ##
27
30
 
28
- * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
29
-
30
- Escape dangerous characters in names of tags and names of attributes in the
31
- tag helpers, following the XML specification. Rename the option
32
- `:escape_attributes` to `:escape`, to simplify by applying the option to the
33
- whole tag.
31
+ * No changes.
34
32
 
35
- *Álvaro Martín Fraguas*
36
33
 
37
- ## Rails 6.1.5 (March 09, 2022) ##
34
+ ## Rails 7.0.4.1 (January 17, 2023) ##
38
35
 
39
- * `preload_link_tag` properly inserts `as` attributes for files with `image` MIME
40
- types, such as JPG or SVG.
36
+ * No changes.
41
37
 
42
- *Nate Berkopec*
43
38
 
44
- * Add `autocomplete="off"` to all generated hidden fields.
39
+ ## Rails 7.0.4 (September 09, 2022) ##
45
40
 
46
- Fixes #42610.
41
+ * Guard against `ActionView::Helpers::FormTagHelper#field_name` calls with nil
42
+ `object_name` arguments. For example:
47
43
 
48
- *Ryan Baumann*
44
+ ```erb
45
+ <%= fields do |f| %>
46
+ <%= f.field_name :body %>
47
+ <% end %>
48
+ ```
49
49
 
50
- * Fix `current_page?` when URL has trailing slash.
50
+ *Sean Doyle*
51
51
 
52
- This fixes the `current_page?` helper when the given URL has a trailing slash,
53
- and is an absolute URL or also has query params.
52
+ * Strings returned from `strip_tags` are correctly tagged `html_safe?`
54
53
 
55
- Fixes #33956.
54
+ Because these strings contain no HTML elements and the basic entities are escaped, they are safe
55
+ to be included as-is as PCDATA in HTML content. Tagging them as html-safe avoids double-escaping
56
+ entities when being concatenated to a SafeBuffer during rendering.
56
57
 
57
- *Jonathan Hefner*
58
+ Fixes [rails/rails-html-sanitizer#124](https://github.com/rails/rails-html-sanitizer/issues/124)
58
59
 
60
+ *Mike Dalessio*
59
61
 
60
- ## Rails 6.1.4.7 (March 08, 2022) ##
62
+ ## Rails 7.0.3.1 (July 12, 2022) ##
61
63
 
62
64
  * No changes.
63
65
 
64
66
 
65
- ## Rails 6.1.4.6 (February 11, 2022) ##
66
-
67
- * No changes.
67
+ ## Rails 7.0.3 (May 09, 2022) ##
68
68
 
69
+ * Ensure models passed to `form_for` attempt to call `to_model`.
69
70
 
70
- ## Rails 6.1.4.5 (February 11, 2022) ##
71
-
72
- * No changes.
71
+ *Sean Doyle*
73
72
 
73
+ ## Rails 7.0.2.4 (April 26, 2022) ##
74
74
 
75
- ## Rails 6.1.4.4 (December 15, 2021) ##
75
+ * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
76
76
 
77
- * No changes.
77
+ Escape dangerous characters in names of tags and names of attributes in the
78
+ tag helpers, following the XML specification. Rename the option
79
+ `:escape_attributes` to `:escape`, to simplify by applying the option to the
80
+ whole tag.
78
81
 
82
+ *Álvaro Martín Fraguas*
79
83
 
80
- ## Rails 6.1.4.3 (December 14, 2021) ##
84
+ ## Rails 7.0.2.3 (March 08, 2022) ##
81
85
 
82
86
  * No changes.
83
87
 
84
88
 
85
- ## Rails 6.1.4.2 (December 14, 2021) ##
89
+ ## Rails 7.0.2.2 (February 11, 2022) ##
86
90
 
87
91
  * No changes.
88
92
 
89
93
 
90
- ## Rails 6.1.4.1 (August 19, 2021) ##
94
+ ## Rails 7.0.2.1 (February 11, 2022) ##
91
95
 
92
96
  * No changes.
93
97
 
94
98
 
95
- ## Rails 6.1.4 (June 24, 2021) ##
99
+ ## Rails 7.0.2 (February 08, 2022) ##
96
100
 
97
- * The `translate` helper now passes `default` values that aren't
98
- translation keys through `I18n.translate` for interpolation.
101
+ * Ensure `preload_link_tag` preloads JavaScript modules correctly.
99
102
 
100
- *Jonathan Hefner*
103
+ *Máximo Mussini*
101
104
 
102
- * Don't attach UJS form submission handlers to Turbo forms.
105
+ * Fix `stylesheet_link_tag` and similar helpers are being used to work in objects with
106
+ a `response` method.
103
107
 
104
- *David Heinemeier Hansson*
108
+ *dark-panda*
105
109
 
106
- * Allow both `current_page?(url_hash)` and `current_page?(**url_hash)` on Ruby 2.7.
107
110
 
108
- *Ryuta Kamizono*
111
+ ## Rails 7.0.1 (January 06, 2022) ##
109
112
 
113
+ * Fix `button_to` to work with a hash parameter as URL.
110
114
 
111
- ## Rails 6.1.3.2 (May 05, 2021) ##
115
+ *MingyuanQin*
112
116
 
113
- * No changes.
117
+ * Fix `link_to` with a model passed as an argument twice.
114
118
 
119
+ *Alex Ghiculescu*
115
120
 
116
- ## Rails 6.1.3.1 (March 26, 2021) ##
117
121
 
118
- * No changes.
122
+ ## Rails 7.0.0 (December 15, 2021) ##
119
123
 
124
+ * Support `include_hidden:` option in calls to
125
+ `ActionView::Helper::FormBuilder#file_field` with `multiple: true` to
126
+ support submitting an empty collection of files.
120
127
 
121
- ## Rails 6.1.3 (February 17, 2021) ##
128
+ ```ruby
129
+ form.file_field :attachments, multiple: true
130
+ # => <input type="hidden" autocomplete="off" name="post[attachments][]" value="">
131
+ <input type="file" multiple="multiple" id="post_attachments" name="post[attachments][]">
122
132
 
123
- * No changes.
133
+ form.file_field :attachments, multiple: true, include_hidden: false
134
+ # => <input type="file" multiple="multiple" id="post_attachments" name="post[attachments][]">
135
+ ```
124
136
 
137
+ *Sean Doyle*
125
138
 
126
- ## Rails 6.1.2.1 (February 10, 2021) ##
139
+ * Fix `number_with_precision(raise: true)` always raising even on valid numbers.
127
140
 
128
- * No changes.
141
+ *Pedro Moreira*
129
142
 
130
143
 
131
- ## Rails 6.1.2 (February 09, 2021) ##
144
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
132
145
 
133
146
  * No changes.
134
147
 
135
148
 
136
- ## Rails 6.1.1 (January 07, 2021) ##
137
-
138
- * Fix lazy translation in partial with block.
139
-
140
- *Marek Kasztelnik*
149
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
141
150
 
142
- * Avoid extra `SELECT COUNT` queries when rendering Active Record collections.
143
-
144
- *aar0nr*
145
-
146
- * Link preloading keep integrity hashes in the header.
147
-
148
- *Étienne Barrié*
149
-
150
- * Add `config.action_view.preload_links_header` to allow disabling of
151
- the `Link` header being added by default when using `stylesheet_link_tag`
152
- and `javascript_include_tag`.
153
-
154
- *Andrew White*
155
-
156
- * The `translate` helper now resolves `default` values when a `nil` key is
157
- specified, instead of always returning `nil`.
151
+ * No changes.
158
152
 
159
- *Jonathan Hefner*
153
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
160
154
 
155
+ * Support `fields model: [@nested, @model]` the same way as `form_with model:
156
+ [@nested, @model]`.
161
157
 
162
- ## Rails 6.1.0 (December 09, 2020) ##
158
+ *Sean Doyle*
163
159
 
164
- * SanitizeHelper.sanitized_allowed_attributes and SanitizeHelper.sanitized_allowed_tags
165
- call safe_list_sanitizer's class method
160
+ * Infer HTTP verb `[method]` from a model or Array with model as the first
161
+ argument to `button_to` when combined with a block:
166
162
 
167
- Fixes #39586
163
+ ```ruby
164
+ button_to(Workshop.find(1)){ "Update" }
165
+ #=> <form method="post" action="/workshops/1" class="button_to">
166
+ #=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
167
+ #=> <button type="submit">Update</button>
168
+ #=> </form>
169
+
170
+ button_to([ Workshop.find(1), Session.find(1) ]) { "Update" }
171
+ #=> <form method="post" action="/workshops/1/sessions/1" class="button_to">
172
+ #=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
173
+ #=> <button type="submit">Update</button>
174
+ #=> </form>
175
+ ```
168
176
 
169
- *Taufiq Muhammadi*
177
+ *Sean Doyle*
170
178
 
171
- * Change form_with to generate non-remote forms by default.
179
+ * Support passing a Symbol as the first argument to `FormBuilder#button`:
172
180
 
173
- `form_with` would generate a remote form by default. This would confuse
174
- users because they were forced to handle remote requests.
181
+ ```ruby
182
+ form.button(:draft, value: true)
183
+ # => <button name="post[draft]" value="true" type="submit">Create post</button>
184
+
185
+ form.button(:draft, value: true) do
186
+ content_tag(:strong, "Save as draft")
187
+ end
188
+ # => <button name="post[draft]" value="true" type="submit">
189
+ # <strong>Save as draft</strong>
190
+ # </button>
191
+ ```
175
192
 
176
- All new 6.1 applications will generate non-remote forms by default.
177
- When upgrading a 6.0 application you can enable remote forms by default by
178
- setting `config.action_view.form_with_generates_remote_forms` to `true`.
193
+ *Sean Doyle*
179
194
 
180
- *Petrik de Heus*
195
+ * Introduce the `field_name` view helper, along with the
196
+ `FormBuilder#field_name` counterpart:
181
197
 
182
- * Yield translated strings to calls of `ActionView::FormBuilder#button`
183
- when a block is given.
198
+ ```ruby
199
+ form_for @post do |f|
200
+ f.field_tag :tag, name: f.field_name(:tag, multiple: true)
201
+ # => <input type="text" name="post[tag][]">
202
+ end
203
+ ```
184
204
 
185
205
  *Sean Doyle*
186
206
 
187
- * Alias `ActionView::Helpers::Tags::Label::LabelBuilder#translation` to
188
- `#to_s` so that `form.label` calls can yield that value to their blocks.
207
+ * Execute the `ActionView::Base.field_error_proc` within the context of the
208
+ `ActionView::Base` instance:
209
+
210
+ ```ruby
211
+ config.action_view.field_error_proc = proc { |html| content_tag(:div, html, class: "field_with_errors") }
212
+ ```
189
213
 
190
214
  *Sean Doyle*
191
215
 
192
- * Rename the new `TagHelper#class_names` method to `TagHelper#token_list`,
193
- and make the original available as an alias.
216
+ * Add support for `button_to ..., authenticity_token: false`
194
217
 
195
- token_list("foo", "foo bar")
196
- # => "foo bar"
218
+ ```ruby
219
+ button_to "Create", Post.new, authenticity_token: false
220
+ # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button></form>
197
221
 
198
- *Sean Doyle*
222
+ button_to "Create", Post.new, authenticity_token: true
223
+ # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="abc123..." autocomplete="off" /></form>
199
224
 
200
- * ARIA Array and Hash attributes are treated as space separated `DOMTokenList`
201
- values. This is useful when declaring lists of label text identifiers in
202
- `aria-labelledby` or `aria-describedby`.
203
-
204
- tag.input type: 'checkbox', name: 'published', aria: {
205
- invalid: @post.errors[:published].any?,
206
- labelledby: ['published_context', 'published_label'],
207
- describedby: { published_errors: @post.errors[:published].any? }
208
- }
209
- #=> <input
210
- type="checkbox" name="published" aria-invalid="true"
211
- aria-labelledby="published_context published_label"
212
- aria-describedby="published_errors"
213
- >
225
+ button_to "Create", Post.new, authenticity_token: "secret"
226
+ # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="secret" autocomplete="off" /></form>
227
+ ```
214
228
 
215
229
  *Sean Doyle*
216
230
 
217
- * Remove deprecated `escape_whitelist` from `ActionView::Template::Handlers::ERB`.
231
+ * Support rendering `<form>` elements _without_ `[action]` attributes by:
218
232
 
219
- *Rafael Mendonça França*
233
+ * `form_with url: false` or `form_with ..., html: { action: false }`
234
+ * `form_for ..., url: false` or `form_for ..., html: { action: false }`
235
+ * `form_tag false` or `form_tag ..., action: false`
236
+ * `button_to "...", false` or `button_to(false) { ... }`
220
237
 
221
- * Remove deprecated `find_all_anywhere` from `ActionView::Resolver`.
222
-
223
- *Rafael Mendonça França*
238
+ *Sean Doyle*
224
239
 
225
- * Remove deprecated `formats` from `ActionView::Template::HTML`.
240
+ * Add `:day_format` option to `date_select`
226
241
 
227
- *Rafael Mendonça França*
242
+ date_select("article", "written_on", day_format: ->(day) { day.ordinalize })
243
+ # generates day options like <option value="1">1st</option>\n<option value="2">2nd</option>...
228
244
 
229
- * Remove deprecated `formats` from `ActionView::Template::RawFile`.
245
+ *Shunichi Ikegami*
230
246
 
231
- *Rafael Mendonça França*
247
+ * Allow `link_to` helper to infer link name from `Model#to_s` when it
248
+ is used with a single argument:
232
249
 
233
- * Remove deprecated `formats` from `ActionView::Template::Text`.
250
+ link_to @profile
251
+ #=> <a href="/profiles/1">Eileen</a>
234
252
 
235
- *Rafael Mendonça França*
253
+ This assumes the model class implements a `to_s` method like this:
236
254
 
237
- * Remove deprecated `find_file` from `ActionView::PathSet`.
255
+ class Profile < ApplicationRecord
256
+ # ...
257
+ def to_s
258
+ name
259
+ end
260
+ end
238
261
 
239
- *Rafael Mendonça França*
262
+ Previously you had to supply a second argument even if the `Profile`
263
+ model implemented a `#to_s` method that called the `name` method.
240
264
 
241
- * Remove deprecated `rendered_format` from `ActionView::LookupContext`.
265
+ link_to @profile, @profile.name
266
+ #=> <a href="/profiles/1">Eileen</a>
242
267
 
243
- *Rafael Mendonça França*
268
+ *Olivier Lacan*
244
269
 
245
- * Remove deprecated `find_file` from `ActionView::ViewPaths`.
270
+ * Support svg unpaired tags for `tag` helper.
246
271
 
247
- *Rafael Mendonça França*
272
+ tag.svg { tag.use('href' => "#cool-icon") }
273
+ # => <svg><use href="#cool-icon"></svg>
248
274
 
249
- * Require that `ActionView::Base` subclasses implement `#compiled_method_container`.
275
+ *Oleksii Vasyliev*
250
276
 
251
- *Rafael Mendonça França*
252
277
 
253
- * Remove deprecated support to pass an object that is not a `ActionView::LookupContext` as the first argument
254
- in `ActionView::Base#initialize`.
278
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
255
279
 
256
- *Rafael Mendonça França*
280
+ * No changes.
257
281
 
258
- * Remove deprecated `format` argument `ActionView::Base#initialize`.
259
282
 
260
- *Rafael Mendonça França*
283
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
261
284
 
262
- * Remove deprecated `ActionView::Template#refresh`.
285
+ * Improves the performance of ActionView::Helpers::NumberHelper formatters by avoiding the use of
286
+ exceptions as flow control.
263
287
 
264
- *Rafael Mendonça França*
288
+ *Mike Dalessio*
265
289
 
266
- * Remove deprecated `ActionView::Template#original_encoding`.
290
+ * `preload_link_tag` properly inserts `as` attributes for files with `image` MIME types, such as JPG or SVG.
267
291
 
268
- *Rafael Mendonça França*
292
+ *Nate Berkopec*
269
293
 
270
- * Remove deprecated `ActionView::Template#variants`.
294
+ * Add `weekday_options_for_select` and `weekday_select` helper methods. Also adds `weekday_select` to `FormBuilder`.
271
295
 
272
- *Rafael Mendonça França*
296
+ *Drew Bragg*, *Dana Kashubeck*, *Kasper Timm Hansen*
273
297
 
274
- * Remove deprecated `ActionView::Template#formats`.
298
+ * 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.
275
299
 
276
- *Rafael Mendonça França*
300
+ *Ben Toews*, *John Hawthorn*, *Kasper Timm Hansen*, *Joel Hawksley*
277
301
 
278
- * Remove deprecated `ActionView::Template#virtual_path=`.
302
+ * Add `include_seconds` option for `time_field`.
279
303
 
280
- *Rafael Mendonça França*
304
+ <%= form.time_field :foo, include_seconds: false %>
305
+ # => <input value="16:22" type="time" />
281
306
 
282
- * Remove deprecated `ActionView::Template#updated_at`.
307
+ Default includes seconds:
283
308
 
284
- *Rafael Mendonça França*
309
+ <%= form.time_field :foo %>
310
+ # => <input value="16:22:01.440" type="time" />
285
311
 
286
- * Remove deprecated `updated_at` argument required on `ActionView::Template#initialize`.
312
+ 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.
287
313
 
288
- *Rafael Mendonça França*
314
+ *Alex Ghiculescu*
289
315
 
290
- * Make `locals` argument required on `ActionView::Template#initialize`.
316
+ * Improve error messages when template file does not exist at absolute filepath.
291
317
 
292
- *Rafael Mendonça França*
318
+ *Ted Whang*
293
319
 
294
- * Remove deprecated `ActionView::Template.finalize_compiled_template_methods`.
320
+ * Add `:country_code` option to `sms_to` for consistency with `phone_to`.
295
321
 
296
- *Rafael Mendonça França*
322
+ *Jonathan Hefner*
297
323
 
298
- * Remove deprecated `config.action_view.finalize_compiled_template_methods`
324
+ * OpenSSL constants are now used for Digest computations.
299
325
 
300
- *Rafael Mendonça França*
326
+ *Dirkjan Bussink*
301
327
 
302
- * Remove deprecated support to calling `ActionView::ViewPaths#with_fallback` with a block.
328
+ * The `translate` helper now passes `default` values that aren't
329
+ translation keys through `I18n.translate` for interpolation.
303
330
 
304
- *Rafael Mendonça França*
331
+ *Jonathan Hefner*
305
332
 
306
- * Remove deprecated support to passing absolute paths to `render template:`.
333
+ * Adds option `extname` to `stylesheet_link_tag` to skip default
334
+ `.css` extension appended to the stylesheet path.
307
335
 
308
- *Rafael Mendonça França*
336
+ Before:
309
337
 
310
- * Remove deprecated support to passing relative paths to `render file:`.
338
+ ```ruby
339
+ stylesheet_link_tag "style.less"
340
+ # <link href="/stylesheets/style.less.scss" rel="stylesheet">
341
+ ```
311
342
 
312
- *Rafael Mendonça França*
343
+ After:
313
344
 
314
- * Remove support to template handlers that don't accept two arguments.
345
+ ```ruby
346
+ stylesheet_link_tag "style.less", extname: false, skip_pipeline: true, rel: "stylesheet/less"
347
+ # <link href="/stylesheets/style.less" rel="stylesheet/less">
348
+ ```
315
349
 
316
- *Rafael Mendonça França*
350
+ *Abhay Nikam*
317
351
 
318
- * Remove deprecated pattern argument in `ActionView::Template::PathResolver`.
352
+ * Deprecate `render` locals to be assigned to instance variables.
319
353
 
320
- *Rafael Mendonça França*
354
+ *Petrik de Heus*
321
355
 
322
- * Remove deprecated support to call private methods from object in some view helpers.
356
+ * Remove legacy default `media=screen` from `stylesheet_link_tag`.
323
357
 
324
- *Rafael Mendonça França*
358
+ *André Luis Leal Cardoso Junior*
325
359
 
326
- * `ActionView::Helpers::TranslationHelper#translate` accepts a block, yielding
327
- the translated text and the fully resolved translation key:
360
+ * Change `ActionView::Helpers::FormBuilder#button` to transform `formmethod`
361
+ attributes into `_method="$VERB"` Form Data to enable varied same-form actions:
328
362
 
329
- <%= translate(".relative_key") do |translation, resolved_key| %>
330
- <span title="<%= resolved_key %>"><%= translation %></span>
363
+ <%= form_with model: post, method: :put do %>
364
+ <%= form.button "Update" %>
365
+ <%= form.button "Delete", formmethod: :delete %>
331
366
  <% end %>
367
+ <%# => <form action="posts/1">
368
+ => <input type="hidden" name="_method" value="put">
369
+ => <button type="submit">Update</button>
370
+ => <button type="submit" formmethod="post" name="_method" value="delete">Delete</button>
371
+ => </form>
372
+ %>
332
373
 
333
374
  *Sean Doyle*
334
375
 
335
- * Ensure cache fragment digests include all relevant template dependencies when
336
- fragments are contained in a block passed to the render helper. Remove the
337
- virtual_path keyword arguments found in CacheHelper as they no longer possess
338
- any function following 1581cab.
339
-
340
- Fixes #38984.
341
-
342
- *Aaron Lipman*
376
+ * Change `ActionView::Helpers::UrlHelper#button_to` to *always* render a
377
+ `<button>` element, regardless of whether or not the content is passed as
378
+ the first argument or as a block.
343
379
 
344
- * Deprecate `config.action_view.raise_on_missing_translations` in favor of
345
- `config.i18n.raise_on_missing_translations`.
380
+ <%= button_to "Delete", post_path(@post), method: :delete %>
381
+ # => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
346
382
 
347
- New generalized configuration option now determines whether an error should be raised
348
- for missing translations in controllers and views.
349
-
350
- *fatkodima*
351
-
352
- * Instrument layout rendering in `TemplateRenderer#render_with_layout` as `render_layout.action_view`,
353
- and include (when necessary) the layout's virtual path in notification payloads for collection and partial renders.
354
-
355
- *Zach Kemp*
356
-
357
- * `ActionView::Base.annotate_rendered_view_with_filenames` annotates HTML output with template file names.
358
-
359
- *Joel Hawksley*, *Aaron Patterson*
360
-
361
- * `ActionView::Helpers::TranslationHelper#translate` returns nil when
362
- passed `default: nil` without a translation matching `I18n#translate`.
363
-
364
- *Stefan Wrobel*
365
-
366
- * `OptimizedFileSystemResolver` prefers template details in order of locale,
367
- formats, variants, handlers.
368
-
369
- *Iago Pimenta*
370
-
371
- * Added `class_names` helper to create a CSS class value with conditional classes.
372
-
373
- *Joel Hawksley*, *Aaron Patterson*
374
-
375
- * Add support for conditional values to TagBuilder.
376
-
377
- *Joel Hawksley*
383
+ <%= button_to post_path(@post), method: :delete do %>
384
+ Delete
385
+ <% end %>
386
+ # => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
378
387
 
379
- * `ActionView::Helpers::FormOptionsHelper#select` should mark option for `nil` as selected.
388
+ *Sean Doyle*, *Dusan Orlovic*
380
389
 
381
- ```ruby
382
- @post = Post.new
383
- @post.category = nil
384
-
385
- # Before
386
- select("post", "category", none: nil, programming: 1, economics: 2)
387
- # =>
388
- # <select name="post[category]" id="post_category">
389
- # <option value="">none</option>
390
- # <option value="1">programming</option>
391
- # <option value="2">economics</option>
392
- # </select>
393
-
394
- # After
395
- select("post", "category", none: nil, programming: 1, economics: 2)
396
- # =>
397
- # <select name="post[category]" id="post_category">
398
- # <option selected="selected" value="">none</option>
399
- # <option value="1">programming</option>
400
- # <option value="2">economics</option>
401
- # </select>
402
- ```
390
+ * Add `config.action_view.preload_links_header` to allow disabling of
391
+ the `Link` header being added by default when using `stylesheet_link_tag`
392
+ and `javascript_include_tag`.
403
393
 
404
- *bogdanvlviv*
394
+ *Andrew White*
405
395
 
406
- * Log lines for partial renders and started template renders are now
407
- emitted at the `DEBUG` level instead of `INFO`.
396
+ * The `translate` helper now resolves `default` values when a `nil` key is
397
+ specified, instead of always returning `nil`.
408
398
 
409
- Completed template renders are still logged at the `INFO` level.
399
+ *Jonathan Hefner*
410
400
 
411
- *DHH*
401
+ * Add `config.action_view.image_loading` to configure the default value of
402
+ the `image_tag` `:loading` option.
412
403
 
413
- * ActionView::Helpers::SanitizeHelper: support rails-html-sanitizer 1.1.0.
404
+ By setting `config.action_view.image_loading = "lazy"`, an application can opt in to
405
+ lazy loading images sitewide, without changing view code.
414
406
 
415
- *Juanito Fatas*
407
+ *Jonathan Hefner*
416
408
 
417
- * Added `phone_to` helper method to create a link from mobile numbers.
409
+ * `ActionView::Helpers::FormBuilder#id` returns the value
410
+ of the `<form>` element's `id` attribute. With a `method` argument, returns
411
+ the `id` attribute for a form field with that name.
418
412
 
419
- *Pietro Moro*
413
+ <%= form_for @post do |f| %>
414
+ <%# ... %>
420
415
 
421
- * annotated_source_code returns an empty array so TemplateErrors without a
422
- template in the backtrace are surfaced properly by DebugExceptions.
416
+ <% content_for :sticky_footer do %>
417
+ <%= form.button(form: f.id) %>
418
+ <% end %>
419
+ <% end %>
423
420
 
424
- *Guilherme Mansur*, *Kasper Timm Hansen*
421
+ *Sean Doyle*
425
422
 
426
- * Add autoload for SyntaxErrorInTemplate so syntax errors are correctly raised by DebugExceptions.
423
+ * `ActionView::Helpers::FormBuilder#field_id` returns the value generated by
424
+ the FormBuilder for the given attribute name.
427
425
 
428
- *Guilherme Mansur*, *Gannon McGibbon*
426
+ <%= form_for @post do |f| %>
427
+ <%= f.label :title %>
428
+ <%= f.text_field :title, aria: { describedby: f.field_id(:title, :error) } %>
429
+ <%= tag.span("is blank", id: f.field_id(:title, :error) %>
430
+ <% end %>
429
431
 
430
- * `RenderingHelper` supports rendering objects that `respond_to?` `:render_in`.
432
+ *Sean Doyle*
431
433
 
432
- *Joel Hawksley*, *Natasha Umer*, *Aaron Patterson*, *Shawn Allen*, *Emily Plummer*, *Diana Mounter*, *John Hawthorn*, *Nathan Herald*, *Zaid Zawaideh*, *Zach Ahn*
434
+ * Add `tag.attributes` to transform a Hash into HTML Attributes, ready to be
435
+ interpolated into ERB.
433
436
 
434
- * Fix `select_tag` so that it doesn't change `options` when `include_blank` is present.
437
+ <input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
438
+ # => <input type="text" aria-label="Search">
435
439
 
436
- *Younes SERRAJ*
440
+ *Sean Doyle*
437
441
 
438
442
 
439
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionview/CHANGELOG.md) for previous changes.
443
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionview/CHANGELOG.md) for previous changes.