actionview 7.2.2.2 → 8.0.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 +69 -78
- data/README.rdoc +1 -1
- data/lib/action_view/base.rb +6 -9
- 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/digestor.rb +6 -2
- data/lib/action_view/gem_version.rb +4 -4
- data/lib/action_view/helpers/asset_tag_helper.rb +2 -2
- data/lib/action_view/helpers/atom_feed_helper.rb +1 -3
- data/lib/action_view/helpers/cache_helper.rb +10 -2
- data/lib/action_view/helpers/date_helper.rb +11 -4
- data/lib/action_view/helpers/form_helper.rb +104 -103
- data/lib/action_view/helpers/form_options_helper.rb +31 -25
- data/lib/action_view/helpers/form_tag_helper.rb +20 -17
- data/lib/action_view/helpers/output_safety_helper.rb +1 -2
- 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 +26 -39
- data/lib/action_view/helpers/tags/base.rb +9 -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/collection_helpers.rb +2 -1
- data/lib/action_view/helpers/tags/file_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_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 +10 -3
- data/lib/action_view/helpers/url_helper.rb +2 -4
- data/lib/action_view/layouts.rb +7 -7
- 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.rb +2 -2
- data/lib/action_view/renderer/streaming_template_renderer.rb +8 -2
- data/lib/action_view/renderer/template_renderer.rb +3 -3
- data/lib/action_view/rendering.rb +2 -3
- data/lib/action_view/template/error.rb +11 -0
- data/lib/action_view/template/handlers/erb/erubi.rb +1 -1
- data/lib/action_view/template/handlers/erb.rb +45 -37
- 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 +1 -2
- data/lib/action_view/test_case.rb +0 -1
- data/lib/action_view.rb +1 -0
- metadata +12 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d906f994cc2a7151f2763ccfd5505479b2ba0dd408797b28716d495b4ec89089
|
|
4
|
+
data.tar.gz: 10cb316f59e90d20729c7f61ec92c0e3b6b28e359ea13b2692736e5ffbe7e7a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a845f01c731db0f215c2a7d29888924fa1e50d3c68a17e1ed37e6dd746aa47a3250c7018d6d66639fc9ef7039f0b6d64234110edd310870bdae2074932044356
|
|
7
|
+
data.tar.gz: be07fd924f900d3d8c537652678d941fed5ea46ff657197e2182fdbaf4554923a1f1c41e27873735911a85b7a4d5819c330b35ceacefa90ca542c04e9b6053a8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,138 +1,129 @@
|
|
|
1
|
-
## Rails
|
|
2
|
-
|
|
3
|
-
* No changes.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Rails 7.2.2.1 (December 10, 2024) ##
|
|
7
|
-
|
|
8
|
-
* No changes.
|
|
1
|
+
## Rails 8.0.3 (September 22, 2025) ##
|
|
9
2
|
|
|
3
|
+
* Fix label with `for` option not getting prefixed by form `namespace` value
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* No changes.
|
|
5
|
+
*Abeid Ahmed*, *Hartley McGuire*
|
|
14
6
|
|
|
7
|
+
* Fix `javascript_include_tag` `type` option to accept either strings and symbols.
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
```ruby
|
|
10
|
+
javascript_include_tag "application", type: :module
|
|
11
|
+
javascript_include_tag "application", type: "module"
|
|
12
|
+
```
|
|
17
13
|
|
|
18
|
-
|
|
14
|
+
Previously, only the string value was recognized.
|
|
19
15
|
|
|
16
|
+
*Jean Boussier*
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
* Fix `excerpt` helper with non-whitespace separator.
|
|
22
19
|
|
|
23
|
-
*
|
|
20
|
+
*Jonathan Hefner*
|
|
24
21
|
|
|
25
22
|
|
|
26
|
-
## Rails
|
|
23
|
+
## Rails 8.0.2.1 (August 13, 2025) ##
|
|
27
24
|
|
|
28
25
|
* No changes.
|
|
29
26
|
|
|
30
27
|
|
|
31
|
-
## Rails
|
|
28
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
|
32
29
|
|
|
33
|
-
*
|
|
30
|
+
* Respect `html_options[:form]` when `collection_checkboxes` generates the
|
|
31
|
+
hidden `<input>`.
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
hash.
|
|
33
|
+
*Riccardo Odone*
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
* Layouts have access to local variables passed to `render`.
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
This fixes #31680 which was a regression in Rails 5.1.
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
# Before
|
|
44
|
-
Completed 200 OK in 3804ms (Views: 41.0ms | ActiveRecord: 33.5ms | Allocations: 112788)
|
|
39
|
+
*Mike Dalessio*
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```
|
|
41
|
+
* Argument errors related to strict locals in templates now raise an
|
|
42
|
+
`ActionView::StrictLocalsError`, and all other argument errors are reraised as-is.
|
|
49
43
|
|
|
50
|
-
|
|
44
|
+
Previously, any `ArgumentError` raised during template rendering was swallowed during strict
|
|
45
|
+
local error handling, so that an `ArgumentError` unrelated to strict locals (e.g., a helper
|
|
46
|
+
method invoked with incorrect arguments) would be replaced by a similar `ArgumentError` with an
|
|
47
|
+
unrelated backtrace, making it difficult to debug templates.
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
Now, any `ArgumentError` unrelated to strict locals is reraised, preserving the original
|
|
50
|
+
backtrace for developers.
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
Also note that `ActionView::StrictLocalsError` is a subclass of `ArgumentError`, so any existing
|
|
53
|
+
code that rescues `ArgumentError` will continue to work.
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
Fixes #52227.
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
*Mike Dalessio*
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
* Fix stack overflow error in dependency tracker when dealing with circular dependencies
|
|
61
60
|
|
|
62
|
-
*
|
|
61
|
+
*Jean Boussier*
|
|
63
62
|
|
|
64
|
-
|
|
63
|
+
## Rails 8.0.1 (December 13, 2024) ##
|
|
65
64
|
|
|
66
|
-
*
|
|
65
|
+
* Fix a crash in ERB template error highlighting when the error occurs on a
|
|
66
|
+
line in the compiled template that is past the end of the source template.
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
*Martin Emde*
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
* Improve reliability of ERB template error highlighting.
|
|
71
|
+
Fix infinite loops and crashes in highlighting and
|
|
72
|
+
improve tolerance for alternate ERB handlers.
|
|
71
73
|
|
|
72
|
-
*
|
|
74
|
+
*Martin Emde*
|
|
73
75
|
|
|
74
|
-
*Collin Jilbert*
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
* No changes.
|
|
79
80
|
|
|
80
|
-
* Deprecate passing content to void elements when using `tag.br` type tag builders.
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
## Rails 8.0.0 (November 07, 2024) ##
|
|
83
83
|
|
|
84
|
-
*
|
|
84
|
+
* No changes.
|
|
85
85
|
|
|
86
|
-
*Earlopain*
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
* No changes.
|
|
91
90
|
|
|
92
|
-
Now they are only passed if the template will actually accept them.
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
|
95
93
|
|
|
96
|
-
*
|
|
94
|
+
* Remove deprecated support to passing a content to void tag elements on the `tag` builder.
|
|
97
95
|
|
|
98
|
-
*
|
|
96
|
+
*Rafael Mendonça França*
|
|
99
97
|
|
|
100
|
-
*
|
|
98
|
+
* Remove deprecated support to passing `nil` to the `model:` argument of `form_with`.
|
|
101
99
|
|
|
102
|
-
|
|
103
|
-
it would instead return the entire buffer.
|
|
100
|
+
*Rafael Mendonça França*
|
|
104
101
|
|
|
105
|
-
*Jean Boussier*
|
|
106
102
|
|
|
107
|
-
|
|
103
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
108
104
|
|
|
109
|
-
|
|
110
|
-
[[CVE-2023-23913](https://github.com/advisories/GHSA-xp5h-f8jf-rc8q)]
|
|
105
|
+
* Enable DependencyTracker to evaluate renders with trailing interpolation.
|
|
111
106
|
|
|
112
|
-
|
|
107
|
+
```erb
|
|
108
|
+
<%= render "maintenance_tasks/runs/info/#{run.status}" %>
|
|
109
|
+
```
|
|
113
110
|
|
|
114
|
-
|
|
111
|
+
Previously, the DependencyTracker would ignore this render, but now it will
|
|
112
|
+
mark all partials in the "maintenance_tasks/runs/info" folder as
|
|
113
|
+
dependencies.
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
specification. If an invalid HTML tag name is provided, the method raises an `ArgumentError`
|
|
118
|
-
with an appropriate error message.
|
|
115
|
+
*Hartley McGuire*
|
|
119
116
|
|
|
120
|
-
|
|
117
|
+
* Rename `text_area` methods into `textarea`
|
|
121
118
|
|
|
122
|
-
|
|
123
|
-
# Raises ArgumentError: Invalid HTML5 tag name: 12p
|
|
124
|
-
content_tag("12p") # Starting with a number
|
|
119
|
+
Old names are still available as aliases.
|
|
125
120
|
|
|
126
|
-
|
|
127
|
-
content_tag("") # Empty tag name
|
|
121
|
+
*Sean Doyle*
|
|
128
122
|
|
|
129
|
-
|
|
130
|
-
tag("div/") # Contains a solidus
|
|
123
|
+
* Rename `check_box*` methods into `checkbox*`.
|
|
131
124
|
|
|
132
|
-
|
|
133
|
-
tag("image file") # Contains a space
|
|
134
|
-
```
|
|
125
|
+
Old names are still available as aliases.
|
|
135
126
|
|
|
136
|
-
*
|
|
127
|
+
*Jean Boussier*
|
|
137
128
|
|
|
138
|
-
Please check [7-
|
|
129
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionview/CHANGELOG.md) for previous changes.
|
data/README.rdoc
CHANGED
|
@@ -35,6 +35,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
|
|
|
35
35
|
|
|
36
36
|
* https://github.com/rails/rails/issues
|
|
37
37
|
|
|
38
|
-
Feature requests should be discussed on the
|
|
38
|
+
Feature requests should be discussed on the rubyonrails-core forum here:
|
|
39
39
|
|
|
40
40
|
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
data/lib/action_view/base.rb
CHANGED
|
@@ -267,15 +267,12 @@ module ActionView # :nodoc:
|
|
|
267
267
|
begin
|
|
268
268
|
public_send(method, locals, buffer, **locals, &block)
|
|
269
269
|
rescue ArgumentError => argument_error
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
gsub("no keywords accepted", "no locals accepted").
|
|
277
|
-
concat(" for #{@current_template.short_identifier}")
|
|
278
|
-
)
|
|
270
|
+
public_send_line = __LINE__ - 2
|
|
271
|
+
frame = argument_error.backtrace_locations[1]
|
|
272
|
+
if frame.path == __FILE__ && frame.lineno == public_send_line
|
|
273
|
+
raise StrictLocalsError.new(argument_error, @current_template)
|
|
274
|
+
end
|
|
275
|
+
raise
|
|
279
276
|
end
|
|
280
277
|
else
|
|
281
278
|
public_send(method, locals, buffer, &block)
|
|
@@ -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
|
data/lib/action_view/digestor.rb
CHANGED
|
@@ -107,8 +107,12 @@ module ActionView
|
|
|
107
107
|
end.join("-")
|
|
108
108
|
end
|
|
109
109
|
|
|
110
|
-
def to_dep_map
|
|
111
|
-
|
|
110
|
+
def to_dep_map(seen = Set.new.compare_by_identity)
|
|
111
|
+
if seen.add?(self)
|
|
112
|
+
children.any? ? { name => children.map { |c| c.to_dep_map(seen) } } : name
|
|
113
|
+
else # the tree has a cycle
|
|
114
|
+
name
|
|
115
|
+
end
|
|
112
116
|
end
|
|
113
117
|
end
|
|
114
118
|
|
|
@@ -119,7 +119,7 @@ module ActionView
|
|
|
119
119
|
crossorigin = options.delete("crossorigin")
|
|
120
120
|
crossorigin = "anonymous" if crossorigin == true
|
|
121
121
|
integrity = options["integrity"]
|
|
122
|
-
rel = options["type"] == "module" ? "modulepreload" : "preload"
|
|
122
|
+
rel = options["type"] == "module" || options["type"] == :module ? "modulepreload" : "preload"
|
|
123
123
|
|
|
124
124
|
sources_tags = sources.uniq.map { |source|
|
|
125
125
|
href = path_to_javascript(source, path_options)
|
|
@@ -361,7 +361,7 @@ module ActionView
|
|
|
361
361
|
crossorigin = "anonymous" if crossorigin == true || (crossorigin.blank? && as_type == "font")
|
|
362
362
|
integrity = options[:integrity]
|
|
363
363
|
nopush = options.delete(:nopush) || false
|
|
364
|
-
rel = mime_type == "module" ? "modulepreload" : "preload"
|
|
364
|
+
rel = mime_type == "module" || mime_type == :module ? "modulepreload" : "preload"
|
|
365
365
|
|
|
366
366
|
link_tag = tag.link(
|
|
367
367
|
rel: rel,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "set"
|
|
4
|
-
|
|
5
3
|
module ActionView
|
|
6
4
|
module Helpers # :nodoc:
|
|
7
5
|
# = Action View Atom Feed \Helpers
|
|
@@ -172,7 +170,7 @@ module ActionView
|
|
|
172
170
|
|
|
173
171
|
# Creates an entry tag for a specific record and prefills the id using class and id.
|
|
174
172
|
#
|
|
175
|
-
# Options
|
|
173
|
+
# ==== Options
|
|
176
174
|
#
|
|
177
175
|
# * <tt>:published</tt>: Time first published. Defaults to the created_at attribute on the record if one such exists.
|
|
178
176
|
# * <tt>:updated</tt>: Time of update. Defaults to the updated_at attribute on the record if one such exists.
|
|
@@ -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
|
|
@@ -189,7 +197,7 @@ module ActionView
|
|
|
189
197
|
CachingRegistry.caching?
|
|
190
198
|
end
|
|
191
199
|
|
|
192
|
-
# Raises
|
|
200
|
+
# Raises UncacheableFragmentError when called from within a +cache+ block.
|
|
193
201
|
#
|
|
194
202
|
# Useful to denote helper methods that can't participate in fragment caching:
|
|
195
203
|
#
|
|
@@ -198,7 +206,7 @@ module ActionView
|
|
|
198
206
|
# "#{project.name} - #{Time.now}"
|
|
199
207
|
# end
|
|
200
208
|
#
|
|
201
|
-
# # Which will then raise if used within a
|
|
209
|
+
# # Which will then raise if used within a `cache` block:
|
|
202
210
|
# <% cache project do %>
|
|
203
211
|
# <%= project_name_with_time(project) %>
|
|
204
212
|
# <% end %>
|
|
@@ -136,8 +136,15 @@ module ActionView
|
|
|
136
136
|
from_year += 1 if from_time.month >= 3
|
|
137
137
|
to_year = to_time.year
|
|
138
138
|
to_year -= 1 if to_time.month < 3
|
|
139
|
-
|
|
139
|
+
|
|
140
|
+
leap_years = if from_year > to_year
|
|
141
|
+
0
|
|
142
|
+
else
|
|
143
|
+
fyear = from_year - 1
|
|
144
|
+
(to_year / 4 - to_year / 100 + to_year / 400) - (fyear / 4 - fyear / 100 + fyear / 400)
|
|
145
|
+
end
|
|
140
146
|
minute_offset_for_leap_year = leap_years * 1440
|
|
147
|
+
|
|
141
148
|
# Discount the leap year days when calculating year distance.
|
|
142
149
|
# e.g. if there are 20 leap year days between 2 dates having the same day
|
|
143
150
|
# and month then based on 365 days calculation
|
|
@@ -1228,7 +1235,7 @@ module ActionView
|
|
|
1228
1235
|
class FormBuilder
|
|
1229
1236
|
# Wraps ActionView::Helpers::DateHelper#date_select for form builders:
|
|
1230
1237
|
#
|
|
1231
|
-
# <%=
|
|
1238
|
+
# <%= form_with model: @person do |f| %>
|
|
1232
1239
|
# <%= f.date_select :birth_date %>
|
|
1233
1240
|
# <%= f.submit %>
|
|
1234
1241
|
# <% end %>
|
|
@@ -1240,7 +1247,7 @@ module ActionView
|
|
|
1240
1247
|
|
|
1241
1248
|
# Wraps ActionView::Helpers::DateHelper#time_select for form builders:
|
|
1242
1249
|
#
|
|
1243
|
-
# <%=
|
|
1250
|
+
# <%= form_with model: @race do |f| %>
|
|
1244
1251
|
# <%= f.time_select :average_lap %>
|
|
1245
1252
|
# <%= f.submit %>
|
|
1246
1253
|
# <% end %>
|
|
@@ -1252,7 +1259,7 @@ module ActionView
|
|
|
1252
1259
|
|
|
1253
1260
|
# Wraps ActionView::Helpers::DateHelper#datetime_select for form builders:
|
|
1254
1261
|
#
|
|
1255
|
-
# <%=
|
|
1262
|
+
# <%= form_with model: @person do |f| %>
|
|
1256
1263
|
# <%= f.datetime_select :last_request_at %>
|
|
1257
1264
|
# <%= f.submit %>
|
|
1258
1265
|
# <% end %>
|