actionview 7.2.3 → 8.1.3
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 +112 -121
- data/lib/action_view/base.rb +5 -2
- data/lib/action_view/buffers.rb +1 -1
- data/lib/action_view/dependency_tracker/erb_tracker.rb +37 -28
- data/lib/action_view/dependency_tracker/ruby_tracker.rb +2 -19
- data/lib/action_view/dependency_tracker/wildcard_resolver.rb +32 -0
- data/lib/action_view/dependency_tracker.rb +7 -1
- data/lib/action_view/gem_version.rb +2 -2
- data/lib/action_view/helpers/asset_tag_helper.rb +21 -2
- data/lib/action_view/helpers/atom_feed_helper.rb +0 -2
- data/lib/action_view/helpers/cache_helper.rb +8 -0
- data/lib/action_view/helpers/capture_helper.rb +2 -2
- data/lib/action_view/helpers/controller_helper.rb +6 -2
- data/lib/action_view/helpers/date_helper.rb +20 -3
- data/lib/action_view/helpers/form_helper.rb +76 -76
- data/lib/action_view/helpers/form_options_helper.rb +33 -32
- data/lib/action_view/helpers/form_tag_helper.rb +35 -25
- data/lib/action_view/helpers/javascript_helper.rb +5 -1
- data/lib/action_view/helpers/number_helper.rb +14 -0
- data/lib/action_view/helpers/rendering_helper.rb +160 -50
- data/lib/action_view/helpers/sanitize_helper.rb +6 -0
- data/lib/action_view/helpers/tag_helper.rb +62 -75
- data/lib/action_view/helpers/tags/base.rb +11 -9
- data/lib/action_view/helpers/tags/check_box.rb +9 -3
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +4 -3
- data/lib/action_view/helpers/tags/datetime_field.rb +1 -1
- data/lib/action_view/helpers/tags/file_field.rb +7 -2
- data/lib/action_view/helpers/tags/hidden_field.rb +1 -1
- data/lib/action_view/helpers/tags/label.rb +3 -10
- data/lib/action_view/helpers/tags/radio_button.rb +1 -1
- data/lib/action_view/helpers/tags/select.rb +6 -1
- data/lib/action_view/helpers/tags/select_renderer.rb +6 -4
- data/lib/action_view/helpers/tags/text_area.rb +1 -1
- data/lib/action_view/helpers/tags/text_field.rb +1 -1
- data/lib/action_view/helpers/translation_helper.rb +6 -1
- data/lib/action_view/helpers/url_helper.rb +39 -13
- data/lib/action_view/layouts.rb +1 -1
- data/lib/action_view/locale/en.yml +3 -0
- data/lib/action_view/log_subscriber.rb +1 -4
- data/lib/action_view/railtie.rb +12 -1
- data/lib/action_view/record_identifier.rb +22 -1
- data/lib/action_view/render_parser/prism_render_parser.rb +13 -1
- data/lib/action_view/render_parser/ripper_render_parser.rb +10 -1
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +5 -1
- data/lib/action_view/renderer/partial_renderer.rb +16 -0
- data/lib/action_view/renderer/streaming_template_renderer.rb +8 -2
- data/lib/action_view/rendering.rb +2 -3
- data/lib/action_view/structured_event_subscriber.rb +97 -0
- data/lib/action_view/template/error.rb +7 -3
- data/lib/action_view/template/handlers/erb/erubi.rb +1 -1
- data/lib/action_view/template/handlers/erb.rb +37 -12
- data/lib/action_view/template/raw_file.rb +4 -0
- data/lib/action_view/template/resolver.rb +0 -1
- data/lib/action_view/template.rb +9 -4
- data/lib/action_view/test_case.rb +50 -52
- data/lib/action_view.rb +3 -0
- metadata +14 -26
data/lib/action_view/template.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "thread"
|
|
4
3
|
require "delegate"
|
|
5
4
|
|
|
6
5
|
module ActionView
|
|
@@ -8,7 +7,7 @@ module ActionView
|
|
|
8
7
|
class Template
|
|
9
8
|
extend ActiveSupport::Autoload
|
|
10
9
|
|
|
11
|
-
STRICT_LOCALS_REGEX = /\#\s+locals:\s+\((
|
|
10
|
+
STRICT_LOCALS_REGEX = /\#\s+locals:\s+\((.*?)\)(?=\s*-?%>|\s*$)/m
|
|
12
11
|
|
|
13
12
|
# === Encodings in ActionView::Template
|
|
14
13
|
#
|
|
@@ -357,7 +356,7 @@ module ActionView
|
|
|
357
356
|
|
|
358
357
|
# This method is responsible for marking a template as having strict locals
|
|
359
358
|
# which means the template can only accept the locals defined in a magic
|
|
360
|
-
# comment. For example, if your template
|
|
359
|
+
# comment. For example, if your template accepts the locals +title+ and
|
|
361
360
|
# +comment_count+, add the following to your template file:
|
|
362
361
|
#
|
|
363
362
|
# <%# locals: (title: "Default title", comment_count: 0) %>
|
|
@@ -367,10 +366,16 @@ module ActionView
|
|
|
367
366
|
def strict_locals!
|
|
368
367
|
if @strict_locals == NONE
|
|
369
368
|
self.source.sub!(STRICT_LOCALS_REGEX, "")
|
|
370
|
-
@strict_locals = $1
|
|
369
|
+
@strict_locals = $1&.rstrip
|
|
371
370
|
|
|
372
371
|
return if @strict_locals.nil? # Magic comment not found
|
|
373
372
|
|
|
373
|
+
# Tag with the assumed encoding before encode! runs, same as
|
|
374
|
+
# encode! does for the source itself (see above).
|
|
375
|
+
if @strict_locals.encoding == Encoding::BINARY
|
|
376
|
+
@strict_locals.force_encoding(Encoding.default_external)
|
|
377
|
+
end
|
|
378
|
+
|
|
374
379
|
@strict_locals = "**nil" if @strict_locals.blank?
|
|
375
380
|
end
|
|
376
381
|
|
|
@@ -60,7 +60,56 @@ module ActionView
|
|
|
60
60
|
include ActiveSupport::Testing::ConstantLookup
|
|
61
61
|
|
|
62
62
|
delegate :lookup_context, to: :controller
|
|
63
|
-
attr_accessor :controller, :request, :output_buffer
|
|
63
|
+
attr_accessor :controller, :request, :output_buffer
|
|
64
|
+
|
|
65
|
+
# Returns the content rendered by the last +render+ call.
|
|
66
|
+
#
|
|
67
|
+
# The returned object behaves like a string but also exposes a number of methods
|
|
68
|
+
# that allows you to parse the content string in formats registered using
|
|
69
|
+
# <tt>.register_parser</tt>.
|
|
70
|
+
#
|
|
71
|
+
# By default includes the following parsers:
|
|
72
|
+
#
|
|
73
|
+
# +.html+
|
|
74
|
+
#
|
|
75
|
+
# Parse the <tt>rendered</tt> content String into HTML. By default, this means
|
|
76
|
+
# a <tt>Nokogiri::XML::Node</tt>.
|
|
77
|
+
#
|
|
78
|
+
# test "renders HTML" do
|
|
79
|
+
# article = Article.create!(title: "Hello, world")
|
|
80
|
+
#
|
|
81
|
+
# render partial: "articles/article", locals: { article: article }
|
|
82
|
+
#
|
|
83
|
+
# assert_pattern { rendered.html.at("main h1") => { content: "Hello, world" } }
|
|
84
|
+
# end
|
|
85
|
+
#
|
|
86
|
+
# To parse the rendered content into a <tt>Capybara::Simple::Node</tt>,
|
|
87
|
+
# re-register an <tt>:html</tt> parser with a call to
|
|
88
|
+
# <tt>Capybara.string</tt>:
|
|
89
|
+
#
|
|
90
|
+
# register_parser :html, -> rendered { Capybara.string(rendered) }
|
|
91
|
+
#
|
|
92
|
+
# test "renders HTML" do
|
|
93
|
+
# article = Article.create!(title: "Hello, world")
|
|
94
|
+
#
|
|
95
|
+
# render partial: article
|
|
96
|
+
#
|
|
97
|
+
# rendered.html.assert_css "h1", text: "Hello, world"
|
|
98
|
+
# end
|
|
99
|
+
#
|
|
100
|
+
# +.json+
|
|
101
|
+
#
|
|
102
|
+
# Parse the <tt>rendered</tt> content String into JSON. By default, this means
|
|
103
|
+
# a <tt>ActiveSupport::HashWithIndifferentAccess</tt>.
|
|
104
|
+
#
|
|
105
|
+
# test "renders JSON" do
|
|
106
|
+
# article = Article.create!(title: "Hello, world")
|
|
107
|
+
#
|
|
108
|
+
# render formats: :json, partial: "articles/article", locals: { article: article }
|
|
109
|
+
#
|
|
110
|
+
# assert_pattern { rendered.json => { title: "Hello, world" } }
|
|
111
|
+
# end
|
|
112
|
+
attr_accessor :rendered
|
|
64
113
|
|
|
65
114
|
module ClassMethods
|
|
66
115
|
def inherited(descendant) # :nodoc:
|
|
@@ -243,57 +292,6 @@ module ActionView
|
|
|
243
292
|
@_rendered_views ||= RenderedViewsCollection.new
|
|
244
293
|
end
|
|
245
294
|
|
|
246
|
-
##
|
|
247
|
-
# :method: rendered
|
|
248
|
-
#
|
|
249
|
-
# Returns the content rendered by the last +render+ call.
|
|
250
|
-
#
|
|
251
|
-
# The returned object behaves like a string but also exposes a number of methods
|
|
252
|
-
# that allows you to parse the content string in formats registered using
|
|
253
|
-
# <tt>.register_parser</tt>.
|
|
254
|
-
#
|
|
255
|
-
# By default includes the following parsers:
|
|
256
|
-
#
|
|
257
|
-
# +.html+
|
|
258
|
-
#
|
|
259
|
-
# Parse the <tt>rendered</tt> content String into HTML. By default, this means
|
|
260
|
-
# a <tt>Nokogiri::XML::Node</tt>.
|
|
261
|
-
#
|
|
262
|
-
# test "renders HTML" do
|
|
263
|
-
# article = Article.create!(title: "Hello, world")
|
|
264
|
-
#
|
|
265
|
-
# render partial: "articles/article", locals: { article: article }
|
|
266
|
-
#
|
|
267
|
-
# assert_pattern { rendered.html.at("main h1") => { content: "Hello, world" } }
|
|
268
|
-
# end
|
|
269
|
-
#
|
|
270
|
-
# To parse the rendered content into a <tt>Capybara::Simple::Node</tt>,
|
|
271
|
-
# re-register an <tt>:html</tt> parser with a call to
|
|
272
|
-
# <tt>Capybara.string</tt>:
|
|
273
|
-
#
|
|
274
|
-
# register_parser :html, -> rendered { Capybara.string(rendered) }
|
|
275
|
-
#
|
|
276
|
-
# test "renders HTML" do
|
|
277
|
-
# article = Article.create!(title: "Hello, world")
|
|
278
|
-
#
|
|
279
|
-
# render partial: article
|
|
280
|
-
#
|
|
281
|
-
# rendered.html.assert_css "h1", text: "Hello, world"
|
|
282
|
-
# end
|
|
283
|
-
#
|
|
284
|
-
# +.json+
|
|
285
|
-
#
|
|
286
|
-
# Parse the <tt>rendered</tt> content String into JSON. By default, this means
|
|
287
|
-
# a <tt>ActiveSupport::HashWithIndifferentAccess</tt>.
|
|
288
|
-
#
|
|
289
|
-
# test "renders JSON" do
|
|
290
|
-
# article = Article.create!(title: "Hello, world")
|
|
291
|
-
#
|
|
292
|
-
# render formats: :json, partial: "articles/article", locals: { article: article }
|
|
293
|
-
#
|
|
294
|
-
# assert_pattern { rendered.json => { title: "Hello, world" } }
|
|
295
|
-
# end
|
|
296
|
-
|
|
297
295
|
def _routes
|
|
298
296
|
@controller._routes if @controller.respond_to?(:_routes)
|
|
299
297
|
end
|
data/lib/action_view.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: actionview
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -15,28 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 8.1.3
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: cgi
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0'
|
|
33
|
-
type: :runtime
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0'
|
|
25
|
+
version: 8.1.3
|
|
40
26
|
- !ruby/object:Gem::Dependency
|
|
41
27
|
name: builder
|
|
42
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,28 +85,28 @@ dependencies:
|
|
|
99
85
|
requirements:
|
|
100
86
|
- - '='
|
|
101
87
|
- !ruby/object:Gem::Version
|
|
102
|
-
version:
|
|
88
|
+
version: 8.1.3
|
|
103
89
|
type: :development
|
|
104
90
|
prerelease: false
|
|
105
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
92
|
requirements:
|
|
107
93
|
- - '='
|
|
108
94
|
- !ruby/object:Gem::Version
|
|
109
|
-
version:
|
|
95
|
+
version: 8.1.3
|
|
110
96
|
- !ruby/object:Gem::Dependency
|
|
111
97
|
name: activemodel
|
|
112
98
|
requirement: !ruby/object:Gem::Requirement
|
|
113
99
|
requirements:
|
|
114
100
|
- - '='
|
|
115
101
|
- !ruby/object:Gem::Version
|
|
116
|
-
version:
|
|
102
|
+
version: 8.1.3
|
|
117
103
|
type: :development
|
|
118
104
|
prerelease: false
|
|
119
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
106
|
requirements:
|
|
121
107
|
- - '='
|
|
122
108
|
- !ruby/object:Gem::Version
|
|
123
|
-
version:
|
|
109
|
+
version: 8.1.3
|
|
124
110
|
description: Simple, battle-tested conventions and helpers for building web pages.
|
|
125
111
|
email: david@loudthinking.com
|
|
126
112
|
executables: []
|
|
@@ -140,6 +126,7 @@ files:
|
|
|
140
126
|
- lib/action_view/dependency_tracker.rb
|
|
141
127
|
- lib/action_view/dependency_tracker/erb_tracker.rb
|
|
142
128
|
- lib/action_view/dependency_tracker/ruby_tracker.rb
|
|
129
|
+
- lib/action_view/dependency_tracker/wildcard_resolver.rb
|
|
143
130
|
- lib/action_view/deprecator.rb
|
|
144
131
|
- lib/action_view/digestor.rb
|
|
145
132
|
- lib/action_view/flows.rb
|
|
@@ -229,6 +216,7 @@ files:
|
|
|
229
216
|
- lib/action_view/renderer/template_renderer.rb
|
|
230
217
|
- lib/action_view/rendering.rb
|
|
231
218
|
- lib/action_view/routing_url_for.rb
|
|
219
|
+
- lib/action_view/structured_event_subscriber.rb
|
|
232
220
|
- lib/action_view/tasks/cache_digests.rake
|
|
233
221
|
- lib/action_view/template.rb
|
|
234
222
|
- lib/action_view/template/error.rb
|
|
@@ -259,10 +247,10 @@ licenses:
|
|
|
259
247
|
- MIT
|
|
260
248
|
metadata:
|
|
261
249
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
262
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
|
263
|
-
documentation_uri: https://api.rubyonrails.org/
|
|
250
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.1.3/actionview/CHANGELOG.md
|
|
251
|
+
documentation_uri: https://api.rubyonrails.org/v8.1.3/
|
|
264
252
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
265
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
|
253
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.1.3/actionview
|
|
266
254
|
rubygems_mfa_required: 'true'
|
|
267
255
|
rdoc_options: []
|
|
268
256
|
require_paths:
|
|
@@ -271,7 +259,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
271
259
|
requirements:
|
|
272
260
|
- - ">="
|
|
273
261
|
- !ruby/object:Gem::Version
|
|
274
|
-
version: 3.
|
|
262
|
+
version: 3.2.0
|
|
275
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
276
264
|
requirements:
|
|
277
265
|
- - ">="
|
|
@@ -279,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
279
267
|
version: '0'
|
|
280
268
|
requirements:
|
|
281
269
|
- none
|
|
282
|
-
rubygems_version:
|
|
270
|
+
rubygems_version: 4.0.6
|
|
283
271
|
specification_version: 4
|
|
284
272
|
summary: Rendering framework putting the V in MVC (part of Rails).
|
|
285
273
|
test_files: []
|