actionview 7.1.5.1 → 7.2.2.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 +52 -435
- data/lib/action_view/base.rb +20 -2
- 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/gem_version.rb +2 -2
- data/lib/action_view/helpers/asset_tag_helper.rb +15 -3
- data/lib/action_view/helpers/csrf_helper.rb +1 -1
- data/lib/action_view/helpers/form_helper.rb +197 -192
- data/lib/action_view/helpers/form_tag_helper.rb +80 -47
- data/lib/action_view/helpers/output_safety_helper.rb +4 -4
- data/lib/action_view/helpers/tag_helper.rb +208 -18
- data/lib/action_view/helpers/text_helper.rb +1 -1
- data/lib/action_view/helpers/url_helper.rb +3 -77
- data/lib/action_view/layouts.rb +2 -4
- 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/renderer.rb +32 -38
- data/lib/action_view/rendering.rb +4 -4
- data/lib/action_view/template/renderable.rb +7 -1
- data/lib/action_view/template/resolver.rb +0 -2
- data/lib/action_view/template.rb +36 -8
- data/lib/action_view/test_case.rb +7 -9
- metadata +14 -13
@@ -68,6 +68,8 @@ module ActionView
|
|
68
68
|
# attribute, which indicates to the browser that the script is meant to
|
69
69
|
# be executed after the document has been parsed. Additionally, prevents
|
70
70
|
# sending the Preload Links header.
|
71
|
+
# * <tt>:nopush</tt> - Specify if the use of server push is not desired
|
72
|
+
# for the script. Defaults to +true+.
|
71
73
|
#
|
72
74
|
# Any other specified options will be treated as HTML attributes for the
|
73
75
|
# +script+ tag.
|
@@ -166,6 +168,10 @@ module ActionView
|
|
166
168
|
# that path.
|
167
169
|
# * <tt>:skip_pipeline</tt> - This option is used to bypass the asset pipeline
|
168
170
|
# when it is set to true.
|
171
|
+
# * <tt>:nonce</tt> - When set to true, adds an automatic nonce value if
|
172
|
+
# you have Content Security Policy enabled.
|
173
|
+
# * <tt>:nopush</tt> - Specify if the use of server push is not desired
|
174
|
+
# for the stylesheet. Defaults to +true+.
|
169
175
|
#
|
170
176
|
# ==== Examples
|
171
177
|
#
|
@@ -190,6 +196,9 @@ module ActionView
|
|
190
196
|
# stylesheet_link_tag "random.styles", "/css/stylish"
|
191
197
|
# # => <link href="/assets/random.styles" rel="stylesheet" />
|
192
198
|
# # <link href="/css/stylish.css" rel="stylesheet" />
|
199
|
+
#
|
200
|
+
# stylesheet_link_tag "style", nonce: true
|
201
|
+
# # => <link href="/assets/style.css" rel="stylesheet" nonce="..." />
|
193
202
|
def stylesheet_link_tag(*sources)
|
194
203
|
options = sources.extract_options!.stringify_keys
|
195
204
|
path_options = options.extract!("protocol", "extname", "host", "skip_pipeline").symbolize_keys
|
@@ -214,6 +223,9 @@ module ActionView
|
|
214
223
|
"crossorigin" => crossorigin,
|
215
224
|
"href" => href
|
216
225
|
}.merge!(options)
|
226
|
+
if tag_options["nonce"] == true
|
227
|
+
tag_options["nonce"] = content_security_policy_nonce
|
228
|
+
end
|
217
229
|
|
218
230
|
if apply_stylesheet_media_default && tag_options["media"].blank?
|
219
231
|
tag_options["media"] = "screen"
|
@@ -351,13 +363,13 @@ module ActionView
|
|
351
363
|
nopush = options.delete(:nopush) || false
|
352
364
|
rel = mime_type == "module" ? "modulepreload" : "preload"
|
353
365
|
|
354
|
-
link_tag = tag.link(
|
366
|
+
link_tag = tag.link(
|
355
367
|
rel: rel,
|
356
368
|
href: href,
|
357
369
|
as: as_type,
|
358
370
|
type: mime_type,
|
359
|
-
crossorigin: crossorigin
|
360
|
-
|
371
|
+
crossorigin: crossorigin,
|
372
|
+
**options.symbolize_keys)
|
361
373
|
|
362
374
|
preload_link = "<#{href}>; rel=#{rel}; as=#{as_type}"
|
363
375
|
preload_link += "; type=#{mime_type}" if mime_type
|
@@ -17,7 +17,7 @@ module ActionView
|
|
17
17
|
# You don't need to use these tags for regular forms as they generate their own hidden fields.
|
18
18
|
#
|
19
19
|
# For Ajax requests other than GETs, extract the "csrf-token" from the meta-tag and send as the
|
20
|
-
# +X-CSRF-Token+ HTTP header.
|
20
|
+
# +X-CSRF-Token+ HTTP header.
|
21
21
|
#
|
22
22
|
def csrf_meta_tags
|
23
23
|
if defined?(protect_against_forgery?) && protect_against_forgery?
|