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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +265 -261
- data/MIT-LICENSE +1 -0
- data/lib/action_view/base.rb +4 -7
- data/lib/action_view/buffers.rb +2 -2
- data/lib/action_view/cache_expiry.rb +46 -32
- data/lib/action_view/dependency_tracker/erb_tracker.rb +154 -0
- data/lib/action_view/dependency_tracker/ripper_tracker.rb +59 -0
- data/lib/action_view/dependency_tracker.rb +6 -147
- data/lib/action_view/digestor.rb +7 -4
- data/lib/action_view/flows.rb +4 -4
- data/lib/action_view/gem_version.rb +5 -5
- data/lib/action_view/helpers/active_model_helper.rb +2 -2
- data/lib/action_view/helpers/asset_tag_helper.rb +95 -39
- data/lib/action_view/helpers/asset_url_helper.rb +16 -16
- data/lib/action_view/helpers/atom_feed_helper.rb +3 -4
- data/lib/action_view/helpers/cache_helper.rb +52 -3
- data/lib/action_view/helpers/capture_helper.rb +4 -4
- data/lib/action_view/helpers/controller_helper.rb +2 -2
- data/lib/action_view/helpers/csp_helper.rb +1 -1
- data/lib/action_view/helpers/csrf_helper.rb +2 -2
- data/lib/action_view/helpers/date_helper.rb +111 -43
- data/lib/action_view/helpers/debug_helper.rb +3 -1
- data/lib/action_view/helpers/form_helper.rb +211 -85
- data/lib/action_view/helpers/form_options_helper.rb +70 -33
- data/lib/action_view/helpers/form_tag_helper.rb +150 -53
- data/lib/action_view/helpers/javascript_helper.rb +3 -5
- data/lib/action_view/helpers/number_helper.rb +17 -16
- data/lib/action_view/helpers/output_safety_helper.rb +4 -4
- data/lib/action_view/helpers/rendering_helper.rb +5 -6
- data/lib/action_view/helpers/sanitize_helper.rb +3 -3
- data/lib/action_view/helpers/tag_helper.rb +37 -8
- data/lib/action_view/helpers/tags/base.rb +5 -25
- data/lib/action_view/helpers/tags/check_box.rb +1 -1
- data/lib/action_view/helpers/tags/collection_select.rb +1 -1
- data/lib/action_view/helpers/tags/file_field.rb +16 -0
- data/lib/action_view/helpers/tags/select.rb +1 -1
- data/lib/action_view/helpers/tags/time_field.rb +10 -1
- data/lib/action_view/helpers/tags/weekday_select.rb +28 -0
- data/lib/action_view/helpers/tags.rb +3 -2
- data/lib/action_view/helpers/text_helper.rb +25 -14
- data/lib/action_view/helpers/translation_helper.rb +12 -43
- data/lib/action_view/helpers/url_helper.rb +194 -123
- data/lib/action_view/helpers.rb +25 -25
- data/lib/action_view/layouts.rb +7 -4
- data/lib/action_view/lookup_context.rb +33 -52
- data/lib/action_view/model_naming.rb +2 -2
- data/lib/action_view/path_set.rb +16 -22
- data/lib/action_view/railtie.rb +19 -7
- data/lib/action_view/record_identifier.rb +1 -1
- data/lib/action_view/render_parser.rb +188 -0
- data/lib/action_view/renderer/abstract_renderer.rb +2 -2
- data/lib/action_view/renderer/partial_renderer.rb +1 -35
- data/lib/action_view/renderer/renderer.rb +4 -4
- data/lib/action_view/renderer/streaming_template_renderer.rb +3 -3
- data/lib/action_view/renderer/template_renderer.rb +6 -2
- data/lib/action_view/rendering.rb +3 -3
- data/lib/action_view/ripper_ast_parser.rb +198 -0
- data/lib/action_view/routing_url_for.rb +8 -5
- data/lib/action_view/template/error.rb +108 -13
- data/lib/action_view/template/handlers/erb.rb +6 -0
- data/lib/action_view/template/handlers.rb +3 -3
- data/lib/action_view/template/html.rb +3 -3
- data/lib/action_view/template/inline.rb +3 -3
- data/lib/action_view/template/raw_file.rb +3 -3
- data/lib/action_view/template/resolver.rb +89 -314
- data/lib/action_view/template/text.rb +3 -3
- data/lib/action_view/template/types.rb +14 -12
- data/lib/action_view/template.rb +18 -2
- data/lib/action_view/template_details.rb +66 -0
- data/lib/action_view/template_path.rb +64 -0
- data/lib/action_view/test_case.rb +7 -3
- data/lib/action_view/testing/resolvers.rb +11 -12
- data/lib/action_view/unbound_template.rb +33 -7
- data/lib/action_view/version.rb +1 -1
- data/lib/action_view/view_paths.rb +4 -4
- data/lib/action_view.rb +2 -3
- data/lib/assets/compiled/rails-ujs.js +36 -5
- metadata +23 -16
data/CHANGELOG.md
CHANGED
@@ -1,439 +1,443 @@
|
|
1
|
-
## Rails
|
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
|
-
|
7
|
-
|
8
|
-
* No changes.
|
5
|
+
*Matt Polito*
|
9
6
|
|
7
|
+
* Allow all available locales for template lookups.
|
10
8
|
|
11
|
-
|
9
|
+
*Ben Dilley*
|
12
10
|
|
13
|
-
*
|
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
|
-
|
19
|
+
*Chris Gunther*
|
17
20
|
|
18
|
-
* No changes.
|
19
21
|
|
22
|
+
## Rails 7.0.4.3 (March 13, 2023) ##
|
20
23
|
|
21
|
-
|
24
|
+
* Ignore certain data-* attributes in rails-ujs when element is contenteditable
|
22
25
|
|
23
|
-
|
26
|
+
[CVE-2023-23913]
|
24
27
|
|
25
28
|
|
26
|
-
## Rails
|
29
|
+
## Rails 7.0.4.2 (January 24, 2023) ##
|
27
30
|
|
28
|
-
*
|
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
|
34
|
+
## Rails 7.0.4.1 (January 17, 2023) ##
|
38
35
|
|
39
|
-
*
|
40
|
-
types, such as JPG or SVG.
|
36
|
+
* No changes.
|
41
37
|
|
42
|
-
*Nate Berkopec*
|
43
38
|
|
44
|
-
|
39
|
+
## Rails 7.0.4 (September 09, 2022) ##
|
45
40
|
|
46
|
-
|
41
|
+
* Guard against `ActionView::Helpers::FormTagHelper#field_name` calls with nil
|
42
|
+
`object_name` arguments. For example:
|
47
43
|
|
48
|
-
|
44
|
+
```erb
|
45
|
+
<%= fields do |f| %>
|
46
|
+
<%= f.field_name :body %>
|
47
|
+
<% end %>
|
48
|
+
```
|
49
49
|
|
50
|
-
*
|
50
|
+
*Sean Doyle*
|
51
51
|
|
52
|
-
|
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
|
-
|
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
|
-
|
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
|
62
|
+
## Rails 7.0.3.1 (July 12, 2022) ##
|
61
63
|
|
62
64
|
* No changes.
|
63
65
|
|
64
66
|
|
65
|
-
## Rails
|
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
|
-
|
71
|
-
|
72
|
-
* No changes.
|
71
|
+
*Sean Doyle*
|
73
72
|
|
73
|
+
## Rails 7.0.2.4 (April 26, 2022) ##
|
74
74
|
|
75
|
-
|
75
|
+
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
76
76
|
|
77
|
-
|
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
|
84
|
+
## Rails 7.0.2.3 (March 08, 2022) ##
|
81
85
|
|
82
86
|
* No changes.
|
83
87
|
|
84
88
|
|
85
|
-
## Rails
|
89
|
+
## Rails 7.0.2.2 (February 11, 2022) ##
|
86
90
|
|
87
91
|
* No changes.
|
88
92
|
|
89
93
|
|
90
|
-
## Rails
|
94
|
+
## Rails 7.0.2.1 (February 11, 2022) ##
|
91
95
|
|
92
96
|
* No changes.
|
93
97
|
|
94
98
|
|
95
|
-
## Rails
|
99
|
+
## Rails 7.0.2 (February 08, 2022) ##
|
96
100
|
|
97
|
-
*
|
98
|
-
translation keys through `I18n.translate` for interpolation.
|
101
|
+
* Ensure `preload_link_tag` preloads JavaScript modules correctly.
|
99
102
|
|
100
|
-
*
|
103
|
+
*Máximo Mussini*
|
101
104
|
|
102
|
-
*
|
105
|
+
* Fix `stylesheet_link_tag` and similar helpers are being used to work in objects with
|
106
|
+
a `response` method.
|
103
107
|
|
104
|
-
*
|
108
|
+
*dark-panda*
|
105
109
|
|
106
|
-
* Allow both `current_page?(url_hash)` and `current_page?(**url_hash)` on Ruby 2.7.
|
107
110
|
|
108
|
-
|
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
|
-
|
115
|
+
*MingyuanQin*
|
112
116
|
|
113
|
-
*
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
139
|
+
* Fix `number_with_precision(raise: true)` always raising even on valid numbers.
|
127
140
|
|
128
|
-
*
|
141
|
+
*Pedro Moreira*
|
129
142
|
|
130
143
|
|
131
|
-
## Rails
|
144
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
132
145
|
|
133
146
|
* No changes.
|
134
147
|
|
135
148
|
|
136
|
-
## Rails
|
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
|
-
*
|
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
|
-
|
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
|
-
|
158
|
+
*Sean Doyle*
|
163
159
|
|
164
|
-
*
|
165
|
-
|
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
|
-
|
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
|
-
*
|
177
|
+
*Sean Doyle*
|
170
178
|
|
171
|
-
*
|
179
|
+
* Support passing a Symbol as the first argument to `FormBuilder#button`:
|
172
180
|
|
173
|
-
|
174
|
-
|
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
|
-
|
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
|
-
|
195
|
+
* Introduce the `field_name` view helper, along with the
|
196
|
+
`FormBuilder#field_name` counterpart:
|
181
197
|
|
182
|
-
|
183
|
-
|
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
|
-
*
|
188
|
-
|
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
|
-
*
|
193
|
-
and make the original available as an alias.
|
216
|
+
* Add support for `button_to ..., authenticity_token: false`
|
194
217
|
|
195
|
-
|
196
|
-
|
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
|
-
|
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
|
-
|
201
|
-
|
202
|
-
|
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
|
-
*
|
231
|
+
* Support rendering `<form>` elements _without_ `[action]` attributes by:
|
218
232
|
|
219
|
-
*
|
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
|
-
*
|
222
|
-
|
223
|
-
*Rafael Mendonça França*
|
238
|
+
*Sean Doyle*
|
224
239
|
|
225
|
-
*
|
240
|
+
* Add `:day_format` option to `date_select`
|
226
241
|
|
227
|
-
|
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
|
-
*
|
245
|
+
*Shunichi Ikegami*
|
230
246
|
|
231
|
-
|
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
|
-
|
250
|
+
link_to @profile
|
251
|
+
#=> <a href="/profiles/1">Eileen</a>
|
234
252
|
|
235
|
-
|
253
|
+
This assumes the model class implements a `to_s` method like this:
|
236
254
|
|
237
|
-
|
255
|
+
class Profile < ApplicationRecord
|
256
|
+
# ...
|
257
|
+
def to_s
|
258
|
+
name
|
259
|
+
end
|
260
|
+
end
|
238
261
|
|
239
|
-
|
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
|
-
|
265
|
+
link_to @profile, @profile.name
|
266
|
+
#=> <a href="/profiles/1">Eileen</a>
|
242
267
|
|
243
|
-
*
|
268
|
+
*Olivier Lacan*
|
244
269
|
|
245
|
-
*
|
270
|
+
* Support svg unpaired tags for `tag` helper.
|
246
271
|
|
247
|
-
|
272
|
+
tag.svg { tag.use('href' => "#cool-icon") }
|
273
|
+
# => <svg><use href="#cool-icon"></svg>
|
248
274
|
|
249
|
-
*
|
275
|
+
*Oleksii Vasyliev*
|
250
276
|
|
251
|
-
*Rafael Mendonça França*
|
252
277
|
|
253
|
-
|
254
|
-
in `ActionView::Base#initialize`.
|
278
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
255
279
|
|
256
|
-
|
280
|
+
* No changes.
|
257
281
|
|
258
|
-
* Remove deprecated `format` argument `ActionView::Base#initialize`.
|
259
282
|
|
260
|
-
|
283
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
261
284
|
|
262
|
-
*
|
285
|
+
* Improves the performance of ActionView::Helpers::NumberHelper formatters by avoiding the use of
|
286
|
+
exceptions as flow control.
|
263
287
|
|
264
|
-
*
|
288
|
+
*Mike Dalessio*
|
265
289
|
|
266
|
-
*
|
290
|
+
* `preload_link_tag` properly inserts `as` attributes for files with `image` MIME types, such as JPG or SVG.
|
267
291
|
|
268
|
-
*
|
292
|
+
*Nate Berkopec*
|
269
293
|
|
270
|
-
*
|
294
|
+
* Add `weekday_options_for_select` and `weekday_select` helper methods. Also adds `weekday_select` to `FormBuilder`.
|
271
295
|
|
272
|
-
*
|
296
|
+
*Drew Bragg*, *Dana Kashubeck*, *Kasper Timm Hansen*
|
273
297
|
|
274
|
-
*
|
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
|
-
*
|
300
|
+
*Ben Toews*, *John Hawthorn*, *Kasper Timm Hansen*, *Joel Hawksley*
|
277
301
|
|
278
|
-
*
|
302
|
+
* Add `include_seconds` option for `time_field`.
|
279
303
|
|
280
|
-
|
304
|
+
<%= form.time_field :foo, include_seconds: false %>
|
305
|
+
# => <input value="16:22" type="time" />
|
281
306
|
|
282
|
-
|
307
|
+
Default includes seconds:
|
283
308
|
|
284
|
-
|
309
|
+
<%= form.time_field :foo %>
|
310
|
+
# => <input value="16:22:01.440" type="time" />
|
285
311
|
|
286
|
-
|
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
|
-
*
|
314
|
+
*Alex Ghiculescu*
|
289
315
|
|
290
|
-
*
|
316
|
+
* Improve error messages when template file does not exist at absolute filepath.
|
291
317
|
|
292
|
-
*
|
318
|
+
*Ted Whang*
|
293
319
|
|
294
|
-
*
|
320
|
+
* Add `:country_code` option to `sms_to` for consistency with `phone_to`.
|
295
321
|
|
296
|
-
*
|
322
|
+
*Jonathan Hefner*
|
297
323
|
|
298
|
-
*
|
324
|
+
* OpenSSL constants are now used for Digest computations.
|
299
325
|
|
300
|
-
*
|
326
|
+
*Dirkjan Bussink*
|
301
327
|
|
302
|
-
*
|
328
|
+
* The `translate` helper now passes `default` values that aren't
|
329
|
+
translation keys through `I18n.translate` for interpolation.
|
303
330
|
|
304
|
-
*
|
331
|
+
*Jonathan Hefner*
|
305
332
|
|
306
|
-
*
|
333
|
+
* Adds option `extname` to `stylesheet_link_tag` to skip default
|
334
|
+
`.css` extension appended to the stylesheet path.
|
307
335
|
|
308
|
-
|
336
|
+
Before:
|
309
337
|
|
310
|
-
|
338
|
+
```ruby
|
339
|
+
stylesheet_link_tag "style.less"
|
340
|
+
# <link href="/stylesheets/style.less.scss" rel="stylesheet">
|
341
|
+
```
|
311
342
|
|
312
|
-
|
343
|
+
After:
|
313
344
|
|
314
|
-
|
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
|
-
*
|
350
|
+
*Abhay Nikam*
|
317
351
|
|
318
|
-
*
|
352
|
+
* Deprecate `render` locals to be assigned to instance variables.
|
319
353
|
|
320
|
-
*
|
354
|
+
*Petrik de Heus*
|
321
355
|
|
322
|
-
* Remove
|
356
|
+
* Remove legacy default `media=screen` from `stylesheet_link_tag`.
|
323
357
|
|
324
|
-
*
|
358
|
+
*André Luis Leal Cardoso Junior*
|
325
359
|
|
326
|
-
* `ActionView::Helpers::
|
327
|
-
|
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
|
-
<%=
|
330
|
-
|
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
|
-
*
|
336
|
-
|
337
|
-
|
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
|
-
|
345
|
-
|
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
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
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
|
-
*
|
388
|
+
*Sean Doyle*, *Dusan Orlovic*
|
380
389
|
|
381
|
-
|
382
|
-
|
383
|
-
|
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
|
-
*
|
394
|
+
*Andrew White*
|
405
395
|
|
406
|
-
*
|
407
|
-
|
396
|
+
* The `translate` helper now resolves `default` values when a `nil` key is
|
397
|
+
specified, instead of always returning `nil`.
|
408
398
|
|
409
|
-
|
399
|
+
*Jonathan Hefner*
|
410
400
|
|
411
|
-
|
401
|
+
* Add `config.action_view.image_loading` to configure the default value of
|
402
|
+
the `image_tag` `:loading` option.
|
412
403
|
|
413
|
-
|
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
|
-
*
|
407
|
+
*Jonathan Hefner*
|
416
408
|
|
417
|
-
*
|
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
|
-
|
413
|
+
<%= form_for @post do |f| %>
|
414
|
+
<%# ... %>
|
420
415
|
|
421
|
-
|
422
|
-
|
416
|
+
<% content_for :sticky_footer do %>
|
417
|
+
<%= form.button(form: f.id) %>
|
418
|
+
<% end %>
|
419
|
+
<% end %>
|
423
420
|
|
424
|
-
*
|
421
|
+
*Sean Doyle*
|
425
422
|
|
426
|
-
*
|
423
|
+
* `ActionView::Helpers::FormBuilder#field_id` returns the value generated by
|
424
|
+
the FormBuilder for the given attribute name.
|
427
425
|
|
428
|
-
|
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
|
-
*
|
432
|
+
*Sean Doyle*
|
431
433
|
|
432
|
-
|
434
|
+
* Add `tag.attributes` to transform a Hash into HTML Attributes, ready to be
|
435
|
+
interpolated into ERB.
|
433
436
|
|
434
|
-
|
437
|
+
<input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
|
438
|
+
# => <input type="text" aria-label="Search">
|
435
439
|
|
436
|
-
*
|
440
|
+
*Sean Doyle*
|
437
441
|
|
438
442
|
|
439
|
-
Please check [6-
|
443
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionview/CHANGELOG.md) for previous changes.
|