actionview 6.1.4.6 → 7.0.0.alpha1
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 +92 -306
- data/MIT-LICENSE +1 -1
- data/lib/action_view/base.rb +3 -3
- 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 +4 -4
- data/lib/action_view/helpers/active_model_helper.rb +1 -1
- data/lib/action_view/helpers/asset_tag_helper.rb +84 -29
- data/lib/action_view/helpers/asset_url_helper.rb +7 -7
- data/lib/action_view/helpers/atom_feed_helper.rb +3 -4
- data/lib/action_view/helpers/cache_helper.rb +51 -3
- data/lib/action_view/helpers/capture_helper.rb +2 -2
- 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 +1 -1
- data/lib/action_view/helpers/date_helper.rb +5 -5
- data/lib/action_view/helpers/debug_helper.rb +3 -1
- data/lib/action_view/helpers/form_helper.rb +72 -12
- data/lib/action_view/helpers/form_options_helper.rb +65 -33
- data/lib/action_view/helpers/form_tag_helper.rb +73 -30
- data/lib/action_view/helpers/javascript_helper.rb +3 -5
- data/lib/action_view/helpers/number_helper.rb +3 -4
- data/lib/action_view/helpers/output_safety_helper.rb +2 -2
- data/lib/action_view/helpers/rendering_helper.rb +1 -1
- data/lib/action_view/helpers/sanitize_helper.rb +2 -2
- data/lib/action_view/helpers/tag_helper.rb +17 -4
- data/lib/action_view/helpers/tags/base.rb +2 -14
- 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/time_field.rb +10 -1
- data/lib/action_view/helpers/tags/weekday_select.rb +27 -0
- data/lib/action_view/helpers/tags.rb +3 -2
- data/lib/action_view/helpers/text_helper.rb +24 -13
- data/lib/action_view/helpers/translation_helper.rb +1 -2
- data/lib/action_view/helpers/url_helper.rb +110 -81
- data/lib/action_view/helpers.rb +25 -25
- data/lib/action_view/lookup_context.rb +33 -52
- data/lib/action_view/model_naming.rb +1 -1
- data/lib/action_view/path_set.rb +16 -22
- data/lib/action_view/railtie.rb +15 -2
- 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 +0 -34
- 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 +2 -2
- data/lib/action_view/ripper_ast_parser.rb +198 -0
- data/lib/action_view/routing_url_for.rb +1 -1
- 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 +84 -311
- data/lib/action_view/template/text.rb +3 -3
- data/lib/action_view/template/types.rb +14 -12
- data/lib/action_view/template.rb +10 -1
- 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 +6 -2
- data/lib/action_view/testing/resolvers.rb +11 -12
- data/lib/action_view/unbound_template.rb +33 -7
- data/lib/action_view.rb +3 -4
- metadata +25 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 488edff5bf41873248138efbc0c8ee4ecd1809793a99ebe520870d35e2a6e459
|
4
|
+
data.tar.gz: 429fd7c60ef3fb02df47871d05a7289cfda25e21586928dc1accebaa45678a7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3db204604fb84ce3ab96976aad76fffb4938a2ec6ad7f965b2dc59a785622888867f92df3282ae560d6fb594fecc215a1c18340329ea912bed58c74d457e6824
|
7
|
+
data.tar.gz: 7eb29f984ea723f25728f8ae0c06127b7728501e18e690b0b73972d34a3bd467783760c293d50bc474f1fba9ddc824c02678af7653edcab8a5703766a572b96f
|
data/CHANGELOG.md
CHANGED
@@ -1,87 +1,109 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Improves the performance of ActionView::Helpers::NumberHelper formatters by avoiding the use of
|
4
|
+
exceptions as flow control.
|
4
5
|
|
6
|
+
*Mike Dalessio*
|
5
7
|
|
6
|
-
|
8
|
+
* `preload_link_tag` properly inserts `as` attributes for files with `image` MIME types, such as JPG or SVG.
|
7
9
|
|
8
|
-
*
|
10
|
+
*Nate Berkopec*
|
9
11
|
|
12
|
+
* Add `weekday_options_for_select` and `weekday_select` helper methods. Also adds `weekday_select` to `FormBuilder`.
|
10
13
|
|
11
|
-
|
14
|
+
*Drew Bragg*, *Dana Kashubeck*, *Kasper Timm Hansen*
|
12
15
|
|
13
|
-
*
|
16
|
+
* 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.
|
14
17
|
|
18
|
+
*Ben Toews*, *John Hawthorn*, *Kasper Timm Hansen*, *Joel Hawksley*
|
15
19
|
|
16
|
-
|
20
|
+
* Add `include_seconds` option for `time_field`.
|
17
21
|
|
18
|
-
|
22
|
+
<%= form.time_field :foo, include_seconds: false %>
|
23
|
+
# => <input value="16:22" type="time" />
|
19
24
|
|
25
|
+
Default includes seconds:
|
20
26
|
|
21
|
-
|
27
|
+
<%= form.time_field :foo %>
|
28
|
+
# => <input value="16:22:01.440" type="time" />
|
22
29
|
|
23
|
-
|
30
|
+
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.
|
24
31
|
|
32
|
+
*Alex Ghiculescu*
|
25
33
|
|
26
|
-
|
34
|
+
* Improve error messages when template file does not exist at absolute filepath.
|
27
35
|
|
28
|
-
*
|
36
|
+
*Ted Whang*
|
29
37
|
|
30
|
-
|
31
|
-
## Rails 6.1.4 (June 24, 2021) ##
|
32
|
-
|
33
|
-
* The `translate` helper now passes `default` values that aren't
|
34
|
-
translation keys through `I18n.translate` for interpolation.
|
38
|
+
* Add `:country_code` option to `sms_to` for consistency with `phone_to`.
|
35
39
|
|
36
40
|
*Jonathan Hefner*
|
37
41
|
|
38
|
-
*
|
39
|
-
|
40
|
-
*David Heinemeier Hansson*
|
41
|
-
|
42
|
-
* Allow both `current_page?(url_hash)` and `current_page?(**url_hash)` on Ruby 2.7.
|
43
|
-
|
44
|
-
*Ryuta Kamizono*
|
45
|
-
|
42
|
+
* OpenSSL constants are now used for Digest computations.
|
46
43
|
|
47
|
-
|
44
|
+
*Dirkjan Bussink*
|
48
45
|
|
49
|
-
*
|
50
|
-
|
51
|
-
|
52
|
-
## Rails 6.1.3.1 (March 26, 2021) ##
|
46
|
+
* The `translate` helper now passes `default` values that aren't
|
47
|
+
translation keys through `I18n.translate` for interpolation.
|
53
48
|
|
54
|
-
*
|
49
|
+
*Jonathan Hefner*
|
55
50
|
|
51
|
+
* Adds option `extname` to `stylesheet_link_tag` to skip default
|
52
|
+
`.css` extension appended to the stylesheet path.
|
56
53
|
|
57
|
-
|
54
|
+
Before:
|
58
55
|
|
59
|
-
|
56
|
+
```ruby
|
57
|
+
stylesheet_link_tag "style.less"
|
58
|
+
# <link href="/stylesheets/style.less.scss" rel="stylesheet">
|
59
|
+
```
|
60
60
|
|
61
|
+
After:
|
61
62
|
|
62
|
-
|
63
|
+
```ruby
|
64
|
+
stylesheet_link_tag "style.less", extname: false, skip_pipeline: true, rel: "stylesheet/less"
|
65
|
+
# <link href="/stylesheets/style.less" rel="stylesheet/less">
|
66
|
+
```
|
63
67
|
|
64
|
-
*
|
68
|
+
*Abhay Nikam*
|
65
69
|
|
70
|
+
* Deprecate `render` locals to be assigned to instance variables.
|
66
71
|
|
67
|
-
|
72
|
+
*Petrik de Heus*
|
68
73
|
|
69
|
-
*
|
74
|
+
* Remove legacy default `media=screen` from `stylesheet_link_tag`.
|
70
75
|
|
76
|
+
*André Luis Leal Cardoso Junior*
|
71
77
|
|
72
|
-
|
78
|
+
* Change `ActionView::Helpers::FormBuilder#button` to transform `formmethod`
|
79
|
+
attributes into `_method="$VERB"` Form Data to enable varied same-form actions:
|
73
80
|
|
74
|
-
|
81
|
+
<%= form_with model: post, method: :put do %>
|
82
|
+
<%= form.button "Update" %>
|
83
|
+
<%= form.button "Delete", formmethod: :delete %>
|
84
|
+
<% end %>
|
85
|
+
<%# => <form action="posts/1">
|
86
|
+
=> <input type="hidden" name="_method" value="put">
|
87
|
+
=> <button type="submit">Update</button>
|
88
|
+
=> <button type="submit" formmethod="post" name="_method" value="delete">Delete</button>
|
89
|
+
=> </form>
|
90
|
+
%>
|
75
91
|
|
76
|
-
*
|
92
|
+
*Sean Doyle*
|
77
93
|
|
78
|
-
*
|
94
|
+
* Change `ActionView::Helpers::UrlHelper#button_to` to *always* render a
|
95
|
+
`<button>` element, regardless of whether or not the content is passed as
|
96
|
+
the first argument or as a block.
|
79
97
|
|
80
|
-
|
98
|
+
<%= button_to "Delete", post_path(@post), method: :delete %>
|
99
|
+
# => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
|
81
100
|
|
82
|
-
|
101
|
+
<%= button_to post_path(@post), method: :delete do %>
|
102
|
+
Delete
|
103
|
+
<% end %>
|
104
|
+
# => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
|
83
105
|
|
84
|
-
|
106
|
+
*Sean Doyle*, *Dusan Orlovic*
|
85
107
|
|
86
108
|
* Add `config.action_view.preload_links_header` to allow disabling of
|
87
109
|
the `Link` header being added by default when using `stylesheet_link_tag`
|
@@ -94,282 +116,46 @@
|
|
94
116
|
|
95
117
|
*Jonathan Hefner*
|
96
118
|
|
119
|
+
* Add `config.action_view.image_loading` to configure the default value of
|
120
|
+
the `image_tag` `:loading` option.
|
97
121
|
|
98
|
-
|
99
|
-
|
100
|
-
* SanitizeHelper.sanitized_allowed_attributes and SanitizeHelper.sanitized_allowed_tags
|
101
|
-
call safe_list_sanitizer's class method
|
102
|
-
|
103
|
-
Fixes #39586
|
104
|
-
|
105
|
-
*Taufiq Muhammadi*
|
106
|
-
|
107
|
-
* Change form_with to generate non-remote forms by default.
|
108
|
-
|
109
|
-
`form_with` would generate a remote form by default. This would confuse
|
110
|
-
users because they were forced to handle remote requests.
|
111
|
-
|
112
|
-
All new 6.1 applications will generate non-remote forms by default.
|
113
|
-
When upgrading a 6.0 application you can enable remote forms by default by
|
114
|
-
setting `config.action_view.form_with_generates_remote_forms` to `true`.
|
115
|
-
|
116
|
-
*Petrik de Heus*
|
117
|
-
|
118
|
-
* Yield translated strings to calls of `ActionView::FormBuilder#button`
|
119
|
-
when a block is given.
|
120
|
-
|
121
|
-
*Sean Doyle*
|
122
|
-
|
123
|
-
* Alias `ActionView::Helpers::Tags::Label::LabelBuilder#translation` to
|
124
|
-
`#to_s` so that `form.label` calls can yield that value to their blocks.
|
125
|
-
|
126
|
-
*Sean Doyle*
|
122
|
+
By setting `config.action_view.image_loading = "lazy"`, an application can opt in to
|
123
|
+
lazy loading images sitewide, without changing view code.
|
127
124
|
|
128
|
-
*
|
129
|
-
and make the original available as an alias.
|
125
|
+
*Jonathan Hefner*
|
130
126
|
|
131
|
-
|
132
|
-
|
127
|
+
* `ActionView::Helpers::FormBuilder#id` returns the value
|
128
|
+
of the `<form>` element's `id` attribute. With a `method` argument, returns
|
129
|
+
the `id` attribute for a form field with that name.
|
133
130
|
|
134
|
-
|
131
|
+
<%= form_for @post do |f| %>
|
132
|
+
<%# ... %>
|
135
133
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
tag.input type: 'checkbox', name: 'published', aria: {
|
141
|
-
invalid: @post.errors[:published].any?,
|
142
|
-
labelledby: ['published_context', 'published_label'],
|
143
|
-
describedby: { published_errors: @post.errors[:published].any? }
|
144
|
-
}
|
145
|
-
#=> <input
|
146
|
-
type="checkbox" name="published" aria-invalid="true"
|
147
|
-
aria-labelledby="published_context published_label"
|
148
|
-
aria-describedby="published_errors"
|
149
|
-
>
|
134
|
+
<% content_for :sticky_footer do %>
|
135
|
+
<%= form.button(form: f.id) %>
|
136
|
+
<% end %>
|
137
|
+
<% end %>
|
150
138
|
|
151
139
|
*Sean Doyle*
|
152
140
|
|
153
|
-
*
|
154
|
-
|
155
|
-
*Rafael Mendonça França*
|
156
|
-
|
157
|
-
* Remove deprecated `find_all_anywhere` from `ActionView::Resolver`.
|
158
|
-
|
159
|
-
*Rafael Mendonça França*
|
160
|
-
|
161
|
-
* Remove deprecated `formats` from `ActionView::Template::HTML`.
|
162
|
-
|
163
|
-
*Rafael Mendonça França*
|
164
|
-
|
165
|
-
* Remove deprecated `formats` from `ActionView::Template::RawFile`.
|
166
|
-
|
167
|
-
*Rafael Mendonça França*
|
168
|
-
|
169
|
-
* Remove deprecated `formats` from `ActionView::Template::Text`.
|
170
|
-
|
171
|
-
*Rafael Mendonça França*
|
172
|
-
|
173
|
-
* Remove deprecated `find_file` from `ActionView::PathSet`.
|
174
|
-
|
175
|
-
*Rafael Mendonça França*
|
176
|
-
|
177
|
-
* Remove deprecated `rendered_format` from `ActionView::LookupContext`.
|
178
|
-
|
179
|
-
*Rafael Mendonça França*
|
180
|
-
|
181
|
-
* Remove deprecated `find_file` from `ActionView::ViewPaths`.
|
182
|
-
|
183
|
-
*Rafael Mendonça França*
|
184
|
-
|
185
|
-
* Require that `ActionView::Base` subclasses implement `#compiled_method_container`.
|
186
|
-
|
187
|
-
*Rafael Mendonça França*
|
188
|
-
|
189
|
-
* Remove deprecated support to pass an object that is not a `ActionView::LookupContext` as the first argument
|
190
|
-
in `ActionView::Base#initialize`.
|
191
|
-
|
192
|
-
*Rafael Mendonça França*
|
193
|
-
|
194
|
-
* Remove deprecated `format` argument `ActionView::Base#initialize`.
|
195
|
-
|
196
|
-
*Rafael Mendonça França*
|
197
|
-
|
198
|
-
* Remove deprecated `ActionView::Template#refresh`.
|
199
|
-
|
200
|
-
*Rafael Mendonça França*
|
201
|
-
|
202
|
-
* Remove deprecated `ActionView::Template#original_encoding`.
|
203
|
-
|
204
|
-
*Rafael Mendonça França*
|
205
|
-
|
206
|
-
* Remove deprecated `ActionView::Template#variants`.
|
141
|
+
* `ActionView::Helpers::FormBuilder#field_id` returns the value generated by
|
142
|
+
the FormBuilder for the given attribute name.
|
207
143
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
*Rafael Mendonça França*
|
213
|
-
|
214
|
-
* Remove deprecated `ActionView::Template#virtual_path=`.
|
215
|
-
|
216
|
-
*Rafael Mendonça França*
|
217
|
-
|
218
|
-
* Remove deprecated `ActionView::Template#updated_at`.
|
219
|
-
|
220
|
-
*Rafael Mendonça França*
|
221
|
-
|
222
|
-
* Remove deprecated `updated_at` argument required on `ActionView::Template#initialize`.
|
223
|
-
|
224
|
-
*Rafael Mendonça França*
|
225
|
-
|
226
|
-
* Make `locals` argument required on `ActionView::Template#initialize`.
|
227
|
-
|
228
|
-
*Rafael Mendonça França*
|
229
|
-
|
230
|
-
* Remove deprecated `ActionView::Template.finalize_compiled_template_methods`.
|
231
|
-
|
232
|
-
*Rafael Mendonça França*
|
233
|
-
|
234
|
-
* Remove deprecated `config.action_view.finalize_compiled_template_methods`
|
235
|
-
|
236
|
-
*Rafael Mendonça França*
|
237
|
-
|
238
|
-
* Remove deprecated support to calling `ActionView::ViewPaths#with_fallback` with a block.
|
239
|
-
|
240
|
-
*Rafael Mendonça França*
|
241
|
-
|
242
|
-
* Remove deprecated support to passing absolute paths to `render template:`.
|
243
|
-
|
244
|
-
*Rafael Mendonça França*
|
245
|
-
|
246
|
-
* Remove deprecated support to passing relative paths to `render file:`.
|
247
|
-
|
248
|
-
*Rafael Mendonça França*
|
249
|
-
|
250
|
-
* Remove support to template handlers that don't accept two arguments.
|
251
|
-
|
252
|
-
*Rafael Mendonça França*
|
253
|
-
|
254
|
-
* Remove deprecated pattern argument in `ActionView::Template::PathResolver`.
|
255
|
-
|
256
|
-
*Rafael Mendonça França*
|
257
|
-
|
258
|
-
* Remove deprecated support to call private methods from object in some view helpers.
|
259
|
-
|
260
|
-
*Rafael Mendonça França*
|
261
|
-
|
262
|
-
* `ActionView::Helpers::TranslationHelper#translate` accepts a block, yielding
|
263
|
-
the translated text and the fully resolved translation key:
|
264
|
-
|
265
|
-
<%= translate(".relative_key") do |translation, resolved_key| %>
|
266
|
-
<span title="<%= resolved_key %>"><%= translation %></span>
|
144
|
+
<%= form_for @post do |f| %>
|
145
|
+
<%= f.label :title %>
|
146
|
+
<%= f.text_field :title, aria: { describedby: f.field_id(:title, :error) } %>
|
147
|
+
<%= tag.span("is blank", id: f.field_id(:title, :error) %>
|
267
148
|
<% end %>
|
268
149
|
|
269
150
|
*Sean Doyle*
|
270
151
|
|
271
|
-
*
|
272
|
-
|
273
|
-
virtual_path keyword arguments found in CacheHelper as they no longer possess
|
274
|
-
any function following 1581cab.
|
275
|
-
|
276
|
-
Fixes #38984.
|
277
|
-
|
278
|
-
*Aaron Lipman*
|
279
|
-
|
280
|
-
* Deprecate `config.action_view.raise_on_missing_translations` in favor of
|
281
|
-
`config.i18n.raise_on_missing_translations`.
|
282
|
-
|
283
|
-
New generalized configuration option now determines whether an error should be raised
|
284
|
-
for missing translations in controllers and views.
|
152
|
+
* Add `tag.attributes` to transform a Hash into HTML Attributes, ready to be
|
153
|
+
interpolated into ERB.
|
285
154
|
|
286
|
-
|
155
|
+
<input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
|
156
|
+
# => <input type="text" aria-label="Search">
|
287
157
|
|
288
|
-
*
|
289
|
-
and include (when necessary) the layout's virtual path in notification payloads for collection and partial renders.
|
290
|
-
|
291
|
-
*Zach Kemp*
|
292
|
-
|
293
|
-
* `ActionView::Base.annotate_rendered_view_with_filenames` annotates HTML output with template file names.
|
294
|
-
|
295
|
-
*Joel Hawksley*, *Aaron Patterson*
|
296
|
-
|
297
|
-
* `ActionView::Helpers::TranslationHelper#translate` returns nil when
|
298
|
-
passed `default: nil` without a translation matching `I18n#translate`.
|
299
|
-
|
300
|
-
*Stefan Wrobel*
|
301
|
-
|
302
|
-
* `OptimizedFileSystemResolver` prefers template details in order of locale,
|
303
|
-
formats, variants, handlers.
|
304
|
-
|
305
|
-
*Iago Pimenta*
|
306
|
-
|
307
|
-
* Added `class_names` helper to create a CSS class value with conditional classes.
|
308
|
-
|
309
|
-
*Joel Hawksley*, *Aaron Patterson*
|
310
|
-
|
311
|
-
* Add support for conditional values to TagBuilder.
|
312
|
-
|
313
|
-
*Joel Hawksley*
|
314
|
-
|
315
|
-
* `ActionView::Helpers::FormOptionsHelper#select` should mark option for `nil` as selected.
|
316
|
-
|
317
|
-
```ruby
|
318
|
-
@post = Post.new
|
319
|
-
@post.category = nil
|
320
|
-
|
321
|
-
# Before
|
322
|
-
select("post", "category", none: nil, programming: 1, economics: 2)
|
323
|
-
# =>
|
324
|
-
# <select name="post[category]" id="post_category">
|
325
|
-
# <option value="">none</option>
|
326
|
-
# <option value="1">programming</option>
|
327
|
-
# <option value="2">economics</option>
|
328
|
-
# </select>
|
329
|
-
|
330
|
-
# After
|
331
|
-
select("post", "category", none: nil, programming: 1, economics: 2)
|
332
|
-
# =>
|
333
|
-
# <select name="post[category]" id="post_category">
|
334
|
-
# <option selected="selected" value="">none</option>
|
335
|
-
# <option value="1">programming</option>
|
336
|
-
# <option value="2">economics</option>
|
337
|
-
# </select>
|
338
|
-
```
|
339
|
-
|
340
|
-
*bogdanvlviv*
|
341
|
-
|
342
|
-
* Log lines for partial renders and started template renders are now
|
343
|
-
emitted at the `DEBUG` level instead of `INFO`.
|
344
|
-
|
345
|
-
Completed template renders are still logged at the `INFO` level.
|
346
|
-
|
347
|
-
*DHH*
|
348
|
-
|
349
|
-
* ActionView::Helpers::SanitizeHelper: support rails-html-sanitizer 1.1.0.
|
350
|
-
|
351
|
-
*Juanito Fatas*
|
352
|
-
|
353
|
-
* Added `phone_to` helper method to create a link from mobile numbers.
|
354
|
-
|
355
|
-
*Pietro Moro*
|
356
|
-
|
357
|
-
* annotated_source_code returns an empty array so TemplateErrors without a
|
358
|
-
template in the backtrace are surfaced properly by DebugExceptions.
|
359
|
-
|
360
|
-
*Guilherme Mansur*, *Kasper Timm Hansen*
|
361
|
-
|
362
|
-
* Add autoload for SyntaxErrorInTemplate so syntax errors are correctly raised by DebugExceptions.
|
363
|
-
|
364
|
-
*Guilherme Mansur*, *Gannon McGibbon*
|
365
|
-
|
366
|
-
* `RenderingHelper` supports rendering objects that `respond_to?` `:render_in`.
|
367
|
-
|
368
|
-
*Joel Hawksley*, *Natasha Umer*, *Aaron Patterson*, *Shawn Allen*, *Emily Plummer*, *Diana Mounter*, *John Hawthorn*, *Nathan Herald*, *Zaid Zawaideh*, *Zach Ahn*
|
369
|
-
|
370
|
-
* Fix `select_tag` so that it doesn't change `options` when `include_blank` is present.
|
371
|
-
|
372
|
-
*Younes SERRAJ*
|
158
|
+
*Sean Doyle*
|
373
159
|
|
374
160
|
|
375
|
-
Please check [6-
|
161
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionview/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED
data/lib/action_view/base.rb
CHANGED
@@ -9,7 +9,7 @@ require "action_view/context"
|
|
9
9
|
require "action_view/template"
|
10
10
|
require "action_view/lookup_context"
|
11
11
|
|
12
|
-
module ActionView
|
12
|
+
module ActionView # :nodoc:
|
13
13
|
# = Action View Base
|
14
14
|
#
|
15
15
|
# Action View templates can be written in several ways.
|
@@ -179,7 +179,7 @@ module ActionView #:nodoc:
|
|
179
179
|
ActionView::Resolver.caching = value
|
180
180
|
end
|
181
181
|
|
182
|
-
def xss_safe?
|
182
|
+
def xss_safe? # :nodoc:
|
183
183
|
true
|
184
184
|
end
|
185
185
|
|
@@ -227,7 +227,7 @@ module ActionView #:nodoc:
|
|
227
227
|
|
228
228
|
# :startdoc:
|
229
229
|
|
230
|
-
def initialize(lookup_context, assigns, controller)
|
230
|
+
def initialize(lookup_context, assigns, controller) # :nodoc:
|
231
231
|
@_config = ActiveSupport::InheritableOptions.new
|
232
232
|
|
233
233
|
@lookup_context = lookup_context
|
data/lib/action_view/buffers.rb
CHANGED
@@ -18,7 +18,7 @@ module ActionView
|
|
18
18
|
# sbuf << 5
|
19
19
|
# puts sbuf # => "hello\u0005"
|
20
20
|
#
|
21
|
-
class OutputBuffer < ActiveSupport::SafeBuffer
|
21
|
+
class OutputBuffer < ActiveSupport::SafeBuffer # :nodoc:
|
22
22
|
def initialize(*)
|
23
23
|
super
|
24
24
|
encode!
|
@@ -38,7 +38,7 @@ module ActionView
|
|
38
38
|
alias :safe_append= :safe_concat
|
39
39
|
end
|
40
40
|
|
41
|
-
class StreamingBuffer
|
41
|
+
class StreamingBuffer # :nodoc:
|
42
42
|
def initialize(block)
|
43
43
|
@block = block
|
44
44
|
end
|
@@ -4,49 +4,63 @@ module ActionView
|
|
4
4
|
class CacheExpiry
|
5
5
|
class Executor
|
6
6
|
def initialize(watcher:)
|
7
|
-
@
|
7
|
+
@execution_lock = Concurrent::ReadWriteLock.new
|
8
|
+
@cache_expiry = ViewModificationWatcher.new(watcher: watcher) do
|
9
|
+
clear_cache
|
10
|
+
end
|
8
11
|
end
|
9
12
|
|
10
|
-
def
|
11
|
-
|
13
|
+
def run
|
14
|
+
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
15
|
+
@cache_expiry.execute_if_updated
|
16
|
+
@execution_lock.acquire_read_lock
|
17
|
+
end
|
12
18
|
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize(watcher:)
|
16
|
-
@watched_dirs = nil
|
17
|
-
@watcher_class = watcher
|
18
|
-
@watcher = nil
|
19
|
-
@mutex = Mutex.new
|
20
|
-
end
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
return if watched_dirs.empty?
|
20
|
+
def complete(_)
|
21
|
+
@execution_lock.release_read_lock
|
22
|
+
end
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
@
|
30
|
-
|
24
|
+
private
|
25
|
+
def clear_cache
|
26
|
+
@execution_lock.with_write_lock do
|
27
|
+
ActionView::LookupContext::DetailsKey.clear
|
31
28
|
end
|
32
|
-
@watcher.execute
|
33
|
-
else
|
34
|
-
@watcher.execute_if_updated
|
35
29
|
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def clear_cache
|
40
|
-
ActionView::LookupContext::DetailsKey.clear
|
41
30
|
end
|
42
31
|
|
43
|
-
|
44
|
-
def
|
45
|
-
|
32
|
+
class ViewModificationWatcher
|
33
|
+
def initialize(watcher:, &block)
|
34
|
+
@watched_dirs = nil
|
35
|
+
@watcher_class = watcher
|
36
|
+
@watcher = nil
|
37
|
+
@mutex = Mutex.new
|
38
|
+
@block = block
|
46
39
|
end
|
47
40
|
|
48
|
-
def
|
49
|
-
|
41
|
+
def execute_if_updated
|
42
|
+
@mutex.synchronize do
|
43
|
+
watched_dirs = dirs_to_watch
|
44
|
+
return if watched_dirs.empty?
|
45
|
+
|
46
|
+
if watched_dirs != @watched_dirs
|
47
|
+
@watched_dirs = watched_dirs
|
48
|
+
@watcher = @watcher_class.new([], watched_dirs, &@block)
|
49
|
+
@watcher.execute
|
50
|
+
else
|
51
|
+
@watcher.execute_if_updated
|
52
|
+
end
|
53
|
+
end
|
50
54
|
end
|
55
|
+
|
56
|
+
private
|
57
|
+
def dirs_to_watch
|
58
|
+
all_view_paths.grep(FileSystemResolver).map!(&:path).tap(&:uniq!).sort!
|
59
|
+
end
|
60
|
+
|
61
|
+
def all_view_paths
|
62
|
+
ActionView::ViewPaths.all_view_paths.flat_map(&:paths)
|
63
|
+
end
|
64
|
+
end
|
51
65
|
end
|
52
66
|
end
|