actionview 7.0.1 → 7.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +281 -202
- data/MIT-LICENSE +1 -1
- data/README.rdoc +3 -3
- data/app/assets/javascripts/rails-ujs.esm.js +693 -0
- data/app/assets/javascripts/rails-ujs.js +630 -0
- data/lib/action_view/base.rb +33 -12
- data/lib/action_view/buffers.rb +106 -8
- data/lib/action_view/cache_expiry.rb +40 -43
- data/lib/action_view/context.rb +1 -1
- data/lib/action_view/deprecator.rb +7 -0
- data/lib/action_view/digestor.rb +1 -1
- data/lib/action_view/gem_version.rb +2 -2
- data/lib/action_view/helpers/active_model_helper.rb +1 -1
- data/lib/action_view/helpers/asset_tag_helper.rb +133 -48
- data/lib/action_view/helpers/asset_url_helper.rb +13 -12
- data/lib/action_view/helpers/atom_feed_helper.rb +5 -5
- data/lib/action_view/helpers/cache_helper.rb +3 -9
- data/lib/action_view/helpers/capture_helper.rb +26 -12
- data/lib/action_view/helpers/content_exfiltration_prevention_helper.rb +70 -0
- data/lib/action_view/helpers/controller_helper.rb +6 -0
- data/lib/action_view/helpers/csp_helper.rb +2 -2
- data/lib/action_view/helpers/csrf_helper.rb +3 -3
- data/lib/action_view/helpers/date_helper.rb +76 -64
- data/lib/action_view/helpers/debug_helper.rb +3 -3
- data/lib/action_view/helpers/form_helper.rb +62 -31
- data/lib/action_view/helpers/form_options_helper.rb +6 -3
- data/lib/action_view/helpers/form_tag_helper.rb +88 -44
- data/lib/action_view/helpers/javascript_helper.rb +1 -0
- data/lib/action_view/helpers/number_helper.rb +15 -13
- 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 +34 -15
- data/lib/action_view/helpers/tag_helper.rb +27 -16
- data/lib/action_view/helpers/tags/base.rb +11 -52
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +1 -0
- data/lib/action_view/helpers/tags/collection_radio_buttons.rb +1 -0
- data/lib/action_view/helpers/tags/collection_select.rb +3 -0
- data/lib/action_view/helpers/tags/date_field.rb +1 -1
- data/lib/action_view/helpers/tags/date_select.rb +2 -0
- data/lib/action_view/helpers/tags/datetime_field.rb +14 -6
- data/lib/action_view/helpers/tags/datetime_local_field.rb +11 -2
- data/lib/action_view/helpers/tags/grouped_collection_select.rb +3 -0
- data/lib/action_view/helpers/tags/month_field.rb +1 -1
- data/lib/action_view/helpers/tags/select.rb +4 -1
- data/lib/action_view/helpers/tags/select_renderer.rb +56 -0
- data/lib/action_view/helpers/tags/time_field.rb +1 -1
- data/lib/action_view/helpers/tags/time_zone_select.rb +3 -0
- data/lib/action_view/helpers/tags/week_field.rb +1 -1
- data/lib/action_view/helpers/tags/weekday_select.rb +3 -0
- data/lib/action_view/helpers/tags.rb +2 -0
- data/lib/action_view/helpers/text_helper.rb +33 -17
- data/lib/action_view/helpers/translation_helper.rb +6 -6
- data/lib/action_view/helpers/url_helper.rb +90 -65
- data/lib/action_view/helpers.rb +2 -0
- data/lib/action_view/layouts.rb +13 -8
- data/lib/action_view/log_subscriber.rb +49 -32
- data/lib/action_view/lookup_context.rb +29 -13
- data/lib/action_view/path_registry.rb +57 -0
- data/lib/action_view/path_set.rb +13 -14
- data/lib/action_view/railtie.rb +26 -3
- data/lib/action_view/record_identifier.rb +16 -9
- data/lib/action_view/renderer/abstract_renderer.rb +1 -1
- data/lib/action_view/renderer/collection_renderer.rb +9 -1
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +21 -3
- data/lib/action_view/renderer/partial_renderer.rb +3 -2
- data/lib/action_view/renderer/renderer.rb +2 -0
- data/lib/action_view/renderer/streaming_template_renderer.rb +3 -2
- data/lib/action_view/renderer/template_renderer.rb +3 -2
- data/lib/action_view/rendering.rb +24 -6
- data/lib/action_view/ripper_ast_parser.rb +6 -6
- data/lib/action_view/routing_url_for.rb +7 -4
- data/lib/action_view/template/error.rb +14 -1
- data/lib/action_view/template/handlers/builder.rb +4 -4
- data/lib/action_view/template/handlers/erb/erubi.rb +23 -27
- data/lib/action_view/template/handlers/erb.rb +73 -1
- data/lib/action_view/template/handlers.rb +1 -1
- data/lib/action_view/template/html.rb +1 -1
- data/lib/action_view/template/raw_file.rb +1 -1
- data/lib/action_view/template/renderable.rb +1 -1
- data/lib/action_view/template/resolver.rb +15 -5
- data/lib/action_view/template/text.rb +1 -1
- data/lib/action_view/template/types.rb +25 -34
- data/lib/action_view/template.rb +227 -53
- data/lib/action_view/template_path.rb +2 -0
- data/lib/action_view/test_case.rb +174 -21
- data/lib/action_view/unbound_template.rb +15 -5
- data/lib/action_view/version.rb +1 -1
- data/lib/action_view/view_paths.rb +19 -28
- data/lib/action_view.rb +4 -1
- data/lib/assets/compiled/rails-ujs.js +36 -5
- metadata +27 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3c480e4d31e8f0993748f63f865fdc83fd933b17cc38cdcf40bb6f2f5a851f
|
4
|
+
data.tar.gz: 55cc85a03a85c26914ca1efcf502749f7d68d2c60ccb9ff1d7da04817f9d3abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 458e12bf5a056fa2302d7be0b8fe01ba73403a1d02e442adaecb9dc791400b08bf8ec8cc0107e221284c5836b811668a038a8e11246201bec2306b23a5059fa9
|
7
|
+
data.tar.gz: 85e8be0ed9174c2768d415360f00dfccf0a4d51df657581fd9407a2c9d5c7d91b1e19c604964ecc03b8f3300960f62e2baaf66f01c332b7fa927de67da4b214e
|
data/CHANGELOG.md
CHANGED
@@ -1,333 +1,412 @@
|
|
1
|
-
## Rails 7.
|
1
|
+
## Rails 7.1.1 (October 11, 2023) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Updated `@rails/ujs` files to ignore certain data-* attributes when element is contenteditable.
|
4
4
|
|
5
|
-
|
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)]
|
6
7
|
|
7
|
-
*
|
8
|
+
*Ryunosuke Sato*
|
8
9
|
|
9
|
-
*Alex Ghiculescu*
|
10
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.
|
11
19
|
|
12
|
-
## Rails 7.0.0 (December 15, 2021) ##
|
13
20
|
|
14
|
-
|
15
|
-
|
16
|
-
|
21
|
+
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
22
|
+
|
23
|
+
* Introduce `ActionView::TestCase.register_parser`
|
17
24
|
|
18
25
|
```ruby
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
22
32
|
|
23
|
-
|
24
|
-
|
33
|
+
assert_equal "Hello, world", rendered.rss.items.last.title
|
34
|
+
end
|
25
35
|
```
|
26
36
|
|
37
|
+
By default, register parsers for `:html` and `:json`.
|
38
|
+
|
27
39
|
*Sean Doyle*
|
28
40
|
|
29
|
-
* Fix `number_with_precision(raise: true)` always raising even on valid numbers.
|
30
41
|
|
31
|
-
|
42
|
+
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
32
43
|
|
44
|
+
* Fix `simple_format` with blank `wrapper_tag` option returns plain html tag
|
33
45
|
|
34
|
-
|
46
|
+
By default `simple_format` method returns the text wrapped with `<p>`. But if we explicitly specify
|
47
|
+
the `wrapper_tag: nil` in the options, it returns the text wrapped with `<></>` tag.
|
35
48
|
|
36
|
-
|
49
|
+
Before:
|
37
50
|
|
51
|
+
```ruby
|
52
|
+
simple_format("Hello World", {}, { wrapper_tag: nil })
|
53
|
+
# <>Hello World</>
|
54
|
+
```
|
38
55
|
|
39
|
-
|
56
|
+
After:
|
40
57
|
|
41
|
-
|
58
|
+
```ruby
|
59
|
+
simple_format("Hello World", {}, { wrapper_tag: nil })
|
60
|
+
# <p>Hello World</p>
|
61
|
+
```
|
62
|
+
|
63
|
+
*Akhil G Krishnan*, *Junichi Ito*
|
42
64
|
|
43
|
-
|
65
|
+
* Don't double-encode nested `field_id` and `field_name` index values
|
44
66
|
|
45
|
-
|
46
|
-
|
67
|
+
Pass `index: @options` as a default keyword argument to `field_id` and
|
68
|
+
`field_name` view helper methods.
|
47
69
|
|
48
70
|
*Sean Doyle*
|
49
71
|
|
50
|
-
*
|
51
|
-
argument to `button_to` when combined with a block:
|
72
|
+
* Allow opting in/out of `Link preload` headers when calling `stylesheet_link_tag` or `javascript_include_tag`
|
52
73
|
|
53
74
|
```ruby
|
54
|
-
|
55
|
-
|
56
|
-
#=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
|
57
|
-
#=> <button type="submit">Update</button>
|
58
|
-
#=> </form>
|
75
|
+
# will exclude header, even if setting is enabled:
|
76
|
+
javascript_include_tag("http://example.com/all.js", preload_links_header: false)
|
59
77
|
|
60
|
-
|
61
|
-
|
62
|
-
#=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
|
63
|
-
#=> <button type="submit">Update</button>
|
64
|
-
#=> </form>
|
78
|
+
# will include header, even if setting is disabled:
|
79
|
+
stylesheet_link_tag("http://example.com/all.js", preload_links_header: true)
|
65
80
|
```
|
66
81
|
|
67
|
-
*
|
82
|
+
*Alex Ghiculescu*
|
68
83
|
|
69
|
-
*
|
84
|
+
* Stop generating `Link preload` headers once it has reached 1KB.
|
70
85
|
|
71
|
-
|
72
|
-
|
73
|
-
# => <button name="post[draft]" value="true" type="submit">Create post</button>
|
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.
|
74
88
|
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
# => <button name="post[draft]" value="true" type="submit">
|
79
|
-
# <strong>Save as draft</strong>
|
80
|
-
# </button>
|
81
|
-
```
|
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.
|
82
91
|
|
83
|
-
*
|
92
|
+
*Jean Boussier*
|
84
93
|
|
85
|
-
*
|
86
|
-
`FormBuilder#field_name` counterpart:
|
94
|
+
* `simple_format` helper now handles a `:sanitize_options` - any extra options you want appending to the sanitize.
|
87
95
|
|
96
|
+
Before:
|
88
97
|
```ruby
|
89
|
-
|
90
|
-
|
91
|
-
# => <input type="text" name="post[tag][]">
|
92
|
-
end
|
98
|
+
simple_format("<a target=\"_blank\" href=\"http://example.com\">Continue</a>")
|
99
|
+
# => "<p><a href=\"http://example.com\">Continue</a></p>"
|
93
100
|
```
|
94
101
|
|
95
|
-
|
96
|
-
|
97
|
-
* Execute the `ActionView::Base.field_error_proc` within the context of the
|
98
|
-
`ActionView::Base` instance:
|
99
|
-
|
102
|
+
After:
|
100
103
|
```ruby
|
101
|
-
|
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>"
|
102
106
|
```
|
103
107
|
|
104
|
-
*
|
108
|
+
*Andrei Andriichuk*
|
105
109
|
|
106
|
-
* Add support for
|
110
|
+
* Add support for HTML5 standards-compliant sanitizers, and default to `Rails::HTML5::Sanitizer`
|
111
|
+
in the Rails 7.1 configuration if it is supported.
|
107
112
|
|
108
|
-
|
109
|
-
|
110
|
-
|
113
|
+
Action View's HTML sanitizers can be configured by setting
|
114
|
+
`config.action_view.sanitizer_vendor`. Supported values are `Rails::HTML4::Sanitizer` or
|
115
|
+
`Rails::HTML5::Sanitizer`.
|
111
116
|
|
112
|
-
|
113
|
-
|
117
|
+
The Rails 7.1 configuration will set this to `Rails::HTML5::Sanitizer` when it is supported, and
|
118
|
+
fall back to `Rails::HTML4::Sanitizer`. Previous configurations default to
|
119
|
+
`Rails::HTML4::Sanitizer`.
|
114
120
|
|
115
|
-
|
116
|
-
# => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="secret" autocomplete="off" /></form>
|
117
|
-
```
|
121
|
+
*Mike Dalessio*
|
118
122
|
|
119
|
-
|
123
|
+
* `config.dom_testing_default_html_version` controls the HTML parser used by
|
124
|
+
`ActionView::TestCase#document_root_element`, which creates the DOM used by the assertions in
|
125
|
+
Rails::Dom::Testing.
|
120
126
|
|
121
|
-
|
127
|
+
The Rails 7.1 default configuration opts into the HTML5 parser when it is supported, to better
|
128
|
+
represent what the DOM would be in a browser user agent. Previously this test helper always used
|
129
|
+
Nokogiri's HTML4 parser.
|
122
130
|
|
123
|
-
*
|
124
|
-
* `form_for ..., url: false` or `form_for ..., html: { action: false }`
|
125
|
-
* `form_tag false` or `form_tag ..., action: false`
|
126
|
-
* `button_to "...", false` or `button_to(false) { ... }`
|
131
|
+
*Mike Dalessio*
|
127
132
|
|
128
|
-
|
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.
|
129
137
|
|
130
|
-
|
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
|
+
```
|
131
148
|
|
132
|
-
|
133
|
-
|
149
|
+
For multiple sources:
|
150
|
+
```erb
|
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
|
+
```
|
134
161
|
|
135
|
-
|
162
|
+
Full control via a block:
|
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
|
+
```
|
136
178
|
|
137
|
-
*
|
138
|
-
is used with a single argument:
|
179
|
+
*Juan Pablo Balarini*
|
139
180
|
|
140
|
-
|
141
|
-
#=> <a href="/profiles/1">Eileen</a>
|
181
|
+
* Remove deprecated support to passing instance variables as locals to partials.
|
142
182
|
|
143
|
-
|
183
|
+
*Rafael Mendonça França*
|
144
184
|
|
145
|
-
|
146
|
-
# ...
|
147
|
-
def to_s
|
148
|
-
name
|
149
|
-
end
|
150
|
-
end
|
185
|
+
* Remove deprecated constant `ActionView::Path`.
|
151
186
|
|
152
|
-
|
153
|
-
model implemented a `#to_s` method that called the `name` method.
|
187
|
+
*Rafael Mendonça França*
|
154
188
|
|
155
|
-
|
156
|
-
#=> <a href="/profiles/1">Eileen</a>
|
189
|
+
* Guard `token_list` calls from escaping HTML too often
|
157
190
|
|
158
|
-
*
|
191
|
+
*Sean Doyle*
|
159
192
|
|
160
|
-
*
|
193
|
+
* `select` can now be called with a single hash containing options and some HTML options
|
161
194
|
|
162
|
-
|
163
|
-
# => <svg><use href="#cool-icon"></svg>
|
195
|
+
Previously this would not work as expected:
|
164
196
|
|
165
|
-
|
197
|
+
```erb
|
198
|
+
<%= select :post, :author, authors, required: true %>
|
199
|
+
```
|
166
200
|
|
201
|
+
Instead you needed to do this:
|
167
202
|
|
168
|
-
|
203
|
+
```erb
|
204
|
+
<%= select :post, :author, authors, {}, required: true %>
|
205
|
+
```
|
169
206
|
|
170
|
-
|
207
|
+
Now, either form is accepted, for the following HTML attributes: `required`, `multiple`, `size`.
|
171
208
|
|
209
|
+
*Alex Ghiculescu*
|
172
210
|
|
173
|
-
|
211
|
+
* Datetime form helpers (`time_field`, `date_field`, `datetime_field`, `week_field`, `month_field`) now accept an instance of Time/Date/DateTime as `:value` option.
|
174
212
|
|
175
|
-
|
176
|
-
|
213
|
+
Before:
|
214
|
+
```erb
|
215
|
+
<%= form.datetime_field :written_at, value: Time.current.strftime("%Y-%m-%dT%T") %>
|
216
|
+
```
|
177
217
|
|
178
|
-
|
218
|
+
After:
|
219
|
+
```erb
|
220
|
+
<%= form.datetime_field :written_at, value: Time.current %>
|
221
|
+
```
|
179
222
|
|
180
|
-
*
|
223
|
+
*Andrey Samsonov*
|
181
224
|
|
182
|
-
|
225
|
+
* Choices of `select` can optionally contain html attributes as the last element
|
226
|
+
of the child arrays when using grouped/nested collections
|
183
227
|
|
184
|
-
|
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
|
+
```
|
185
232
|
|
186
|
-
*
|
233
|
+
*Chris Gunther*
|
187
234
|
|
188
|
-
*
|
235
|
+
* `check_box_tag` and `radio_button_tag` now accept `checked` as a keyword argument
|
189
236
|
|
190
|
-
|
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:
|
191
239
|
|
192
|
-
|
240
|
+
```erb
|
241
|
+
= check_box_tag "admin", "1", false
|
242
|
+
= check_box_tag "admin", "1", checked: false
|
193
243
|
|
194
|
-
|
195
|
-
|
244
|
+
= radio_button_tag 'favorite_color', 'maroon', false
|
245
|
+
= radio_button_tag 'favorite_color', 'maroon', checked: false
|
246
|
+
```
|
196
247
|
|
197
|
-
|
248
|
+
*Alex Ghiculescu*
|
198
249
|
|
199
|
-
|
200
|
-
|
250
|
+
* Allow passing a class to `dom_id`.
|
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.
|
201
255
|
|
202
|
-
|
256
|
+
Before:
|
257
|
+
```ruby
|
258
|
+
dom_id(Post) # => NoMethodError: undefined method `to_key' for Post:Class
|
259
|
+
```
|
203
260
|
|
204
|
-
|
261
|
+
After:
|
262
|
+
```ruby
|
263
|
+
dom_id(Post) # => "new_post"
|
264
|
+
```
|
205
265
|
|
206
|
-
*
|
266
|
+
*Goulven Champenois*
|
207
267
|
|
208
|
-
|
268
|
+
* Report `:locals` as part of the data returned by ActionView render instrumentation.
|
209
269
|
|
210
|
-
|
270
|
+
Before:
|
271
|
+
```ruby
|
272
|
+
{
|
273
|
+
identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb",
|
274
|
+
layout: "layouts/application"
|
275
|
+
}
|
276
|
+
```
|
211
277
|
|
212
|
-
|
278
|
+
After:
|
279
|
+
```ruby
|
280
|
+
{
|
281
|
+
identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb",
|
282
|
+
layout: "layouts/application",
|
283
|
+
locals: {foo: "bar"}
|
284
|
+
}
|
285
|
+
```
|
213
286
|
|
214
|
-
*
|
287
|
+
*Aaron Gough*
|
215
288
|
|
216
|
-
|
289
|
+
* Strip `break_sequence` at the end of `word_wrap`.
|
217
290
|
|
218
|
-
|
219
|
-
translation keys through `I18n.translate` for interpolation.
|
291
|
+
This fixes a bug where `word_wrap` didn't properly strip off break sequences that had printable characters.
|
220
292
|
|
221
|
-
|
293
|
+
For example, compare the outputs of this template:
|
222
294
|
|
223
|
-
|
224
|
-
|
295
|
+
```erb
|
296
|
+
# <%= word_wrap("11 22\n33 44", line_width: 2, break_sequence: "\n# ") %>
|
297
|
+
```
|
225
298
|
|
226
299
|
Before:
|
227
300
|
|
228
|
-
```
|
229
|
-
|
230
|
-
#
|
301
|
+
```
|
302
|
+
# 11
|
303
|
+
# 22
|
304
|
+
#
|
305
|
+
# 33
|
306
|
+
# 44
|
307
|
+
#
|
231
308
|
```
|
232
309
|
|
233
310
|
After:
|
234
311
|
|
235
|
-
```
|
236
|
-
|
237
|
-
#
|
312
|
+
```
|
313
|
+
# 11
|
314
|
+
# 22
|
315
|
+
# 33
|
316
|
+
# 44
|
238
317
|
```
|
239
318
|
|
240
|
-
*
|
241
|
-
|
242
|
-
* Deprecate `render` locals to be assigned to instance variables.
|
319
|
+
*Max Chernyak*
|
243
320
|
|
244
|
-
|
321
|
+
* Allow templates to set strict `locals`.
|
245
322
|
|
246
|
-
|
323
|
+
By default, templates will accept any `locals` as keyword arguments. To define what `locals` a template accepts, add a `locals` magic comment:
|
247
324
|
|
248
|
-
|
325
|
+
```erb
|
326
|
+
<%# locals: (message:) -%>
|
327
|
+
<%= message %>
|
328
|
+
```
|
249
329
|
|
250
|
-
|
251
|
-
attributes into `_method="$VERB"` Form Data to enable varied same-form actions:
|
330
|
+
Default values can also be provided:
|
252
331
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
<%# => <form action="posts/1">
|
258
|
-
=> <input type="hidden" name="_method" value="put">
|
259
|
-
=> <button type="submit">Update</button>
|
260
|
-
=> <button type="submit" formmethod="post" name="_method" value="delete">Delete</button>
|
261
|
-
=> </form>
|
262
|
-
%>
|
332
|
+
```erb
|
333
|
+
<%# locals: (message: "Hello, world!") -%>
|
334
|
+
<%= message %>
|
335
|
+
```
|
263
336
|
|
264
|
-
|
337
|
+
Or `locals` can be disabled entirely:
|
265
338
|
|
266
|
-
|
267
|
-
|
268
|
-
|
339
|
+
```erb
|
340
|
+
<%# locals: () %>
|
341
|
+
```
|
269
342
|
|
270
|
-
|
271
|
-
# => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
|
343
|
+
*Joel Hawksley*
|
272
344
|
|
273
|
-
|
274
|
-
Delete
|
275
|
-
<% end %>
|
276
|
-
# => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
|
345
|
+
* Add `include_seconds` option for `datetime_local_field`
|
277
346
|
|
278
|
-
|
347
|
+
This allows to omit seconds part in the input field, by passing `include_seconds: false`
|
279
348
|
|
280
|
-
*
|
281
|
-
the `Link` header being added by default when using `stylesheet_link_tag`
|
282
|
-
and `javascript_include_tag`.
|
349
|
+
*Wojciech Wnętrzak*
|
283
350
|
|
284
|
-
|
351
|
+
* Guard against `ActionView::Helpers::FormTagHelper#field_name` calls with nil
|
352
|
+
`object_name` arguments. For example:
|
285
353
|
|
286
|
-
|
287
|
-
|
354
|
+
```erb
|
355
|
+
<%= fields do |f| %>
|
356
|
+
<%= f.field_name :body %>
|
357
|
+
<% end %>
|
358
|
+
```
|
288
359
|
|
289
|
-
*
|
360
|
+
*Sean Doyle*
|
290
361
|
|
291
|
-
*
|
292
|
-
the `image_tag` `:loading` option.
|
362
|
+
* Strings returned from `strip_tags` are correctly tagged `html_safe?`
|
293
363
|
|
294
|
-
|
295
|
-
|
364
|
+
Because these strings contain no HTML elements and the basic entities are escaped, they are safe
|
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.
|
296
367
|
|
297
|
-
|
368
|
+
Fixes [rails/rails-html-sanitizer#124](https://github.com/rails/rails-html-sanitizer/issues/124)
|
298
369
|
|
299
|
-
*
|
300
|
-
of the `<form>` element's `id` attribute. With a `method` argument, returns
|
301
|
-
the `id` attribute for a form field with that name.
|
370
|
+
*Mike Dalessio*
|
302
371
|
|
303
|
-
|
304
|
-
<%# ... %>
|
372
|
+
* Move `convert_to_model` call from `form_for` into `form_with`
|
305
373
|
|
306
|
-
|
307
|
-
|
308
|
-
<% end %>
|
309
|
-
<% end %>
|
374
|
+
Now that `form_for` is implemented in terms of `form_with`, remove the
|
375
|
+
`convert_to_model` call from `form_for`.
|
310
376
|
|
311
377
|
*Sean Doyle*
|
312
378
|
|
313
|
-
* `ActionView::Helpers
|
314
|
-
the FormBuilder for the given attribute name.
|
379
|
+
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
315
380
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
<% end %>
|
381
|
+
Escape dangerous characters in names of tags and names of attributes in the
|
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.
|
321
385
|
|
322
|
-
|
386
|
+
*Álvaro Martín Fraguas*
|
323
387
|
|
324
|
-
*
|
325
|
-
interpolated into ERB.
|
388
|
+
* Extend audio_tag and video_tag to accept Active Storage attachments.
|
326
389
|
|
327
|
-
|
328
|
-
# => <input type="text" aria-label="Search">
|
390
|
+
Now it's possible to write
|
329
391
|
|
330
|
-
|
392
|
+
```ruby
|
393
|
+
audio_tag(user.audio_file)
|
394
|
+
video_tag(user.video_file)
|
395
|
+
```
|
396
|
+
|
397
|
+
Instead of
|
398
|
+
|
399
|
+
```ruby
|
400
|
+
audio_tag(polymorphic_path(user.audio_file))
|
401
|
+
video_tag(polymorphic_path(user.video_file))
|
402
|
+
```
|
403
|
+
|
404
|
+
`image_tag` already supported that, so this follows the same pattern.
|
331
405
|
|
406
|
+
*Matheus Richard*
|
407
|
+
|
408
|
+
* Ensure models passed to `form_for` attempt to call `to_model`.
|
409
|
+
|
410
|
+
*Sean Doyle*
|
332
411
|
|
333
|
-
Please check [
|
412
|
+
Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionview/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED