actionview 7.2.4 → 8.0.5.2
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 +127 -113
- data/lib/action_view/dependency_tracker/erb_tracker.rb +36 -27
- 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 +1 -0
- data/lib/action_view/gem_version.rb +4 -4
- 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/date_helper.rb +3 -3
- data/lib/action_view/helpers/form_helper.rb +76 -75
- data/lib/action_view/helpers/form_options_helper.rb +25 -22
- data/lib/action_view/helpers/form_tag_helper.rb +20 -17
- data/lib/action_view/helpers/rendering_helper.rb +160 -50
- data/lib/action_view/helpers/sanitize_helper.rb +12 -1
- data/lib/action_view/helpers/tag_helper.rb +39 -43
- data/lib/action_view/helpers/tags/base.rb +11 -9
- data/lib/action_view/helpers/tags/check_box.rb +2 -2
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +4 -3
- data/lib/action_view/helpers/tags/file_field.rb +4 -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_renderer.rb +1 -1
- 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/text_helper.rb +23 -7
- data/lib/action_view/helpers/url_helper.rb +2 -4
- data/lib/action_view/layouts.rb +1 -1
- data/lib/action_view/record_identifier.rb +1 -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/streaming_template_renderer.rb +8 -2
- data/lib/action_view/rendering.rb +2 -3
- data/lib/action_view/template/handlers/erb/erubi.rb +1 -1
- 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 +7 -2
- metadata +18 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e3471ef52672292ca9950c0497300061713104fb75abdef2eaa69c392dce1e3
|
|
4
|
+
data.tar.gz: 1d2084723d63c509f943eb60763e877fa0f3a0ef4926142ffdda8f40fae7b05a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ba7329d06db4fc19fbd97773acbe78a9355a8d6977067d7a4d08c088eaa39d35c8574ebedce3b83955583fd82d6694b503b2383ab870dfd3504506ea2b88bfb
|
|
7
|
+
data.tar.gz: 27c64c7e736a6ce282011a1e61230856d40a191fb7cce7f6a3095570ad9c309c6b25dbfc5241156ea9214f063f5d5da16eeae2e8e62f1f673365df6db5af7683
|
data/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,94 @@
|
|
|
1
|
-
## Rails
|
|
1
|
+
## Rails 8.0.5.2 (November 03, 2026) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Skip attribute names in tag helpers that are blank once converted to a
|
|
4
|
+
string.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A Symbol such as `:" "` is not blank, because `Symbol#blank?` is
|
|
7
|
+
`Symbol#empty?`, so it reached the escaping step and produced an attribute
|
|
8
|
+
with no name. The asset helpers symbolize their keys, so an ordinary String
|
|
9
|
+
key reached the same place.
|
|
10
|
+
|
|
11
|
+
[GHSA-68p9-83h6-5wpj]
|
|
12
|
+
|
|
13
|
+
*Mike Dalessio*
|
|
14
|
+
|
|
15
|
+
* Fix `strip_tags` to encode `"` and `'` in its output.
|
|
16
|
+
|
|
17
|
+
`strip_tags` returns an `html_safe` string, but was not encoding quotation
|
|
18
|
+
marks. The method now encodes all five HTML-significant characters (`&`,
|
|
19
|
+
`<`, `>`, `"`, `'`), consistent with the existing `html_safe` convention.
|
|
20
|
+
|
|
21
|
+
Output used outside HTML, such as in a text template or JSON, now contains
|
|
22
|
+
`"` and `'` where it contained `"` and `'`. `CGI.unescapeHTML`
|
|
23
|
+
decodes them.
|
|
24
|
+
|
|
25
|
+
[GHSA-rq8q-p985-fjq7]
|
|
26
|
+
|
|
27
|
+
*Mike Dalessio*
|
|
28
|
+
|
|
29
|
+
* Escape the matched phrase before substituting it into `highlight`'s
|
|
30
|
+
`:highlighter`.
|
|
31
|
+
|
|
32
|
+
A match was copied into each `\1` of the highlighter as it appeared in
|
|
33
|
+
the sanitized text, which keeps `"` and `'` as they are, so a match
|
|
34
|
+
containing a quote ended a quoted attribute value such as the
|
|
35
|
+
documented `'<a href="search?q=\1">\1</a>'` and added attributes of
|
|
36
|
+
its own. Each substituted group now goes through
|
|
37
|
+
`ERB::Util.html_escape_once`, so quotes in a match render as `"`
|
|
38
|
+
and `'`. Only the numbered placeholders `\0` to `\9` are expanded,
|
|
39
|
+
and a match never replaces the `>` that closes a tag.
|
|
6
40
|
|
|
41
|
+
[GHSA-v6rj-xm57-3p59]
|
|
7
42
|
|
|
8
|
-
|
|
43
|
+
*Jeremy Daer*
|
|
44
|
+
|
|
45
|
+
* Require rails-html-sanitizer 1.7.2 or later.
|
|
46
|
+
|
|
47
|
+
With the HTML5 sanitizer, Nokogiri before 1.19.5 left `<` and `>`
|
|
48
|
+
unescaped in attribute values. `highlight` and `simple_format`, which
|
|
49
|
+
edit the sanitized HTML as a string, could then turn markup inside an
|
|
50
|
+
attribute value into live elements. rails-html-sanitizer 1.7.2 requires
|
|
51
|
+
Loofah 2.25.3, which requires Nokogiri 1.19.5.
|
|
52
|
+
|
|
53
|
+
[GHSA-2p2f-4rq4-gjwc]
|
|
54
|
+
|
|
55
|
+
*Mike Dalessio*
|
|
56
|
+
|
|
57
|
+
## Rails 8.0.5.1 (July 29, 2026) ##
|
|
9
58
|
|
|
10
59
|
* No changes.
|
|
11
60
|
|
|
12
61
|
|
|
13
|
-
## Rails
|
|
62
|
+
## Rails 8.0.5 (March 24, 2026) ##
|
|
63
|
+
|
|
64
|
+
* Fix encoding errors for string locals containing non-ASCII characters.
|
|
65
|
+
|
|
66
|
+
*Kataoka Katsuki*
|
|
67
|
+
|
|
68
|
+
* Fix collection caching to only forward `expires_in` argument if explicitly set.
|
|
69
|
+
|
|
70
|
+
*Pieter Visser*
|
|
71
|
+
|
|
72
|
+
* Fix `file_field` to join mime types with a comma when provided as Array
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
file_field(:article, :image, accept: ['image/png', 'image/gif', 'image/jpeg'])
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Now behaves likes:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
file_field(:article, :image, accept: 'image/png,image/gif,image/jpeg')
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
*Bogdan Gusiev*
|
|
85
|
+
|
|
86
|
+
* Fix strict locals parsing to handle multiline definitions.
|
|
87
|
+
|
|
88
|
+
*Said Kaldybaev*
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Rails 8.0.4.1 (March 23, 2026) ##
|
|
14
92
|
|
|
15
93
|
* Skip blank attribute names in tag helpers to avoid generating invalid HTML.
|
|
16
94
|
|
|
@@ -19,7 +97,18 @@
|
|
|
19
97
|
*Mike Dalessio*
|
|
20
98
|
|
|
21
99
|
|
|
22
|
-
## Rails
|
|
100
|
+
## Rails 8.0.4 (October 28, 2025) ##
|
|
101
|
+
|
|
102
|
+
* Restore `add_default_name_and_id` method.
|
|
103
|
+
|
|
104
|
+
*Hartley McGuire*
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## Rails 8.0.3 (September 22, 2025) ##
|
|
108
|
+
|
|
109
|
+
* Fix label with `for` option not getting prefixed by form `namespace` value
|
|
110
|
+
|
|
111
|
+
*Abeid Ahmed*, *Hartley McGuire*
|
|
23
112
|
|
|
24
113
|
* Fix `javascript_include_tag` `type` option to accept either strings and symbols.
|
|
25
114
|
|
|
@@ -28,7 +117,7 @@
|
|
|
28
117
|
javascript_include_tag "application", type: "module"
|
|
29
118
|
```
|
|
30
119
|
|
|
31
|
-
Previously, only the string value was
|
|
120
|
+
Previously, only the string value was recognized.
|
|
32
121
|
|
|
33
122
|
*Jean Boussier*
|
|
34
123
|
|
|
@@ -36,6 +125,14 @@
|
|
|
36
125
|
|
|
37
126
|
*Jonathan Hefner*
|
|
38
127
|
|
|
128
|
+
|
|
129
|
+
## Rails 8.0.2.1 (August 13, 2025) ##
|
|
130
|
+
|
|
131
|
+
* No changes.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
|
135
|
+
|
|
39
136
|
* Respect `html_options[:form]` when `collection_checkboxes` generates the
|
|
40
137
|
hidden `<input>`.
|
|
41
138
|
|
|
@@ -69,6 +166,8 @@
|
|
|
69
166
|
|
|
70
167
|
*Jean Boussier*
|
|
71
168
|
|
|
169
|
+
## Rails 8.0.1 (December 13, 2024) ##
|
|
170
|
+
|
|
72
171
|
* Fix a crash in ERB template error highlighting when the error occurs on a
|
|
73
172
|
line in the compiled template that is past the end of the source template.
|
|
74
173
|
|
|
@@ -81,141 +180,56 @@
|
|
|
81
180
|
*Martin Emde*
|
|
82
181
|
|
|
83
182
|
|
|
84
|
-
## Rails
|
|
183
|
+
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
85
184
|
|
|
86
185
|
* No changes.
|
|
87
186
|
|
|
88
187
|
|
|
89
|
-
## Rails
|
|
188
|
+
## Rails 8.0.0 (November 07, 2024) ##
|
|
90
189
|
|
|
91
190
|
* No changes.
|
|
92
191
|
|
|
93
192
|
|
|
94
|
-
## Rails
|
|
193
|
+
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
|
95
194
|
|
|
96
195
|
* No changes.
|
|
97
196
|
|
|
98
197
|
|
|
99
|
-
## Rails
|
|
100
|
-
|
|
101
|
-
* No changes.
|
|
198
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
|
102
199
|
|
|
200
|
+
* Remove deprecated support to passing a content to void tag elements on the `tag` builder.
|
|
103
201
|
|
|
104
|
-
|
|
202
|
+
*Rafael Mendonça França*
|
|
105
203
|
|
|
106
|
-
*
|
|
204
|
+
* Remove deprecated support to passing `nil` to the `model:` argument of `form_with`.
|
|
107
205
|
|
|
108
|
-
|
|
109
|
-
## Rails 7.2.1 (August 22, 2024) ##
|
|
110
|
-
|
|
111
|
-
* No changes.
|
|
206
|
+
*Rafael Mendonça França*
|
|
112
207
|
|
|
113
208
|
|
|
114
|
-
## Rails
|
|
209
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
115
210
|
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
Previously templates defining strict locals wouldn't receive the `local_assigns`
|
|
119
|
-
hash.
|
|
120
|
-
|
|
121
|
-
*Jean Boussier*
|
|
122
|
-
|
|
123
|
-
* Add queries count to template rendering instrumentation.
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
# Before
|
|
127
|
-
Completed 200 OK in 3804ms (Views: 41.0ms | ActiveRecord: 33.5ms | Allocations: 112788)
|
|
211
|
+
* Enable DependencyTracker to evaluate renders with trailing interpolation.
|
|
128
212
|
|
|
129
|
-
|
|
130
|
-
|
|
213
|
+
```erb
|
|
214
|
+
<%= render "maintenance_tasks/runs/info/#{run.status}" %>
|
|
131
215
|
```
|
|
132
216
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
*Sean Doyle*
|
|
138
|
-
|
|
139
|
-
* Add the `nonce: true` option for `stylesheet_link_tag` helper to support automatic nonce generation for Content Security Policy.
|
|
140
|
-
|
|
141
|
-
Works the same way as `javascript_include_tag nonce: true` does.
|
|
142
|
-
|
|
143
|
-
*Akhil G Krishnan*, *AJ Esler*
|
|
144
|
-
|
|
145
|
-
* Parse `ActionView::TestCase#rendered` HTML content as `Nokogiri::XML::DocumentFragment` instead of `Nokogiri::XML::Document`.
|
|
146
|
-
|
|
147
|
-
*Sean Doyle*
|
|
148
|
-
|
|
149
|
-
* Rename `ActionView::TestCase::Behavior::Content` to `ActionView::TestCase::Behavior::RenderedViewContent`.
|
|
150
|
-
|
|
151
|
-
Make `RenderedViewContent` inherit from `String`. Make private API with `:nodoc:`
|
|
152
|
-
|
|
153
|
-
*Sean Doyle*
|
|
154
|
-
|
|
155
|
-
* Deprecate passing `nil` as value for the `model:` argument to the `form_with` method.
|
|
156
|
-
|
|
157
|
-
*Collin Jilbert*
|
|
158
|
-
|
|
159
|
-
* Alias `field_set_tag` helper to `fieldset_tag` to match `<fieldset>` element.
|
|
160
|
-
|
|
161
|
-
*Sean Doyle*
|
|
162
|
-
|
|
163
|
-
* Deprecate passing content to void elements when using `tag.br` type tag builders.
|
|
217
|
+
Previously, the DependencyTracker would ignore this render, but now it will
|
|
218
|
+
mark all partials in the "maintenance_tasks/runs/info" folder as
|
|
219
|
+
dependencies.
|
|
164
220
|
|
|
165
221
|
*Hartley McGuire*
|
|
166
222
|
|
|
167
|
-
*
|
|
168
|
-
|
|
169
|
-
*Earlopain*
|
|
223
|
+
* Rename `text_area` methods into `textarea`
|
|
170
224
|
|
|
171
|
-
|
|
225
|
+
Old names are still available as aliases.
|
|
172
226
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
Now they are only passed if the template will actually accept them.
|
|
176
|
-
|
|
177
|
-
*Yasha Krasnou*, *Jean Boussier*
|
|
178
|
-
|
|
179
|
-
* Fix `@rails/ujs` calling `start()` an extra time when using bundlers.
|
|
180
|
-
|
|
181
|
-
*Hartley McGuire*, *Ryunosuke Sato*
|
|
227
|
+
*Sean Doyle*
|
|
182
228
|
|
|
183
|
-
*
|
|
229
|
+
* Rename `check_box*` methods into `checkbox*`.
|
|
184
230
|
|
|
185
|
-
|
|
186
|
-
it would instead return the entire buffer.
|
|
231
|
+
Old names are still available as aliases.
|
|
187
232
|
|
|
188
233
|
*Jean Boussier*
|
|
189
234
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
This fix was already landed in >= 7.0.4.3, < 7.1.0.
|
|
193
|
-
[[CVE-2023-23913](https://github.com/advisories/GHSA-xp5h-f8jf-rc8q)]
|
|
194
|
-
|
|
195
|
-
*Ryunosuke Sato*
|
|
196
|
-
|
|
197
|
-
* Added validation for HTML tag names in the `tag` and `content_tag` helper method.
|
|
198
|
-
|
|
199
|
-
The `tag` and `content_tag` method now checks that the provided tag name adheres to the HTML
|
|
200
|
-
specification. If an invalid HTML tag name is provided, the method raises an `ArgumentError`
|
|
201
|
-
with an appropriate error message.
|
|
202
|
-
|
|
203
|
-
Examples:
|
|
204
|
-
|
|
205
|
-
```ruby
|
|
206
|
-
# Raises ArgumentError: Invalid HTML5 tag name: 12p
|
|
207
|
-
content_tag("12p") # Starting with a number
|
|
208
|
-
|
|
209
|
-
# Raises ArgumentError: Invalid HTML5 tag name: ""
|
|
210
|
-
content_tag("") # Empty tag name
|
|
211
|
-
|
|
212
|
-
# Raises ArgumentError: Invalid HTML5 tag name: div/
|
|
213
|
-
tag("div/") # Contains a solidus
|
|
214
|
-
|
|
215
|
-
# Raises ArgumentError: Invalid HTML5 tag name: "image file"
|
|
216
|
-
tag("image file") # Contains a space
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
*Akhil G Krishnan*
|
|
220
|
-
|
|
221
|
-
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionview/CHANGELOG.md) for previous changes.
|
|
235
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionview/CHANGELOG.md) for previous changes.
|
|
@@ -74,7 +74,7 @@ module ActionView
|
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def dependencies
|
|
77
|
-
render_dependencies + explicit_dependencies
|
|
77
|
+
WildcardResolver.new(@view_paths, render_dependencies + explicit_dependencies).resolve
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
attr_reader :name, :template
|
|
@@ -90,15 +90,15 @@ module ActionView
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def render_dependencies
|
|
93
|
-
|
|
93
|
+
dependencies = []
|
|
94
94
|
render_calls = source.split(/\brender\b/).drop(1)
|
|
95
95
|
|
|
96
96
|
render_calls.each do |arguments|
|
|
97
|
-
add_dependencies(
|
|
98
|
-
add_dependencies(
|
|
97
|
+
add_dependencies(dependencies, arguments, LAYOUT_DEPENDENCY)
|
|
98
|
+
add_dependencies(dependencies, arguments, RENDER_ARGUMENTS)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
dependencies
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
def add_dependencies(render_dependencies, arguments, pattern)
|
|
@@ -116,12 +116,37 @@ module ActionView
|
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
def add_static_dependency(dependencies, dependency, quote_type)
|
|
119
|
-
if quote_type == '"'
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
if quote_type == '"' && dependency.include?('#{')
|
|
120
|
+
scanner = StringScanner.new(dependency)
|
|
121
|
+
|
|
122
|
+
wildcard_dependency = +""
|
|
123
|
+
|
|
124
|
+
while !scanner.eos?
|
|
125
|
+
if scanner.scan_until(/\#{/)
|
|
126
|
+
unmatched_brackets = 1
|
|
127
|
+
wildcard_dependency << scanner.pre_match
|
|
128
|
+
|
|
129
|
+
while unmatched_brackets > 0 && !scanner.eos?
|
|
130
|
+
found = scanner.scan_until(/[{}]/)
|
|
131
|
+
return unless found
|
|
132
|
+
|
|
133
|
+
case scanner.matched
|
|
134
|
+
when "{"
|
|
135
|
+
unmatched_brackets += 1
|
|
136
|
+
when "}"
|
|
137
|
+
unmatched_brackets -= 1
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
wildcard_dependency << "*"
|
|
142
|
+
else
|
|
143
|
+
wildcard_dependency << scanner.rest
|
|
144
|
+
scanner.terminate
|
|
145
|
+
end
|
|
146
|
+
end
|
|
123
147
|
|
|
124
|
-
|
|
148
|
+
dependencies << wildcard_dependency
|
|
149
|
+
elsif dependency
|
|
125
150
|
if dependency.include?("/")
|
|
126
151
|
dependencies << dependency
|
|
127
152
|
else
|
|
@@ -130,24 +155,8 @@ module ActionView
|
|
|
130
155
|
end
|
|
131
156
|
end
|
|
132
157
|
|
|
133
|
-
def resolve_directories(wildcard_dependencies)
|
|
134
|
-
return [] unless @view_paths
|
|
135
|
-
return [] if wildcard_dependencies.empty?
|
|
136
|
-
|
|
137
|
-
# Remove trailing "/*"
|
|
138
|
-
prefixes = wildcard_dependencies.map { |query| query[0..-3] }
|
|
139
|
-
|
|
140
|
-
@view_paths.flat_map(&:all_template_paths).uniq.filter_map { |path|
|
|
141
|
-
path.to_s if prefixes.include?(path.prefix)
|
|
142
|
-
}.sort
|
|
143
|
-
end
|
|
144
|
-
|
|
145
158
|
def explicit_dependencies
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
wildcards, explicits = dependencies.partition { |dependency| dependency.end_with?("/*") }
|
|
149
|
-
|
|
150
|
-
(explicits + resolve_directories(wildcards)).uniq
|
|
159
|
+
source.scan(EXPLICIT_DEPENDENCY).flatten.uniq
|
|
151
160
|
end
|
|
152
161
|
end
|
|
153
162
|
end
|
|
@@ -10,7 +10,7 @@ module ActionView
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def dependencies
|
|
13
|
-
render_dependencies + explicit_dependencies
|
|
13
|
+
WildcardResolver.new(view_paths, render_dependencies + explicit_dependencies).resolve
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def self.supports_view_paths? # :nodoc:
|
|
@@ -31,29 +31,12 @@ module ActionView
|
|
|
31
31
|
compiled_source = template.handler.call(template, template.source)
|
|
32
32
|
|
|
33
33
|
@parser_class.new(@name, compiled_source).render_calls.filter_map do |render_call|
|
|
34
|
-
next if render_call.end_with?("/_")
|
|
35
34
|
render_call.gsub(%r|/_|, "/")
|
|
36
35
|
end
|
|
37
36
|
end
|
|
38
37
|
|
|
39
38
|
def explicit_dependencies
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
wildcards, explicits = dependencies.partition { |dependency| dependency.end_with?("/*") }
|
|
43
|
-
|
|
44
|
-
(explicits + resolve_directories(wildcards)).uniq
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def resolve_directories(wildcard_dependencies)
|
|
48
|
-
return [] unless view_paths
|
|
49
|
-
return [] if wildcard_dependencies.empty?
|
|
50
|
-
|
|
51
|
-
# Remove trailing "/*"
|
|
52
|
-
prefixes = wildcard_dependencies.map { |query| query[0..-3] }
|
|
53
|
-
|
|
54
|
-
view_paths.flat_map(&:all_template_paths).uniq.filter_map { |path|
|
|
55
|
-
path.to_s if prefixes.include?(path.prefix)
|
|
56
|
-
}.sort
|
|
39
|
+
template.source.scan(EXPLICIT_DEPENDENCY).flatten.uniq
|
|
57
40
|
end
|
|
58
41
|
end
|
|
59
42
|
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ActionView
|
|
4
|
+
class DependencyTracker # :nodoc:
|
|
5
|
+
class WildcardResolver # :nodoc:
|
|
6
|
+
def initialize(view_paths, dependencies)
|
|
7
|
+
@view_paths = view_paths
|
|
8
|
+
|
|
9
|
+
@wildcard_dependencies, @explicit_dependencies =
|
|
10
|
+
dependencies.partition { |dependency| dependency.end_with?("/*") }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def resolve
|
|
14
|
+
return explicit_dependencies.uniq if !view_paths || wildcard_dependencies.empty?
|
|
15
|
+
|
|
16
|
+
(explicit_dependencies + resolved_wildcard_dependencies).uniq
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
attr_reader :explicit_dependencies, :wildcard_dependencies, :view_paths
|
|
21
|
+
|
|
22
|
+
def resolved_wildcard_dependencies
|
|
23
|
+
# Remove trailing "/*"
|
|
24
|
+
prefixes = wildcard_dependencies.map { |query| query[0..-3] }
|
|
25
|
+
|
|
26
|
+
view_paths.flat_map(&:all_template_paths).uniq.filter_map { |path|
|
|
27
|
+
path.to_s if prefixes.include?(path.prefix)
|
|
28
|
+
}.sort
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -93,6 +93,14 @@ module ActionView
|
|
|
93
93
|
# render partial: 'attachments/attachment', collection: group_of_attachments
|
|
94
94
|
# render partial: 'documents/document', collection: @project.documents.where(published: true).order('created_at')
|
|
95
95
|
#
|
|
96
|
+
# One last type of dependency can be determined implicitly:
|
|
97
|
+
#
|
|
98
|
+
# render "maintenance_tasks/runs/info/#{run.status}"
|
|
99
|
+
#
|
|
100
|
+
# Because the value passed to render ends in interpolation, Action View
|
|
101
|
+
# will mark all partials within the "maintenance_tasks/runs/info" folder as
|
|
102
|
+
# dependencies.
|
|
103
|
+
#
|
|
96
104
|
# === Explicit dependencies
|
|
97
105
|
#
|
|
98
106
|
# Sometimes you'll have template dependencies that can't be derived at all. This is typically
|
|
@@ -1235,7 +1235,7 @@ module ActionView
|
|
|
1235
1235
|
class FormBuilder
|
|
1236
1236
|
# Wraps ActionView::Helpers::DateHelper#date_select for form builders:
|
|
1237
1237
|
#
|
|
1238
|
-
# <%=
|
|
1238
|
+
# <%= form_with model: @person do |f| %>
|
|
1239
1239
|
# <%= f.date_select :birth_date %>
|
|
1240
1240
|
# <%= f.submit %>
|
|
1241
1241
|
# <% end %>
|
|
@@ -1247,7 +1247,7 @@ module ActionView
|
|
|
1247
1247
|
|
|
1248
1248
|
# Wraps ActionView::Helpers::DateHelper#time_select for form builders:
|
|
1249
1249
|
#
|
|
1250
|
-
# <%=
|
|
1250
|
+
# <%= form_with model: @race do |f| %>
|
|
1251
1251
|
# <%= f.time_select :average_lap %>
|
|
1252
1252
|
# <%= f.submit %>
|
|
1253
1253
|
# <% end %>
|
|
@@ -1259,7 +1259,7 @@ module ActionView
|
|
|
1259
1259
|
|
|
1260
1260
|
# Wraps ActionView::Helpers::DateHelper#datetime_select for form builders:
|
|
1261
1261
|
#
|
|
1262
|
-
# <%=
|
|
1262
|
+
# <%= form_with model: @person do |f| %>
|
|
1263
1263
|
# <%= f.datetime_select :last_request_at %>
|
|
1264
1264
|
# <%= f.submit %>
|
|
1265
1265
|
# <% end %>
|