actionview 7.1.1 → 7.2.3.1
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 +108 -311
- data/README.rdoc +1 -1
- data/app/assets/javascripts/rails-ujs.esm.js +0 -7
- data/lib/action_view/base.rb +25 -11
- data/lib/action_view/cache_expiry.rb +9 -3
- data/lib/action_view/dependency_tracker/{ripper_tracker.rb → ruby_tracker.rb} +4 -3
- data/lib/action_view/dependency_tracker.rb +1 -1
- data/lib/action_view/digestor.rb +6 -2
- data/lib/action_view/gem_version.rb +3 -3
- data/lib/action_view/helpers/asset_tag_helper.rb +26 -14
- data/lib/action_view/helpers/atom_feed_helper.rb +1 -1
- data/lib/action_view/helpers/cache_helper.rb +6 -6
- data/lib/action_view/helpers/capture_helper.rb +7 -1
- data/lib/action_view/helpers/csrf_helper.rb +1 -1
- data/lib/action_view/helpers/date_helper.rb +8 -1
- data/lib/action_view/helpers/form_helper.rb +230 -221
- data/lib/action_view/helpers/form_options_helper.rb +6 -3
- data/lib/action_view/helpers/form_tag_helper.rb +86 -53
- data/lib/action_view/helpers/number_helper.rb +35 -329
- data/lib/action_view/helpers/output_safety_helper.rb +5 -6
- data/lib/action_view/helpers/sanitize_helper.rb +25 -14
- data/lib/action_view/helpers/tag_helper.rb +213 -20
- data/lib/action_view/helpers/tags/collection_helpers.rb +2 -1
- data/lib/action_view/helpers/text_helper.rb +135 -72
- data/lib/action_view/helpers/url_helper.rb +8 -80
- data/lib/action_view/layouts.rb +10 -12
- data/lib/action_view/log_subscriber.rb +8 -4
- data/lib/action_view/railtie.rb +0 -1
- data/lib/action_view/render_parser/prism_render_parser.rb +127 -0
- data/lib/action_view/{ripper_ast_parser.rb → render_parser/ripper_render_parser.rb} +152 -9
- data/lib/action_view/render_parser.rb +21 -169
- data/lib/action_view/renderer/abstract_renderer.rb +1 -1
- data/lib/action_view/renderer/collection_renderer.rb +1 -1
- data/lib/action_view/renderer/partial_renderer.rb +2 -2
- data/lib/action_view/renderer/renderer.rb +32 -38
- data/lib/action_view/renderer/template_renderer.rb +3 -3
- data/lib/action_view/rendering.rb +4 -4
- data/lib/action_view/template/error.rb +11 -0
- data/lib/action_view/template/handlers/erb.rb +45 -37
- data/lib/action_view/template/renderable.rb +7 -1
- data/lib/action_view/template/resolver.rb +0 -2
- data/lib/action_view/template.rb +68 -19
- data/lib/action_view/test_case.rb +33 -34
- data/lib/action_view/unbound_template.rb +4 -4
- data/lib/action_view.rb +2 -1
- metadata +30 -19
- data/lib/assets/compiled/rails-ujs.js +0 -777
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 61f8e3426843a85e006134bb5d330f91e09457e3392025afab472d470d706929
|
|
4
|
+
data.tar.gz: c066f5cc2718465d6f24a8c81ee5361c3c9fcbef2288a8d04b77334e9c724ad9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a9f2a3f39681a4687a4b8a42b10e00be43c0ee413037c9f236b3bbc04961c8d9993ee955bb0b940a5f05c0024c8f17abb3106d4420f0dea593dd020f038df55
|
|
7
|
+
data.tar.gz: b259ce7c6e668708a25ca4e61551bbe65aee7c898cf6c2da3ba0d2c40f64e6ccc5adc2067f817e95ac1f913edbb34b9e75ec4de89e058899c7644ecf4fbf5fb5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,412 +1,209 @@
|
|
|
1
|
-
## Rails 7.
|
|
1
|
+
## Rails 7.2.3.1 (March 23, 2026) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
This fix was already landed in >= 7.0.4.3, < 7.1.0.
|
|
6
|
-
[[CVE-2023-23913](https://github.com/advisories/GHSA-xp5h-f8jf-rc8q)]
|
|
7
|
-
|
|
8
|
-
*Ryunosuke Sato*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Rails 7.1.0 (October 05, 2023) ##
|
|
12
|
-
|
|
13
|
-
* No changes.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## Rails 7.1.0.rc2 (October 01, 2023) ##
|
|
17
|
-
|
|
18
|
-
* No changes.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
|
22
|
-
|
|
23
|
-
* Introduce `ActionView::TestCase.register_parser`
|
|
24
|
-
|
|
25
|
-
```ruby
|
|
26
|
-
register_parser :rss, -> rendered { RSS::Parser.parse(rendered) }
|
|
27
|
-
|
|
28
|
-
test "renders RSS" do
|
|
29
|
-
article = Article.create!(title: "Hello, world")
|
|
30
|
-
|
|
31
|
-
render formats: :rss, partial: article
|
|
32
|
-
|
|
33
|
-
assert_equal "Hello, world", rendered.rss.items.last.title
|
|
34
|
-
end
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
By default, register parsers for `:html` and `:json`.
|
|
38
|
-
|
|
39
|
-
*Sean Doyle*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
|
3
|
+
* Skip blank attribute names in tag helpers to avoid generating invalid HTML.
|
|
43
4
|
|
|
44
|
-
|
|
5
|
+
[CVE-2026-33168]
|
|
45
6
|
|
|
46
|
-
|
|
47
|
-
the `wrapper_tag: nil` in the options, it returns the text wrapped with `<></>` tag.
|
|
48
|
-
|
|
49
|
-
Before:
|
|
50
|
-
|
|
51
|
-
```ruby
|
|
52
|
-
simple_format("Hello World", {}, { wrapper_tag: nil })
|
|
53
|
-
# <>Hello World</>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
After:
|
|
57
|
-
|
|
58
|
-
```ruby
|
|
59
|
-
simple_format("Hello World", {}, { wrapper_tag: nil })
|
|
60
|
-
# <p>Hello World</p>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
*Akhil G Krishnan*, *Junichi Ito*
|
|
7
|
+
*Mike Dalessio*
|
|
64
8
|
|
|
65
|
-
* Don't double-encode nested `field_id` and `field_name` index values
|
|
66
9
|
|
|
67
|
-
|
|
68
|
-
`field_name` view helper methods.
|
|
10
|
+
## Rails 7.2.3 (October 28, 2025) ##
|
|
69
11
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
* Allow opting in/out of `Link preload` headers when calling `stylesheet_link_tag` or `javascript_include_tag`
|
|
12
|
+
* Fix `javascript_include_tag` `type` option to accept either strings and symbols.
|
|
73
13
|
|
|
74
14
|
```ruby
|
|
75
|
-
|
|
76
|
-
javascript_include_tag
|
|
77
|
-
|
|
78
|
-
# will include header, even if setting is disabled:
|
|
79
|
-
stylesheet_link_tag("http://example.com/all.js", preload_links_header: true)
|
|
15
|
+
javascript_include_tag "application", type: :module
|
|
16
|
+
javascript_include_tag "application", type: "module"
|
|
80
17
|
```
|
|
81
18
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* Stop generating `Link preload` headers once it has reached 1KB.
|
|
85
|
-
|
|
86
|
-
Some proxies have trouble handling large headers, but more importantly preload links
|
|
87
|
-
have diminishing returns so it's preferable not to go overboard with them.
|
|
88
|
-
|
|
89
|
-
If tighter control is needed, it's recommended to disable automatic generation of preloads
|
|
90
|
-
and to generate them manually from the controller or from a middleware.
|
|
19
|
+
Previously, only the string value was recoginized.
|
|
91
20
|
|
|
92
21
|
*Jean Boussier*
|
|
93
22
|
|
|
94
|
-
* `
|
|
23
|
+
* Fix `excerpt` helper with non-whitespace separator.
|
|
95
24
|
|
|
96
|
-
|
|
97
|
-
```ruby
|
|
98
|
-
simple_format("<a target=\"_blank\" href=\"http://example.com\">Continue</a>")
|
|
99
|
-
# => "<p><a href=\"http://example.com\">Continue</a></p>"
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
After:
|
|
103
|
-
```ruby
|
|
104
|
-
simple_format("<a target=\"_blank\" href=\"http://example.com\">Continue</a>", {}, { sanitize_options: { attributes: %w[target href] } })
|
|
105
|
-
# => "<p><a target=\"_blank\" href=\"http://example.com\">Continue</a></p>"
|
|
106
|
-
```
|
|
25
|
+
*Jonathan Hefner*
|
|
107
26
|
|
|
108
|
-
|
|
27
|
+
* Respect `html_options[:form]` when `collection_checkboxes` generates the
|
|
28
|
+
hidden `<input>`.
|
|
109
29
|
|
|
110
|
-
*
|
|
111
|
-
in the Rails 7.1 configuration if it is supported.
|
|
30
|
+
*Riccardo Odone*
|
|
112
31
|
|
|
113
|
-
|
|
114
|
-
`config.action_view.sanitizer_vendor`. Supported values are `Rails::HTML4::Sanitizer` or
|
|
115
|
-
`Rails::HTML5::Sanitizer`.
|
|
32
|
+
* Layouts have access to local variables passed to `render`.
|
|
116
33
|
|
|
117
|
-
|
|
118
|
-
fall back to `Rails::HTML4::Sanitizer`. Previous configurations default to
|
|
119
|
-
`Rails::HTML4::Sanitizer`.
|
|
34
|
+
This fixes #31680 which was a regression in Rails 5.1.
|
|
120
35
|
|
|
121
36
|
*Mike Dalessio*
|
|
122
37
|
|
|
123
|
-
*
|
|
124
|
-
`ActionView::
|
|
125
|
-
Rails::Dom::Testing.
|
|
38
|
+
* Argument errors related to strict locals in templates now raise an
|
|
39
|
+
`ActionView::StrictLocalsError`, and all other argument errors are reraised as-is.
|
|
126
40
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
41
|
+
Previously, any `ArgumentError` raised during template rendering was swallowed during strict
|
|
42
|
+
local error handling, so that an `ArgumentError` unrelated to strict locals (e.g., a helper
|
|
43
|
+
method invoked with incorrect arguments) would be replaced by a similar `ArgumentError` with an
|
|
44
|
+
unrelated backtrace, making it difficult to debug templates.
|
|
130
45
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
* Add support for the HTML picture tag. It supports passing a String, an Array or a Block.
|
|
134
|
-
Supports passing properties directly to the img tag via the `:image` key.
|
|
135
|
-
Since the picture tag requires an img tag, the last element you provide will be used for the img tag.
|
|
136
|
-
For complete control over the picture tag, a block can be passed, which will populate the contents of the tag accordingly.
|
|
137
|
-
|
|
138
|
-
Can be used like this for a single source:
|
|
139
|
-
```erb
|
|
140
|
-
<%= picture_tag("picture.webp") %>
|
|
141
|
-
```
|
|
142
|
-
which will generate the following:
|
|
143
|
-
```html
|
|
144
|
-
<picture>
|
|
145
|
-
<img src="/images/picture.webp" />
|
|
146
|
-
</picture>
|
|
147
|
-
```
|
|
46
|
+
Now, any `ArgumentError` unrelated to strict locals is reraised, preserving the original
|
|
47
|
+
backtrace for developers.
|
|
148
48
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
<%= picture_tag("picture.webp", "picture.png", :class => "mt-2", :image => { alt: "Image", class: "responsive-img" }) %>
|
|
152
|
-
```
|
|
153
|
-
will generate:
|
|
154
|
-
```html
|
|
155
|
-
<picture class="mt-2">
|
|
156
|
-
<source srcset="/images/picture.webp" />
|
|
157
|
-
<source srcset="/images/picture.png" />
|
|
158
|
-
<img alt="Image" class="responsive-img" src="/images/picture.png" />
|
|
159
|
-
</picture>
|
|
160
|
-
```
|
|
49
|
+
Also note that `ActionView::StrictLocalsError` is a subclass of `ArgumentError`, so any existing
|
|
50
|
+
code that rescues `ArgumentError` will continue to work.
|
|
161
51
|
|
|
162
|
-
|
|
163
|
-
```erb
|
|
164
|
-
<%= picture_tag(:class => "my-class") do %>
|
|
165
|
-
<%= tag(:source, :srcset => image_path("picture.webp")) %>
|
|
166
|
-
<%= tag(:source, :srcset => image_path("picture.png")) %>
|
|
167
|
-
<%= image_tag("picture.png", :alt => "Image") %>
|
|
168
|
-
<% end %>
|
|
169
|
-
```
|
|
170
|
-
will generate:
|
|
171
|
-
```html
|
|
172
|
-
<picture class="my-class">
|
|
173
|
-
<source srcset="/images/picture.webp" />
|
|
174
|
-
<source srcset="/images/picture.png" />
|
|
175
|
-
<img alt="Image" src="/images/picture.png" />
|
|
176
|
-
</picture>
|
|
177
|
-
```
|
|
52
|
+
Fixes #52227.
|
|
178
53
|
|
|
179
|
-
*
|
|
54
|
+
*Mike Dalessio*
|
|
180
55
|
|
|
181
|
-
*
|
|
56
|
+
* Fix stack overflow error in dependency tracker when dealing with circular dependencies
|
|
182
57
|
|
|
183
|
-
*
|
|
58
|
+
*Jean Boussier*
|
|
184
59
|
|
|
185
|
-
*
|
|
60
|
+
* Fix a crash in ERB template error highlighting when the error occurs on a
|
|
61
|
+
line in the compiled template that is past the end of the source template.
|
|
186
62
|
|
|
187
|
-
*
|
|
63
|
+
*Martin Emde*
|
|
188
64
|
|
|
189
|
-
*
|
|
65
|
+
* Improve reliability of ERB template error highlighting.
|
|
66
|
+
Fix infinite loops and crashes in highlighting and
|
|
67
|
+
improve tolerance for alternate ERB handlers.
|
|
190
68
|
|
|
191
|
-
*
|
|
69
|
+
*Martin Emde*
|
|
192
70
|
|
|
193
|
-
* `select` can now be called with a single hash containing options and some HTML options
|
|
194
71
|
|
|
195
|
-
|
|
72
|
+
## Rails 7.2.2.2 (August 13, 2025) ##
|
|
196
73
|
|
|
197
|
-
|
|
198
|
-
<%= select :post, :author, authors, required: true %>
|
|
199
|
-
```
|
|
74
|
+
* No changes.
|
|
200
75
|
|
|
201
|
-
Instead you needed to do this:
|
|
202
76
|
|
|
203
|
-
|
|
204
|
-
<%= select :post, :author, authors, {}, required: true %>
|
|
205
|
-
```
|
|
77
|
+
## Rails 7.2.2.1 (December 10, 2024) ##
|
|
206
78
|
|
|
207
|
-
|
|
79
|
+
* No changes.
|
|
208
80
|
|
|
209
|
-
*Alex Ghiculescu*
|
|
210
81
|
|
|
211
|
-
|
|
82
|
+
## Rails 7.2.2 (October 30, 2024) ##
|
|
212
83
|
|
|
213
|
-
|
|
214
|
-
```erb
|
|
215
|
-
<%= form.datetime_field :written_at, value: Time.current.strftime("%Y-%m-%dT%T") %>
|
|
216
|
-
```
|
|
84
|
+
* No changes.
|
|
217
85
|
|
|
218
|
-
After:
|
|
219
|
-
```erb
|
|
220
|
-
<%= form.datetime_field :written_at, value: Time.current %>
|
|
221
|
-
```
|
|
222
86
|
|
|
223
|
-
|
|
87
|
+
## Rails 7.2.1.2 (October 23, 2024) ##
|
|
224
88
|
|
|
225
|
-
*
|
|
226
|
-
of the child arrays when using grouped/nested collections
|
|
89
|
+
* No changes.
|
|
227
90
|
|
|
228
|
-
```erb
|
|
229
|
-
<%= form.select :foo, [["North America", [["United States","US"],["Canada","CA"]], { disabled: "disabled" }]] %>
|
|
230
|
-
# => <select><optgroup label="North America" disabled="disabled"><option value="US">United States</option><option value="CA">Canada</option></optgroup></select>
|
|
231
|
-
```
|
|
232
91
|
|
|
233
|
-
|
|
92
|
+
## Rails 7.2.1.1 (October 15, 2024) ##
|
|
234
93
|
|
|
235
|
-
*
|
|
94
|
+
* No changes.
|
|
236
95
|
|
|
237
|
-
This is to make the API more consistent with the `FormHelper` variants. You can now
|
|
238
|
-
provide `checked` as a positional or keyword argument:
|
|
239
96
|
|
|
240
|
-
|
|
241
|
-
= check_box_tag "admin", "1", false
|
|
242
|
-
= check_box_tag "admin", "1", checked: false
|
|
97
|
+
## Rails 7.2.1 (August 22, 2024) ##
|
|
243
98
|
|
|
244
|
-
|
|
245
|
-
= radio_button_tag 'favorite_color', 'maroon', checked: false
|
|
246
|
-
```
|
|
99
|
+
* No changes.
|
|
247
100
|
|
|
248
|
-
*Alex Ghiculescu*
|
|
249
101
|
|
|
250
|
-
|
|
251
|
-
You no longer need to call `new` when passing a class to `dom_id`.
|
|
252
|
-
This makes `dom_id` behave like `dom_class` in this regard.
|
|
253
|
-
Apart from saving a few keystrokes, it prevents Ruby from needing
|
|
254
|
-
to instantiate a whole new object just to generate a string.
|
|
102
|
+
## Rails 7.2.0 (August 09, 2024) ##
|
|
255
103
|
|
|
256
|
-
|
|
257
|
-
```ruby
|
|
258
|
-
dom_id(Post) # => NoMethodError: undefined method `to_key' for Post:Class
|
|
259
|
-
```
|
|
104
|
+
* Fix templates with strict locals to also include `local_assigns`.
|
|
260
105
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
dom_id(Post) # => "new_post"
|
|
264
|
-
```
|
|
106
|
+
Previously templates defining strict locals wouldn't receive the `local_assigns`
|
|
107
|
+
hash.
|
|
265
108
|
|
|
266
|
-
*
|
|
109
|
+
*Jean Boussier*
|
|
267
110
|
|
|
268
|
-
*
|
|
111
|
+
* Add queries count to template rendering instrumentation.
|
|
269
112
|
|
|
270
|
-
Before:
|
|
271
|
-
```ruby
|
|
272
|
-
{
|
|
273
|
-
identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb",
|
|
274
|
-
layout: "layouts/application"
|
|
275
|
-
}
|
|
276
113
|
```
|
|
114
|
+
# Before
|
|
115
|
+
Completed 200 OK in 3804ms (Views: 41.0ms | ActiveRecord: 33.5ms | Allocations: 112788)
|
|
277
116
|
|
|
278
|
-
After
|
|
279
|
-
|
|
280
|
-
{
|
|
281
|
-
identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb",
|
|
282
|
-
layout: "layouts/application",
|
|
283
|
-
locals: {foo: "bar"}
|
|
284
|
-
}
|
|
117
|
+
# After
|
|
118
|
+
Completed 200 OK in 3804ms (Views: 41.0ms | ActiveRecord: 33.5ms (2 queries, 1 cached) | Allocations: 112788)
|
|
285
119
|
```
|
|
286
120
|
|
|
287
|
-
*
|
|
121
|
+
*fatkodima*
|
|
288
122
|
|
|
289
|
-
*
|
|
123
|
+
* Raise `ArgumentError` if `:renderable` object does not respond to `#render_in`.
|
|
290
124
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
For example, compare the outputs of this template:
|
|
294
|
-
|
|
295
|
-
```erb
|
|
296
|
-
# <%= word_wrap("11 22\n33 44", line_width: 2, break_sequence: "\n# ") %>
|
|
297
|
-
```
|
|
125
|
+
*Sean Doyle*
|
|
298
126
|
|
|
299
|
-
|
|
127
|
+
* Add the `nonce: true` option for `stylesheet_link_tag` helper to support automatic nonce generation for Content Security Policy.
|
|
300
128
|
|
|
301
|
-
|
|
302
|
-
# 11
|
|
303
|
-
# 22
|
|
304
|
-
#
|
|
305
|
-
# 33
|
|
306
|
-
# 44
|
|
307
|
-
#
|
|
308
|
-
```
|
|
129
|
+
Works the same way as `javascript_include_tag nonce: true` does.
|
|
309
130
|
|
|
310
|
-
|
|
131
|
+
*Akhil G Krishnan*, *AJ Esler*
|
|
311
132
|
|
|
312
|
-
|
|
313
|
-
# 11
|
|
314
|
-
# 22
|
|
315
|
-
# 33
|
|
316
|
-
# 44
|
|
317
|
-
```
|
|
133
|
+
* Parse `ActionView::TestCase#rendered` HTML content as `Nokogiri::XML::DocumentFragment` instead of `Nokogiri::XML::Document`.
|
|
318
134
|
|
|
319
|
-
*
|
|
135
|
+
*Sean Doyle*
|
|
320
136
|
|
|
321
|
-
*
|
|
137
|
+
* Rename `ActionView::TestCase::Behavior::Content` to `ActionView::TestCase::Behavior::RenderedViewContent`.
|
|
322
138
|
|
|
323
|
-
|
|
139
|
+
Make `RenderedViewContent` inherit from `String`. Make private API with `:nodoc:`
|
|
324
140
|
|
|
325
|
-
|
|
326
|
-
<%# locals: (message:) -%>
|
|
327
|
-
<%= message %>
|
|
328
|
-
```
|
|
141
|
+
*Sean Doyle*
|
|
329
142
|
|
|
330
|
-
|
|
143
|
+
* Deprecate passing `nil` as value for the `model:` argument to the `form_with` method.
|
|
331
144
|
|
|
332
|
-
|
|
333
|
-
<%# locals: (message: "Hello, world!") -%>
|
|
334
|
-
<%= message %>
|
|
335
|
-
```
|
|
145
|
+
*Collin Jilbert*
|
|
336
146
|
|
|
337
|
-
|
|
147
|
+
* Alias `field_set_tag` helper to `fieldset_tag` to match `<fieldset>` element.
|
|
338
148
|
|
|
339
|
-
|
|
340
|
-
<%# locals: () %>
|
|
341
|
-
```
|
|
149
|
+
*Sean Doyle*
|
|
342
150
|
|
|
343
|
-
|
|
151
|
+
* Deprecate passing content to void elements when using `tag.br` type tag builders.
|
|
344
152
|
|
|
345
|
-
*
|
|
153
|
+
*Hartley McGuire*
|
|
346
154
|
|
|
347
|
-
|
|
155
|
+
* Fix the `number_to_human_size` view helper to correctly work with negative numbers.
|
|
348
156
|
|
|
349
|
-
*
|
|
157
|
+
*Earlopain*
|
|
350
158
|
|
|
351
|
-
*
|
|
352
|
-
`object_name` arguments. For example:
|
|
159
|
+
* Automatically discard the implicit locals injected by collection rendering for template that can't accept them.
|
|
353
160
|
|
|
354
|
-
|
|
355
|
-
<%= fields do |f| %>
|
|
356
|
-
<%= f.field_name :body %>
|
|
357
|
-
<% end %>
|
|
358
|
-
```
|
|
161
|
+
When rendering a collection, two implicit variables are injected, which breaks templates with strict locals.
|
|
359
162
|
|
|
360
|
-
|
|
163
|
+
Now they are only passed if the template will actually accept them.
|
|
361
164
|
|
|
362
|
-
*
|
|
165
|
+
*Yasha Krasnou*, *Jean Boussier*
|
|
363
166
|
|
|
364
|
-
|
|
365
|
-
to be included as-is as PCDATA in HTML content. Tagging them as html-safe avoids double-escaping
|
|
366
|
-
entities when being concatenated to a SafeBuffer during rendering.
|
|
167
|
+
* Fix `@rails/ujs` calling `start()` an extra time when using bundlers.
|
|
367
168
|
|
|
368
|
-
|
|
169
|
+
*Hartley McGuire*, *Ryunosuke Sato*
|
|
369
170
|
|
|
370
|
-
|
|
171
|
+
* Fix the `capture` view helper compatibility with HAML and Slim.
|
|
371
172
|
|
|
372
|
-
|
|
173
|
+
When a blank string was captured in HAML or Slim (and possibly other template engines)
|
|
174
|
+
it would instead return the entire buffer.
|
|
373
175
|
|
|
374
|
-
|
|
375
|
-
`convert_to_model` call from `form_for`.
|
|
376
|
-
|
|
377
|
-
*Sean Doyle*
|
|
378
|
-
|
|
379
|
-
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
|
176
|
+
*Jean Boussier*
|
|
380
177
|
|
|
381
|
-
|
|
382
|
-
tag helpers, following the XML specification. Rename the option
|
|
383
|
-
`:escape_attributes` to `:escape`, to simplify by applying the option to the
|
|
384
|
-
whole tag.
|
|
178
|
+
* Updated `@rails/ujs` files to ignore certain data-* attributes when element is contenteditable.
|
|
385
179
|
|
|
386
|
-
|
|
180
|
+
This fix was already landed in >= 7.0.4.3, < 7.1.0.
|
|
181
|
+
[[CVE-2023-23913](https://github.com/advisories/GHSA-xp5h-f8jf-rc8q)]
|
|
387
182
|
|
|
388
|
-
*
|
|
183
|
+
*Ryunosuke Sato*
|
|
389
184
|
|
|
390
|
-
|
|
185
|
+
* Added validation for HTML tag names in the `tag` and `content_tag` helper method.
|
|
391
186
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
```
|
|
187
|
+
The `tag` and `content_tag` method now checks that the provided tag name adheres to the HTML
|
|
188
|
+
specification. If an invalid HTML tag name is provided, the method raises an `ArgumentError`
|
|
189
|
+
with an appropriate error message.
|
|
396
190
|
|
|
397
|
-
|
|
191
|
+
Examples:
|
|
398
192
|
|
|
399
193
|
```ruby
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
```
|
|
194
|
+
# Raises ArgumentError: Invalid HTML5 tag name: 12p
|
|
195
|
+
content_tag("12p") # Starting with a number
|
|
403
196
|
|
|
404
|
-
|
|
197
|
+
# Raises ArgumentError: Invalid HTML5 tag name: ""
|
|
198
|
+
content_tag("") # Empty tag name
|
|
405
199
|
|
|
406
|
-
|
|
200
|
+
# Raises ArgumentError: Invalid HTML5 tag name: div/
|
|
201
|
+
tag("div/") # Contains a solidus
|
|
407
202
|
|
|
408
|
-
|
|
203
|
+
# Raises ArgumentError: Invalid HTML5 tag name: "image file"
|
|
204
|
+
tag("image file") # Contains a space
|
|
205
|
+
```
|
|
409
206
|
|
|
410
|
-
*
|
|
207
|
+
*Akhil G Krishnan*
|
|
411
208
|
|
|
412
|
-
Please check [7-
|
|
209
|
+
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionview/CHANGELOG.md) for previous changes.
|
data/README.rdoc
CHANGED
|
@@ -35,6 +35,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
|
|
|
35
35
|
|
|
36
36
|
* https://github.com/rails/rails/issues
|
|
37
37
|
|
|
38
|
-
Feature requests should be discussed on the
|
|
38
|
+
Feature requests should be discussed on the rubyonrails-core forum here:
|
|
39
39
|
|
|
40
40
|
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
|
@@ -683,11 +683,4 @@ if (typeof jQuery !== "undefined" && jQuery && jQuery.ajax) {
|
|
|
683
683
|
}));
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
-
if (typeof exports !== "object" && typeof module === "undefined") {
|
|
687
|
-
window.Rails = Rails;
|
|
688
|
-
if (fire(document, "rails:attachBindings")) {
|
|
689
|
-
start();
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
|
|
693
686
|
export { Rails as default };
|
data/lib/action_view/base.rb
CHANGED
|
@@ -80,6 +80,23 @@ module ActionView # :nodoc:
|
|
|
80
80
|
# This is useful in cases where you aren't sure if the local variable has been assigned. Alternatively, you could also use
|
|
81
81
|
# <tt>defined? headline</tt> to first check if the variable has been assigned before using it.
|
|
82
82
|
#
|
|
83
|
+
# By default, templates will accept any <tt>locals</tt> as keyword arguments. To restrict what <tt>locals</tt> a template accepts, add a <tt>locals:</tt> magic comment:
|
|
84
|
+
#
|
|
85
|
+
# <%# locals: (headline:) %>
|
|
86
|
+
#
|
|
87
|
+
# Headline: <%= headline %>
|
|
88
|
+
#
|
|
89
|
+
# In cases where the local variables are optional, declare the keyword argument with a default value:
|
|
90
|
+
#
|
|
91
|
+
# <%# locals: (headline: nil) %>
|
|
92
|
+
#
|
|
93
|
+
# <% unless headline.nil? %>
|
|
94
|
+
# Headline: <%= headline %>
|
|
95
|
+
# <% end %>
|
|
96
|
+
#
|
|
97
|
+
# Read more about strict locals in {Action View Overview}[https://guides.rubyonrails.org/action_view_overview.html#strict-locals]
|
|
98
|
+
# in the guides.
|
|
99
|
+
#
|
|
83
100
|
# === Template caching
|
|
84
101
|
#
|
|
85
102
|
# By default, \Rails will compile each template to a method in order to render it. When you alter a template,
|
|
@@ -136,8 +153,7 @@ module ActionView # :nodoc:
|
|
|
136
153
|
# end
|
|
137
154
|
# end
|
|
138
155
|
#
|
|
139
|
-
# For more information on Builder please consult the {source
|
|
140
|
-
# code}[https://github.com/jimweirich/builder].
|
|
156
|
+
# For more information on Builder please consult the {source code}[https://github.com/rails/builder].
|
|
141
157
|
class Base
|
|
142
158
|
include Helpers, ::ERB::Util, Context
|
|
143
159
|
|
|
@@ -249,16 +265,14 @@ module ActionView # :nodoc:
|
|
|
249
265
|
|
|
250
266
|
if has_strict_locals
|
|
251
267
|
begin
|
|
252
|
-
public_send(method, buffer, **locals, &block)
|
|
268
|
+
public_send(method, locals, buffer, **locals, &block)
|
|
253
269
|
rescue ArgumentError => argument_error
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
gsub("no keywords accepted", "no locals accepted")
|
|
261
|
-
)
|
|
270
|
+
public_send_line = __LINE__ - 2
|
|
271
|
+
frame = argument_error.backtrace_locations[1]
|
|
272
|
+
if frame.path == __FILE__ && frame.lineno == public_send_line
|
|
273
|
+
raise StrictLocalsError.new(argument_error, @current_template)
|
|
274
|
+
end
|
|
275
|
+
raise
|
|
262
276
|
end
|
|
263
277
|
else
|
|
264
278
|
public_send(method, locals, buffer, &block)
|
|
@@ -10,16 +10,17 @@ module ActionView
|
|
|
10
10
|
@watcher = nil
|
|
11
11
|
@previous_change = false
|
|
12
12
|
|
|
13
|
-
rebuild_watcher
|
|
14
|
-
|
|
15
13
|
ActionView::PathRegistry.file_system_resolver_hooks << method(:rebuild_watcher)
|
|
16
14
|
end
|
|
17
15
|
|
|
18
16
|
def updated?
|
|
17
|
+
build_watcher unless @watcher
|
|
19
18
|
@previous_change || @watcher.updated?
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
def execute
|
|
22
|
+
return unless @watcher
|
|
23
|
+
|
|
23
24
|
watcher = nil
|
|
24
25
|
@mutex.synchronize do
|
|
25
26
|
@previous_change = false
|
|
@@ -33,7 +34,7 @@ module ActionView
|
|
|
33
34
|
ActionView::LookupContext::DetailsKey.clear
|
|
34
35
|
end
|
|
35
36
|
|
|
36
|
-
def
|
|
37
|
+
def build_watcher
|
|
37
38
|
@mutex.synchronize do
|
|
38
39
|
old_watcher = @watcher
|
|
39
40
|
|
|
@@ -51,6 +52,11 @@ module ActionView
|
|
|
51
52
|
end
|
|
52
53
|
end
|
|
53
54
|
|
|
55
|
+
def rebuild_watcher
|
|
56
|
+
return unless @watcher
|
|
57
|
+
build_watcher
|
|
58
|
+
end
|
|
59
|
+
|
|
54
60
|
def dirs_to_watch
|
|
55
61
|
all_view_paths.uniq.sort
|
|
56
62
|
end
|