actionview 6.0.0.beta1 → 6.1.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionview might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +273 -119
- data/MIT-LICENSE +1 -1
- data/README.rdoc +5 -3
- data/lib/action_view/base.rb +81 -15
- data/lib/action_view/cache_expiry.rb +52 -0
- data/lib/action_view/context.rb +0 -5
- data/lib/action_view/dependency_tracker.rb +10 -4
- data/lib/action_view/digestor.rb +11 -19
- data/lib/action_view/flows.rb +0 -1
- data/lib/action_view/gem_version.rb +3 -3
- data/lib/action_view/helpers/active_model_helper.rb +0 -1
- data/lib/action_view/helpers/asset_tag_helper.rb +62 -22
- data/lib/action_view/helpers/asset_url_helper.rb +6 -4
- data/lib/action_view/helpers/atom_feed_helper.rb +2 -1
- data/lib/action_view/helpers/cache_helper.rb +16 -23
- data/lib/action_view/helpers/csp_helper.rb +4 -2
- data/lib/action_view/helpers/date_helper.rb +5 -6
- data/lib/action_view/helpers/form_helper.rb +70 -34
- data/lib/action_view/helpers/form_options_helper.rb +10 -18
- data/lib/action_view/helpers/form_tag_helper.rb +12 -9
- data/lib/action_view/helpers/javascript_helper.rb +7 -5
- data/lib/action_view/helpers/number_helper.rb +9 -8
- data/lib/action_view/helpers/output_safety_helper.rb +1 -1
- data/lib/action_view/helpers/rendering_helper.rb +17 -7
- data/lib/action_view/helpers/sanitize_helper.rb +10 -16
- data/lib/action_view/helpers/tag_helper.rb +94 -19
- data/lib/action_view/helpers/tags/base.rb +10 -7
- data/lib/action_view/helpers/tags/check_box.rb +0 -1
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +0 -1
- data/lib/action_view/helpers/tags/collection_helpers.rb +0 -1
- data/lib/action_view/helpers/tags/collection_radio_buttons.rb +0 -1
- data/lib/action_view/helpers/tags/color_field.rb +0 -1
- data/lib/action_view/helpers/tags/date_field.rb +1 -2
- data/lib/action_view/helpers/tags/date_select.rb +2 -3
- data/lib/action_view/helpers/tags/datetime_field.rb +0 -1
- data/lib/action_view/helpers/tags/datetime_local_field.rb +1 -2
- data/lib/action_view/helpers/tags/label.rb +4 -1
- data/lib/action_view/helpers/tags/month_field.rb +1 -2
- data/lib/action_view/helpers/tags/radio_button.rb +0 -1
- data/lib/action_view/helpers/tags/select.rb +1 -2
- data/lib/action_view/helpers/tags/text_field.rb +0 -1
- data/lib/action_view/helpers/tags/time_field.rb +1 -2
- data/lib/action_view/helpers/tags/week_field.rb +1 -2
- data/lib/action_view/helpers/text_helper.rb +2 -3
- data/lib/action_view/helpers/translation_helper.rb +98 -51
- data/lib/action_view/helpers/url_helper.rb +124 -16
- data/lib/action_view/layouts.rb +8 -10
- data/lib/action_view/log_subscriber.rb +26 -11
- data/lib/action_view/lookup_context.rb +59 -31
- data/lib/action_view/path_set.rb +3 -12
- data/lib/action_view/railtie.rb +39 -41
- data/lib/action_view/record_identifier.rb +0 -1
- data/lib/action_view/renderer/abstract_renderer.rb +142 -11
- data/lib/action_view/renderer/collection_renderer.rb +196 -0
- data/lib/action_view/renderer/object_renderer.rb +34 -0
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +35 -29
- data/lib/action_view/renderer/partial_renderer.rb +21 -273
- data/lib/action_view/renderer/renderer.rb +59 -4
- data/lib/action_view/renderer/streaming_template_renderer.rb +9 -7
- data/lib/action_view/renderer/template_renderer.rb +35 -27
- data/lib/action_view/rendering.rb +49 -29
- data/lib/action_view/routing_url_for.rb +1 -1
- data/lib/action_view/template/error.rb +30 -15
- data/lib/action_view/template/handlers/builder.rb +2 -2
- data/lib/action_view/template/handlers/erb/erubi.rb +15 -9
- data/lib/action_view/template/handlers/erb.rb +14 -19
- data/lib/action_view/template/handlers/html.rb +1 -1
- data/lib/action_view/template/handlers/raw.rb +2 -2
- data/lib/action_view/template/handlers.rb +1 -1
- data/lib/action_view/template/html.rb +5 -6
- data/lib/action_view/template/inline.rb +22 -0
- data/lib/action_view/template/raw_file.rb +25 -0
- data/lib/action_view/template/renderable.rb +24 -0
- data/lib/action_view/template/resolver.rb +141 -140
- data/lib/action_view/template/sources/file.rb +17 -0
- data/lib/action_view/template/sources.rb +13 -0
- data/lib/action_view/template/text.rb +2 -3
- data/lib/action_view/template.rb +49 -75
- data/lib/action_view/test_case.rb +20 -28
- data/lib/action_view/testing/resolvers.rb +18 -27
- data/lib/action_view/unbound_template.rb +31 -0
- data/lib/action_view/view_paths.rb +59 -38
- data/lib/action_view.rb +7 -2
- data/lib/assets/compiled/rails-ujs.js +25 -16
- metadata +30 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d032131f3879f298ee73bdec251c6b71bcf05c12bda0bb4a8156cb77096c8cb8
|
4
|
+
data.tar.gz: '034379d2e8c7d137f60fcc3044aef37b94f2d5f7b441d634f7e24f72f01c817d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8a6276b5517f7991936433c76543041c35a7521eae07ec5afd46db1b3fa7292aa15ed92b74784774a72ff5b7af8bf5e07c3bff70f4a25c5fb2d0ec55d2092d5
|
7
|
+
data.tar.gz: 940c438d6ce952627e2bc08a6d7272a6ceae8fe4b89095acc9daa889d8a8eb3f1ceced29ee4c9c3c8ffc41ed9104eae2be6a62c643eba66679d6ab744b125961
|
data/CHANGELOG.md
CHANGED
@@ -1,191 +1,345 @@
|
|
1
|
-
## Rails 6.
|
1
|
+
## Rails 6.1.4 (June 24, 2021) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* The `translate` helper now passes `default` values that aren't
|
4
|
+
translation keys through `I18n.translate` for interpolation.
|
5
|
+
|
6
|
+
*Jonathan Hefner*
|
7
|
+
|
8
|
+
* Don't attach UJS form submission handlers to Turbo forms.
|
9
|
+
|
10
|
+
*David Heinemeier Hansson*
|
11
|
+
|
12
|
+
* Allow both `current_page?(url_hash)` and `current_page?(**url_hash)` on Ruby 2.7.
|
13
|
+
|
14
|
+
*Ryuta Kamizono*
|
15
|
+
|
16
|
+
|
17
|
+
## Rails 6.1.3.2 (May 05, 2021) ##
|
18
|
+
|
19
|
+
* No changes.
|
20
|
+
|
21
|
+
|
22
|
+
## Rails 6.1.3.1 (March 26, 2021) ##
|
23
|
+
|
24
|
+
* No changes.
|
25
|
+
|
26
|
+
|
27
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
28
|
+
|
29
|
+
* No changes.
|
30
|
+
|
31
|
+
|
32
|
+
## Rails 6.1.2.1 (February 10, 2021) ##
|
33
|
+
|
34
|
+
* No changes.
|
35
|
+
|
36
|
+
|
37
|
+
## Rails 6.1.2 (February 09, 2021) ##
|
38
|
+
|
39
|
+
* No changes.
|
40
|
+
|
41
|
+
|
42
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
43
|
+
|
44
|
+
* Fix lazy translation in partial with block.
|
45
|
+
|
46
|
+
*Marek Kasztelnik*
|
47
|
+
|
48
|
+
* Avoid extra `SELECT COUNT` queries when rendering Active Record collections.
|
49
|
+
|
50
|
+
*aar0nr*
|
51
|
+
|
52
|
+
* Link preloading keep integrity hashes in the header.
|
53
|
+
|
54
|
+
*Étienne Barrié*
|
55
|
+
|
56
|
+
* Add `config.action_view.preload_links_header` to allow disabling of
|
57
|
+
the `Link` header being added by default when using `stylesheet_link_tag`
|
58
|
+
and `javascript_include_tag`.
|
59
|
+
|
60
|
+
*Andrew White*
|
61
|
+
|
62
|
+
* The `translate` helper now resolves `default` values when a `nil` key is
|
63
|
+
specified, instead of always returning `nil`.
|
64
|
+
|
65
|
+
*Jonathan Hefner*
|
66
|
+
|
67
|
+
|
68
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
69
|
+
|
70
|
+
* SanitizeHelper.sanitized_allowed_attributes and SanitizeHelper.sanitized_allowed_tags
|
71
|
+
call safe_list_sanitizer's class method
|
72
|
+
|
73
|
+
Fixes #39586
|
74
|
+
|
75
|
+
*Taufiq Muhammadi*
|
76
|
+
|
77
|
+
* Change form_with to generate non-remote forms by default.
|
78
|
+
|
79
|
+
`form_with` would generate a remote form by default. This would confuse
|
80
|
+
users because they were forced to handle remote requests.
|
81
|
+
|
82
|
+
All new 6.1 applications will generate non-remote forms by default.
|
83
|
+
When upgrading a 6.0 application you can enable remote forms by default by
|
84
|
+
setting `config.action_view.form_with_generates_remote_forms` to `true`.
|
85
|
+
|
86
|
+
*Petrik de Heus*
|
87
|
+
|
88
|
+
* Yield translated strings to calls of `ActionView::FormBuilder#button`
|
89
|
+
when a block is given.
|
90
|
+
|
91
|
+
*Sean Doyle*
|
92
|
+
|
93
|
+
* Alias `ActionView::Helpers::Tags::Label::LabelBuilder#translation` to
|
94
|
+
`#to_s` so that `form.label` calls can yield that value to their blocks.
|
95
|
+
|
96
|
+
*Sean Doyle*
|
97
|
+
|
98
|
+
* Rename the new `TagHelper#class_names` method to `TagHelper#token_list`,
|
99
|
+
and make the original available as an alias.
|
100
|
+
|
101
|
+
token_list("foo", "foo bar")
|
102
|
+
# => "foo bar"
|
103
|
+
|
104
|
+
*Sean Doyle*
|
105
|
+
|
106
|
+
* ARIA Array and Hash attributes are treated as space separated `DOMTokenList`
|
107
|
+
values. This is useful when declaring lists of label text identifiers in
|
108
|
+
`aria-labelledby` or `aria-describedby`.
|
109
|
+
|
110
|
+
tag.input type: 'checkbox', name: 'published', aria: {
|
111
|
+
invalid: @post.errors[:published].any?,
|
112
|
+
labelledby: ['published_context', 'published_label'],
|
113
|
+
describedby: { published_errors: @post.errors[:published].any? }
|
114
|
+
}
|
115
|
+
#=> <input
|
116
|
+
type="checkbox" name="published" aria-invalid="true"
|
117
|
+
aria-labelledby="published_context published_label"
|
118
|
+
aria-describedby="published_errors"
|
119
|
+
>
|
120
|
+
|
121
|
+
*Sean Doyle*
|
122
|
+
|
123
|
+
* Remove deprecated `escape_whitelist` from `ActionView::Template::Handlers::ERB`.
|
4
124
|
|
5
125
|
*Rafael Mendonça França*
|
6
126
|
|
7
|
-
*
|
8
|
-
`ActionView::Base` subclasses. This prevents the use of forms and buttons.
|
127
|
+
* Remove deprecated `find_all_anywhere` from `ActionView::Resolver`.
|
9
128
|
|
10
|
-
*
|
129
|
+
*Rafael Mendonça França*
|
11
130
|
|
12
|
-
*
|
13
|
-
Fixes #33889
|
131
|
+
* Remove deprecated `formats` from `ActionView::Template::HTML`.
|
14
132
|
|
15
|
-
*
|
133
|
+
*Rafael Mendonça França*
|
16
134
|
|
17
|
-
*
|
18
|
-
Firefox fires click events even if the click was triggered by non-primary mouse keys such as right- or scroll-wheel-clicks.
|
19
|
-
For example, right-clicking a link such as the one described below (with an underlying ajax request registered on click) should not cause that request to occur.
|
135
|
+
* Remove deprecated `formats` from `ActionView::Template::RawFile`.
|
20
136
|
|
21
|
-
|
22
|
-
<%= link_to 'Remote', remote_path, class: 'remote', remote: true, data: { type: :json } %>
|
23
|
-
```
|
137
|
+
*Rafael Mendonça França*
|
24
138
|
|
25
|
-
|
139
|
+
* Remove deprecated `formats` from `ActionView::Template::Text`.
|
26
140
|
|
27
|
-
*
|
141
|
+
*Rafael Mendonça França*
|
28
142
|
|
29
|
-
*
|
143
|
+
* Remove deprecated `find_file` from `ActionView::PathSet`.
|
30
144
|
|
31
|
-
|
145
|
+
*Rafael Mendonça França*
|
32
146
|
|
33
|
-
|
34
|
-
This is a paragraph with an initial indent,
|
35
|
-
followed by additional lines that are not indented,
|
36
|
-
and finally terminated with a blockquote:
|
37
|
-
"A pithy saying"
|
38
|
-
```
|
147
|
+
* Remove deprecated `rendered_format` from `ActionView::LookupContext`.
|
39
148
|
|
40
|
-
|
149
|
+
*Rafael Mendonça França*
|
41
150
|
|
42
|
-
|
151
|
+
* Remove deprecated `find_file` from `ActionView::ViewPaths`.
|
43
152
|
|
44
|
-
*
|
153
|
+
*Rafael Mendonça França*
|
45
154
|
|
46
|
-
*
|
155
|
+
* Require that `ActionView::Base` subclasses implement `#compiled_method_container`.
|
47
156
|
|
48
|
-
|
157
|
+
*Rafael Mendonça França*
|
49
158
|
|
50
|
-
|
51
|
-
|
52
|
-
Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654)
|
53
|
-
Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564)
|
54
|
-
```
|
159
|
+
* Remove deprecated support to pass an object that is not a `ActionView::LookupContext` as the first argument
|
160
|
+
in `ActionView::Base#initialize`.
|
55
161
|
|
56
|
-
*
|
162
|
+
*Rafael Mendonça França*
|
57
163
|
|
58
|
-
*
|
164
|
+
* Remove deprecated `format` argument `ActionView::Base#initialize`.
|
59
165
|
|
60
|
-
|
166
|
+
*Rafael Mendonça França*
|
61
167
|
|
62
|
-
|
168
|
+
* Remove deprecated `ActionView::Template#refresh`.
|
63
169
|
|
64
|
-
*
|
170
|
+
*Rafael Mendonça França*
|
65
171
|
|
66
|
-
|
67
|
-
and `collection_select` it is possible to call private methods from
|
68
|
-
the objects used.
|
172
|
+
* Remove deprecated `ActionView::Template#original_encoding`.
|
69
173
|
|
70
|
-
|
174
|
+
*Rafael Mendonça França*
|
71
175
|
|
72
|
-
|
176
|
+
* Remove deprecated `ActionView::Template#variants`.
|
73
177
|
|
74
|
-
*
|
178
|
+
*Rafael Mendonça França*
|
75
179
|
|
76
|
-
|
77
|
-
contains symbol and string keys. The reason for the exception was that
|
78
|
-
`to_form_params` was comparing the given symbol and string keys.
|
180
|
+
* Remove deprecated `ActionView::Template#formats`.
|
79
181
|
|
80
|
-
|
81
|
-
`to_form_params` before comparing them.
|
182
|
+
*Rafael Mendonça França*
|
82
183
|
|
83
|
-
|
184
|
+
* Remove deprecated `ActionView::Template#virtual_path=`.
|
84
185
|
|
85
|
-
*
|
186
|
+
*Rafael Mendonça França*
|
86
187
|
|
87
|
-
|
188
|
+
* Remove deprecated `ActionView::Template#updated_at`.
|
88
189
|
|
89
|
-
|
90
|
-
foo_html:
|
91
|
-
- "One"
|
92
|
-
- "<strong>Two</strong>"
|
93
|
-
- "Three 👋 🙂"
|
190
|
+
*Rafael Mendonça França*
|
94
191
|
|
95
|
-
|
192
|
+
* Remove deprecated `updated_at` argument required on `ActionView::Template#initialize`.
|
96
193
|
|
97
|
-
*
|
98
|
-
names. Lambda should be passed to use this option.
|
194
|
+
*Rafael Mendonça França*
|
99
195
|
|
100
|
-
|
196
|
+
* Make `locals` argument required on `ActionView::Template#initialize`.
|
101
197
|
|
102
|
-
|
198
|
+
*Rafael Mendonça França*
|
103
199
|
|
104
|
-
|
200
|
+
* Remove deprecated `ActionView::Template.finalize_compiled_template_methods`.
|
105
201
|
|
106
|
-
|
107
|
-
<option value="1998">Heisei 10</option>
|
108
|
-
<option value="1999">Heisei 11</option>
|
109
|
-
<option value="2000">Heisei 12</option>
|
110
|
-
</select>
|
111
|
-
/* The rest is omitted */
|
202
|
+
*Rafael Mendonça França*
|
112
203
|
|
113
|
-
|
204
|
+
* Remove deprecated `config.action_view.finalize_compiled_template_methods`
|
114
205
|
|
115
|
-
*
|
116
|
-
Content Security Policy.
|
206
|
+
*Rafael Mendonça França*
|
117
207
|
|
118
|
-
|
208
|
+
* Remove deprecated support to calling `ActionView::ViewPaths#with_fallback` with a block.
|
119
209
|
|
120
|
-
*
|
210
|
+
*Rafael Mendonça França*
|
121
211
|
|
122
|
-
*
|
123
|
-
support automatic nonce generation for Content Security Policy.
|
124
|
-
Works the same way as `javascript_tag nonce: true` does.
|
212
|
+
* Remove deprecated support to passing absolute paths to `render template:`.
|
125
213
|
|
126
|
-
*
|
214
|
+
*Rafael Mendonça França*
|
127
215
|
|
128
|
-
* Remove `
|
216
|
+
* Remove deprecated support to passing relative paths to `render file:`.
|
129
217
|
|
130
|
-
*
|
218
|
+
*Rafael Mendonça França*
|
131
219
|
|
132
|
-
*
|
220
|
+
* Remove support to template handlers that don't accept two arguments.
|
133
221
|
|
134
|
-
|
135
|
-
Add a configuration option,
|
136
|
-
`action_view.finalize_compiled_template_methods`, and turn it off in
|
137
|
-
the test environment.
|
222
|
+
*Rafael Mendonça França*
|
138
223
|
|
139
|
-
|
224
|
+
* Remove deprecated pattern argument in `ActionView::Template::PathResolver`.
|
140
225
|
|
141
|
-
*
|
226
|
+
*Rafael Mendonça França*
|
142
227
|
|
143
|
-
|
228
|
+
* Remove deprecated support to call private methods from object in some view helpers.
|
144
229
|
|
145
|
-
|
146
|
-
return (my_bootstrap_modal_confirm(message));
|
147
|
-
}
|
230
|
+
*Rafael Mendonça França*
|
148
231
|
|
149
|
-
|
232
|
+
* `ActionView::Helpers::TranslationHelper#translate` accepts a block, yielding
|
233
|
+
the translated text and the fully resolved translation key:
|
150
234
|
|
151
|
-
|
152
|
-
|
235
|
+
<%= translate(".relative_key") do |translation, resolved_key| %>
|
236
|
+
<span title="<%= resolved_key %>"><%= translation %></span>
|
237
|
+
<% end %>
|
153
238
|
|
154
|
-
|
239
|
+
*Sean Doyle*
|
155
240
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
{ required: true }
|
241
|
+
* Ensure cache fragment digests include all relevant template dependencies when
|
242
|
+
fragments are contained in a block passed to the render helper. Remove the
|
243
|
+
virtual_path keyword arguments found in CacheHelper as they no longer possess
|
244
|
+
any function following 1581cab.
|
161
245
|
|
162
|
-
|
246
|
+
Fixes #38984.
|
163
247
|
|
164
|
-
|
248
|
+
*Aaron Lipman*
|
165
249
|
|
166
|
-
|
167
|
-
|
168
|
-
<option value="lifestyle">lifestyle</option>
|
169
|
-
<option value="programming">programming</option>
|
170
|
-
<option value="spiritual">spiritual</option></select>
|
250
|
+
* Deprecate `config.action_view.raise_on_missing_translations` in favor of
|
251
|
+
`config.i18n.raise_on_missing_translations`.
|
171
252
|
|
172
|
-
|
253
|
+
New generalized configuration option now determines whether an error should be raised
|
254
|
+
for missing translations in controllers and views.
|
173
255
|
|
174
|
-
*
|
256
|
+
*fatkodima*
|
175
257
|
|
176
|
-
|
177
|
-
|
178
|
-
UTF-8 encoding as it's not relevant to other browsers.
|
258
|
+
* Instrument layout rendering in `TemplateRenderer#render_with_layout` as `render_layout.action_view`,
|
259
|
+
and include (when necessary) the layout's virtual path in notification payloads for collection and partial renders.
|
179
260
|
|
180
|
-
*
|
261
|
+
*Zach Kemp*
|
262
|
+
|
263
|
+
* `ActionView::Base.annotate_rendered_view_with_filenames` annotates HTML output with template file names.
|
264
|
+
|
265
|
+
*Joel Hawksley*, *Aaron Patterson*
|
266
|
+
|
267
|
+
* `ActionView::Helpers::TranslationHelper#translate` returns nil when
|
268
|
+
passed `default: nil` without a translation matching `I18n#translate`.
|
269
|
+
|
270
|
+
*Stefan Wrobel*
|
271
|
+
|
272
|
+
* `OptimizedFileSystemResolver` prefers template details in order of locale,
|
273
|
+
formats, variants, handlers.
|
274
|
+
|
275
|
+
*Iago Pimenta*
|
276
|
+
|
277
|
+
* Added `class_names` helper to create a CSS class value with conditional classes.
|
278
|
+
|
279
|
+
*Joel Hawksley*, *Aaron Patterson*
|
280
|
+
|
281
|
+
* Add support for conditional values to TagBuilder.
|
282
|
+
|
283
|
+
*Joel Hawksley*
|
284
|
+
|
285
|
+
* `ActionView::Helpers::FormOptionsHelper#select` should mark option for `nil` as selected.
|
286
|
+
|
287
|
+
```ruby
|
288
|
+
@post = Post.new
|
289
|
+
@post.category = nil
|
290
|
+
|
291
|
+
# Before
|
292
|
+
select("post", "category", none: nil, programming: 1, economics: 2)
|
293
|
+
# =>
|
294
|
+
# <select name="post[category]" id="post_category">
|
295
|
+
# <option value="">none</option>
|
296
|
+
# <option value="1">programming</option>
|
297
|
+
# <option value="2">economics</option>
|
298
|
+
# </select>
|
299
|
+
|
300
|
+
# After
|
301
|
+
select("post", "category", none: nil, programming: 1, economics: 2)
|
302
|
+
# =>
|
303
|
+
# <select name="post[category]" id="post_category">
|
304
|
+
# <option selected="selected" value="">none</option>
|
305
|
+
# <option value="1">programming</option>
|
306
|
+
# <option value="2">economics</option>
|
307
|
+
# </select>
|
308
|
+
```
|
309
|
+
|
310
|
+
*bogdanvlviv*
|
311
|
+
|
312
|
+
* Log lines for partial renders and started template renders are now
|
313
|
+
emitted at the `DEBUG` level instead of `INFO`.
|
314
|
+
|
315
|
+
Completed template renders are still logged at the `INFO` level.
|
316
|
+
|
317
|
+
*DHH*
|
318
|
+
|
319
|
+
* ActionView::Helpers::SanitizeHelper: support rails-html-sanitizer 1.1.0.
|
320
|
+
|
321
|
+
*Juanito Fatas*
|
322
|
+
|
323
|
+
* Added `phone_to` helper method to create a link from mobile numbers.
|
324
|
+
|
325
|
+
*Pietro Moro*
|
326
|
+
|
327
|
+
* annotated_source_code returns an empty array so TemplateErrors without a
|
328
|
+
template in the backtrace are surfaced properly by DebugExceptions.
|
329
|
+
|
330
|
+
*Guilherme Mansur*, *Kasper Timm Hansen*
|
331
|
+
|
332
|
+
* Add autoload for SyntaxErrorInTemplate so syntax errors are correctly raised by DebugExceptions.
|
333
|
+
|
334
|
+
*Guilherme Mansur*, *Gannon McGibbon*
|
181
335
|
|
182
|
-
*
|
336
|
+
* `RenderingHelper` supports rendering objects that `respond_to?` `:render_in`.
|
183
337
|
|
184
|
-
*
|
338
|
+
*Joel Hawksley*, *Natasha Umer*, *Aaron Patterson*, *Shawn Allen*, *Emily Plummer*, *Diana Mounter*, *John Hawthorn*, *Nathan Herald*, *Zaid Zawaideh*, *Zach Ahn*
|
185
339
|
|
186
|
-
*
|
340
|
+
* Fix `select_tag` so that it doesn't change `options` when `include_blank` is present.
|
187
341
|
|
188
|
-
*
|
342
|
+
*Younes SERRAJ*
|
189
343
|
|
190
344
|
|
191
|
-
Please check [
|
345
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionview/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -5,6 +5,8 @@ view helpers that assist when building HTML forms, Atom feeds and more.
|
|
5
5
|
Template formats that Action View handles are ERB (embedded Ruby, typically
|
6
6
|
used to inline short Ruby snippets inside HTML), and XML Builder.
|
7
7
|
|
8
|
+
You can read more about Action View in the {Action View Overview}[https://edgeguides.rubyonrails.org/action_view_overview.html] guide.
|
9
|
+
|
8
10
|
== Download and installation
|
9
11
|
|
10
12
|
The latest version of Action View can be installed with RubyGems:
|
@@ -13,7 +15,7 @@ The latest version of Action View can be installed with RubyGems:
|
|
13
15
|
|
14
16
|
Source code can be downloaded as part of the Rails project on GitHub:
|
15
17
|
|
16
|
-
* https://github.com/rails/rails/tree/
|
18
|
+
* https://github.com/rails/rails/tree/main/actionview
|
17
19
|
|
18
20
|
|
19
21
|
== License
|
@@ -27,7 +29,7 @@ Action View is released under the MIT license:
|
|
27
29
|
|
28
30
|
API documentation is at
|
29
31
|
|
30
|
-
*
|
32
|
+
* https://api.rubyonrails.org
|
31
33
|
|
32
34
|
Bug reports for the Ruby on Rails project can be filed here:
|
33
35
|
|
@@ -35,4 +37,4 @@ Bug reports for the Ruby on Rails project can be filed here:
|
|
35
37
|
|
36
38
|
Feature requests should be discussed on the rails-core mailing list here:
|
37
39
|
|
38
|
-
* https://
|
40
|
+
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
data/lib/action_view/base.rb
CHANGED
@@ -27,7 +27,7 @@ module ActionView #:nodoc:
|
|
27
27
|
# Name: <%= person.name %><br/>
|
28
28
|
# <% end %>
|
29
29
|
#
|
30
|
-
# The loop is
|
30
|
+
# The loop is set up in regular embedding tags <tt><% %></tt>, and the name is written using the output embedding tag <tt><%= %></tt>. Note that this
|
31
31
|
# is not just a usage suggestion. Regular output functions like print or puts won't work with ERB templates. So this would be wrong:
|
32
32
|
#
|
33
33
|
# <%# WRONG %>
|
@@ -151,7 +151,7 @@ module ActionView #:nodoc:
|
|
151
151
|
# Specify whether rendering within namespaced controllers should prefix
|
152
152
|
# the partial paths for ActiveModel objects with the namespace.
|
153
153
|
# (e.g., an Admin::PostsController would render @post using /admin/posts/_post.erb)
|
154
|
-
|
154
|
+
class_attribute :prefix_partial_path_with_controller_namespace, default: true
|
155
155
|
|
156
156
|
# Specify default_formats that can be rendered.
|
157
157
|
cattr_accessor :default_formats
|
@@ -162,6 +162,9 @@ module ActionView #:nodoc:
|
|
162
162
|
# Specify whether submit_tag should automatically disable on click
|
163
163
|
cattr_accessor :automatically_disable_submit_tag, default: true
|
164
164
|
|
165
|
+
# Annotate rendered view with file names
|
166
|
+
cattr_accessor :annotate_rendered_view_with_filenames, default: false
|
167
|
+
|
165
168
|
class_attribute :_routes
|
166
169
|
class_attribute :logger
|
167
170
|
|
@@ -179,37 +182,100 @@ module ActionView #:nodoc:
|
|
179
182
|
def xss_safe? #:nodoc:
|
180
183
|
true
|
181
184
|
end
|
185
|
+
|
186
|
+
def with_empty_template_cache # :nodoc:
|
187
|
+
subclass = Class.new(self) {
|
188
|
+
# We can't implement these as self.class because subclasses will
|
189
|
+
# share the same template cache as superclasses, so "changed?" won't work
|
190
|
+
# correctly.
|
191
|
+
define_method(:compiled_method_container) { subclass }
|
192
|
+
define_singleton_method(:compiled_method_container) { subclass }
|
193
|
+
|
194
|
+
def inspect
|
195
|
+
"#<ActionView::Base:#{'%#016x' % (object_id << 1)}>"
|
196
|
+
end
|
197
|
+
}
|
198
|
+
end
|
199
|
+
|
200
|
+
def changed?(other) # :nodoc:
|
201
|
+
compiled_method_container != other.compiled_method_container
|
202
|
+
end
|
182
203
|
end
|
183
204
|
|
184
|
-
|
205
|
+
attr_reader :view_renderer, :lookup_context
|
185
206
|
attr_internal :config, :assigns
|
186
207
|
|
187
|
-
delegate :lookup_context, to: :view_renderer
|
188
208
|
delegate :formats, :formats=, :locale, :locale=, :view_paths, :view_paths=, to: :lookup_context
|
189
209
|
|
190
210
|
def assign(new_assigns) # :nodoc:
|
191
211
|
@_assigns = new_assigns.each { |key, value| instance_variable_set("@#{key}", value) }
|
192
212
|
end
|
193
213
|
|
194
|
-
|
214
|
+
# :stopdoc:
|
215
|
+
|
216
|
+
def self.empty
|
217
|
+
with_view_paths([])
|
218
|
+
end
|
219
|
+
|
220
|
+
def self.with_view_paths(view_paths, assigns = {}, controller = nil)
|
221
|
+
with_context ActionView::LookupContext.new(view_paths), assigns, controller
|
222
|
+
end
|
223
|
+
|
224
|
+
def self.with_context(context, assigns = {}, controller = nil)
|
225
|
+
new context, assigns, controller
|
226
|
+
end
|
227
|
+
|
228
|
+
# :startdoc:
|
229
|
+
|
230
|
+
def initialize(lookup_context, assigns, controller) #:nodoc:
|
195
231
|
@_config = ActiveSupport::InheritableOptions.new
|
196
232
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
context : ActionView::LookupContext.new(context)
|
202
|
-
lookup_context.formats = formats if formats
|
203
|
-
lookup_context.prefixes = controller._prefixes if controller
|
204
|
-
@view_renderer = ActionView::Renderer.new(lookup_context)
|
205
|
-
end
|
233
|
+
@lookup_context = lookup_context
|
234
|
+
|
235
|
+
@view_renderer = ActionView::Renderer.new @lookup_context
|
236
|
+
@current_template = nil
|
206
237
|
|
207
|
-
@cache_hit = {}
|
208
238
|
assign(assigns)
|
209
239
|
assign_controller(controller)
|
210
240
|
_prepare_context
|
211
241
|
end
|
212
242
|
|
243
|
+
def _run(method, template, locals, buffer, add_to_stack: true, &block)
|
244
|
+
_old_output_buffer, _old_virtual_path, _old_template = @output_buffer, @virtual_path, @current_template
|
245
|
+
@current_template = template if add_to_stack
|
246
|
+
@output_buffer = buffer
|
247
|
+
public_send(method, locals, buffer, &block)
|
248
|
+
ensure
|
249
|
+
@output_buffer, @virtual_path, @current_template = _old_output_buffer, _old_virtual_path, _old_template
|
250
|
+
end
|
251
|
+
|
252
|
+
def compiled_method_container
|
253
|
+
raise NotImplementedError, <<~msg.squish
|
254
|
+
Subclasses of ActionView::Base must implement `compiled_method_container`
|
255
|
+
or use the class method `with_empty_template_cache` for constructing
|
256
|
+
an ActionView::Base subclass that has an empty cache.
|
257
|
+
msg
|
258
|
+
end
|
259
|
+
|
260
|
+
def in_rendering_context(options)
|
261
|
+
old_view_renderer = @view_renderer
|
262
|
+
old_lookup_context = @lookup_context
|
263
|
+
|
264
|
+
if !lookup_context.html_fallback_for_js && options[:formats]
|
265
|
+
formats = Array(options[:formats])
|
266
|
+
if formats == [:js]
|
267
|
+
formats << :html
|
268
|
+
end
|
269
|
+
@lookup_context = lookup_context.with_prepended_formats(formats)
|
270
|
+
@view_renderer = ActionView::Renderer.new @lookup_context
|
271
|
+
end
|
272
|
+
|
273
|
+
yield @view_renderer
|
274
|
+
ensure
|
275
|
+
@view_renderer = old_view_renderer
|
276
|
+
@lookup_context = old_lookup_context
|
277
|
+
end
|
278
|
+
|
213
279
|
ActiveSupport.run_load_hooks(:action_view, self)
|
214
280
|
end
|
215
281
|
end
|