actionview 6.0.4 → 6.1.0.rc1
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 +152 -258
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/action_view.rb +4 -1
- data/lib/action_view/base.rb +21 -52
- data/lib/action_view/cache_expiry.rb +1 -2
- data/lib/action_view/context.rb +0 -1
- data/lib/action_view/dependency_tracker.rb +10 -4
- data/lib/action_view/digestor.rb +3 -2
- data/lib/action_view/gem_version.rb +3 -3
- data/lib/action_view/helpers/asset_tag_helper.rb +40 -15
- data/lib/action_view/helpers/asset_url_helper.rb +6 -4
- data/lib/action_view/helpers/atom_feed_helper.rb +2 -1
- data/lib/action_view/helpers/cache_helper.rb +10 -16
- data/lib/action_view/helpers/date_helper.rb +4 -4
- data/lib/action_view/helpers/form_helper.rb +59 -17
- data/lib/action_view/helpers/form_options_helper.rb +7 -16
- data/lib/action_view/helpers/form_tag_helper.rb +8 -6
- data/lib/action_view/helpers/javascript_helper.rb +3 -3
- data/lib/action_view/helpers/number_helper.rb +6 -6
- data/lib/action_view/helpers/rendering_helper.rb +11 -3
- data/lib/action_view/helpers/sanitize_helper.rb +2 -2
- data/lib/action_view/helpers/tag_helper.rb +92 -17
- data/lib/action_view/helpers/tags/base.rb +9 -5
- data/lib/action_view/helpers/tags/date_field.rb +1 -1
- data/lib/action_view/helpers/tags/date_select.rb +2 -2
- data/lib/action_view/helpers/tags/datetime_local_field.rb +1 -1
- data/lib/action_view/helpers/tags/label.rb +4 -0
- data/lib/action_view/helpers/tags/month_field.rb +1 -1
- data/lib/action_view/helpers/tags/select.rb +1 -1
- data/lib/action_view/helpers/tags/time_field.rb +1 -1
- data/lib/action_view/helpers/tags/week_field.rb +1 -1
- data/lib/action_view/helpers/text_helper.rb +1 -1
- data/lib/action_view/helpers/translation_helper.rb +88 -53
- data/lib/action_view/helpers/url_helper.rb +107 -13
- data/lib/action_view/layouts.rb +3 -2
- data/lib/action_view/log_subscriber.rb +26 -10
- data/lib/action_view/lookup_context.rb +3 -18
- data/lib/action_view/path_set.rb +0 -3
- data/lib/action_view/railtie.rb +35 -46
- data/lib/action_view/renderer/abstract_renderer.rb +93 -14
- data/lib/action_view/renderer/collection_renderer.rb +192 -0
- data/lib/action_view/renderer/object_renderer.rb +34 -0
- data/lib/action_view/renderer/partial_renderer.rb +20 -282
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +25 -26
- data/lib/action_view/renderer/renderer.rb +44 -1
- data/lib/action_view/renderer/streaming_template_renderer.rb +5 -1
- data/lib/action_view/renderer/template_renderer.rb +15 -12
- data/lib/action_view/rendering.rb +3 -1
- data/lib/action_view/routing_url_for.rb +1 -1
- data/lib/action_view/template.rb +9 -49
- data/lib/action_view/template/handlers.rb +0 -26
- data/lib/action_view/template/handlers/erb.rb +10 -14
- data/lib/action_view/template/handlers/erb/erubi.rb +9 -7
- data/lib/action_view/template/html.rb +1 -11
- data/lib/action_view/template/raw_file.rb +0 -3
- data/lib/action_view/template/renderable.rb +24 -0
- data/lib/action_view/template/resolver.rb +82 -40
- data/lib/action_view/template/text.rb +0 -3
- data/lib/action_view/test_case.rb +18 -25
- data/lib/action_view/testing/resolvers.rb +10 -31
- data/lib/action_view/unbound_template.rb +3 -3
- data/lib/action_view/view_paths.rb +34 -36
- data/lib/assets/compiled/rails-ujs.js +1 -1
- metadata +17 -14
@@ -45,7 +45,7 @@ module ActionView
|
|
45
45
|
def _back_url # :nodoc:
|
46
46
|
_filtered_referrer || "javascript:history.back()"
|
47
47
|
end
|
48
|
-
|
48
|
+
private :_back_url
|
49
49
|
|
50
50
|
def _filtered_referrer # :nodoc:
|
51
51
|
if controller.respond_to?(:request)
|
@@ -56,12 +56,12 @@ module ActionView
|
|
56
56
|
end
|
57
57
|
rescue URI::InvalidURIError
|
58
58
|
end
|
59
|
-
|
59
|
+
private :_filtered_referrer
|
60
60
|
|
61
61
|
# Creates an anchor element of the given +name+ using a URL created by the set of +options+.
|
62
62
|
# See the valid options in the documentation for +url_for+. It's also possible to
|
63
|
-
# pass a String instead of an options hash, which generates an anchor element that uses the
|
64
|
-
# value of the String as the href for the link. Using a <tt>:back</tt> Symbol instead
|
63
|
+
# pass a \String instead of an options hash, which generates an anchor element that uses the
|
64
|
+
# value of the \String as the href for the link. Using a <tt>:back</tt> \Symbol instead
|
65
65
|
# of an options hash will generate a link to the referrer (a JavaScript back link
|
66
66
|
# will be used in place of a referrer if none exists). If +nil+ is passed as the name
|
67
67
|
# the value of the link itself will become the name.
|
@@ -177,7 +177,7 @@ module ActionView
|
|
177
177
|
# # => <a href="/searches?query=ruby+on+rails">Ruby on Rails search</a>
|
178
178
|
#
|
179
179
|
# link_to "Nonsense search", searches_path(foo: "bar", baz: "quux")
|
180
|
-
# # => <a href="/searches?foo=bar&
|
180
|
+
# # => <a href="/searches?foo=bar&baz=quux">Nonsense search</a>
|
181
181
|
#
|
182
182
|
# The only option specific to +link_to+ (<tt>:method</tt>) is used as follows:
|
183
183
|
#
|
@@ -226,7 +226,7 @@ module ActionView
|
|
226
226
|
# The +options+ hash accepts the same options as +url_for+.
|
227
227
|
#
|
228
228
|
# There are a few special +html_options+:
|
229
|
-
# * <tt>:method</tt> - Symbol of HTTP verb. Supported verbs are <tt>:post</tt>, <tt>:get</tt>,
|
229
|
+
# * <tt>:method</tt> - \Symbol of HTTP verb. Supported verbs are <tt>:post</tt>, <tt>:get</tt>,
|
230
230
|
# <tt>:delete</tt>, <tt>:patch</tt>, and <tt>:put</tt>. By default it will be <tt>:post</tt>.
|
231
231
|
# * <tt>:disabled</tt> - If set to true, it will generate a disabled button.
|
232
232
|
# * <tt>:data</tt> - This option can be used to add custom data attributes.
|
@@ -235,7 +235,7 @@ module ActionView
|
|
235
235
|
# * <tt>:form</tt> - This hash will be form attributes
|
236
236
|
# * <tt>:form_class</tt> - This controls the class of the form within which the submit button will
|
237
237
|
# be placed
|
238
|
-
# * <tt>:params</tt> - Hash of parameters to be rendered as hidden fields within the form.
|
238
|
+
# * <tt>:params</tt> - \Hash of parameters to be rendered as hidden fields within the form.
|
239
239
|
#
|
240
240
|
# ==== Data attributes
|
241
241
|
#
|
@@ -290,7 +290,7 @@ module ActionView
|
|
290
290
|
#
|
291
291
|
#
|
292
292
|
# <%= button_to('Destroy', 'http://www.example.com',
|
293
|
-
# method:
|
293
|
+
# method: :delete, remote: true, data: { confirm: 'Are you sure?', disable_with: 'loading...' }) %>
|
294
294
|
# # => "<form class='button_to' method='post' action='http://www.example.com' data-remote='true'>
|
295
295
|
# # <input name='_method' value='delete' type='hidden' />
|
296
296
|
# # <input value='Destroy' type='submit' data-disable-with='loading...' data-confirm='Are you sure?' />
|
@@ -412,8 +412,7 @@ module ActionView
|
|
412
412
|
# Creates a link tag of the given +name+ using a URL created by the set of
|
413
413
|
# +options+ if +condition+ is true, otherwise only the name is
|
414
414
|
# returned. To specialize the default behavior, you can pass a block that
|
415
|
-
# accepts the name or the full argument list for +
|
416
|
-
# in +link_to_unless+).
|
415
|
+
# accepts the name or the full argument list for +link_to_if+.
|
417
416
|
#
|
418
417
|
# ==== Examples
|
419
418
|
# <%= link_to_if(@current_user.nil?, "Login", { controller: "sessions", action: "new" }) %>
|
@@ -550,14 +549,14 @@ module ActionView
|
|
550
549
|
return false unless request.get? || request.head?
|
551
550
|
|
552
551
|
check_parameters ||= options.is_a?(Hash) && options.delete(:check_parameters)
|
553
|
-
url_string = URI.
|
552
|
+
url_string = URI::DEFAULT_PARSER.unescape(url_for(options)).force_encoding(Encoding::BINARY)
|
554
553
|
|
555
554
|
# We ignore any extra parameters in the request_uri if the
|
556
555
|
# submitted URL doesn't have any either. This lets the function
|
557
556
|
# work with things like ?order=asc
|
558
557
|
# the behaviour can be disabled with check_parameters: true
|
559
558
|
request_uri = url_string.index("?") || check_parameters ? request.fullpath : request.path
|
560
|
-
request_uri = URI.
|
559
|
+
request_uri = URI::DEFAULT_PARSER.unescape(request_uri).force_encoding(Encoding::BINARY)
|
561
560
|
|
562
561
|
if url_string.start_with?("/") && url_string != "/"
|
563
562
|
url_string.chomp!("/")
|
@@ -571,6 +570,101 @@ module ActionView
|
|
571
570
|
end
|
572
571
|
end
|
573
572
|
|
573
|
+
# Creates an SMS anchor link tag to the specified +phone_number+, which is
|
574
|
+
# also used as the name of the link unless +name+ is specified. Additional
|
575
|
+
# HTML attributes for the link can be passed in +html_options+.
|
576
|
+
#
|
577
|
+
# When clicked, an SMS message is prepopulated with the passed phone number
|
578
|
+
# and optional +body+ value.
|
579
|
+
#
|
580
|
+
# +sms_to+ has a +body+ option for customizing the SMS message itself by
|
581
|
+
# passing special keys to +html_options+.
|
582
|
+
#
|
583
|
+
# ==== Options
|
584
|
+
# * <tt>:body</tt> - Preset the body of the message.
|
585
|
+
#
|
586
|
+
# ==== Examples
|
587
|
+
# sms_to "5155555785"
|
588
|
+
# # => <a href="sms:5155555785;">5155555785</a>
|
589
|
+
#
|
590
|
+
# sms_to "5155555785", "Text me"
|
591
|
+
# # => <a href="sms:5155555785;">Text me</a>
|
592
|
+
#
|
593
|
+
# sms_to "5155555785", "Text me",
|
594
|
+
# body: "Hello Jim I have a question about your product."
|
595
|
+
# # => <a href="sms:5155555785;?body=Hello%20Jim%20I%20have%20a%20question%20about%20your%20product">Text me</a>
|
596
|
+
#
|
597
|
+
# You can use a block as well if your link target is hard to fit into the name parameter. \ERB example:
|
598
|
+
#
|
599
|
+
# <%= sms_to "5155555785" do %>
|
600
|
+
# <strong>Text me:</strong>
|
601
|
+
# <% end %>
|
602
|
+
# # => <a href="sms:5155555785;">
|
603
|
+
# <strong>Text me:</strong>
|
604
|
+
# </a>
|
605
|
+
def sms_to(phone_number, name = nil, html_options = {}, &block)
|
606
|
+
html_options, name = name, nil if block_given?
|
607
|
+
html_options = (html_options || {}).stringify_keys
|
608
|
+
|
609
|
+
extras = %w{ body }.map! { |item|
|
610
|
+
option = html_options.delete(item).presence || next
|
611
|
+
"#{item.dasherize}=#{ERB::Util.url_encode(option)}"
|
612
|
+
}.compact
|
613
|
+
extras = extras.empty? ? "" : "?&" + extras.join("&")
|
614
|
+
|
615
|
+
encoded_phone_number = ERB::Util.url_encode(phone_number)
|
616
|
+
html_options["href"] = "sms:#{encoded_phone_number};#{extras}"
|
617
|
+
|
618
|
+
content_tag("a", name || phone_number, html_options, &block)
|
619
|
+
end
|
620
|
+
|
621
|
+
# Creates a TEL anchor link tag to the specified +phone_number+, which is
|
622
|
+
# also used as the name of the link unless +name+ is specified. Additional
|
623
|
+
# HTML attributes for the link can be passed in +html_options+.
|
624
|
+
#
|
625
|
+
# When clicked, the default app to make calls is opened, and it
|
626
|
+
# is prepopulated with the passed phone number and optional
|
627
|
+
# +country_code+ value.
|
628
|
+
#
|
629
|
+
# +phone_to+ has an optional +country_code+ option which automatically adds the country
|
630
|
+
# code as well as the + sign in the phone numer that gets prepopulated,
|
631
|
+
# for example if +country_code: "01"+ +\+01+ will be prepended to the
|
632
|
+
# phone numer, by passing special keys to +html_options+.
|
633
|
+
#
|
634
|
+
# ==== Options
|
635
|
+
# * <tt>:country_code</tt> - Prepends the country code to the number
|
636
|
+
#
|
637
|
+
# ==== Examples
|
638
|
+
# phone_to "1234567890"
|
639
|
+
# # => <a href="tel:1234567890">1234567890</a>
|
640
|
+
#
|
641
|
+
# phone_to "1234567890", "Phone me"
|
642
|
+
# # => <a href="tel:134567890">Phone me</a>
|
643
|
+
#
|
644
|
+
# phone_to "1234567890", "Phone me", country_code: "01"
|
645
|
+
# # => <a href="tel:+015155555785">Phone me</a>
|
646
|
+
#
|
647
|
+
# You can use a block as well if your link target is hard to fit into the name parameter. \ERB example:
|
648
|
+
#
|
649
|
+
# <%= phone_to "1234567890" do %>
|
650
|
+
# <strong>Phone me:</strong>
|
651
|
+
# <% end %>
|
652
|
+
# # => <a href="tel:1234567890">
|
653
|
+
# <strong>Phone me:</strong>
|
654
|
+
# </a>
|
655
|
+
def phone_to(phone_number, name = nil, html_options = {}, &block)
|
656
|
+
html_options, name = name, nil if block_given?
|
657
|
+
html_options = (html_options || {}).stringify_keys
|
658
|
+
|
659
|
+
country_code = html_options.delete("country_code").presence
|
660
|
+
country_code = country_code.nil? ? "" : "+#{ERB::Util.url_encode(country_code)}"
|
661
|
+
|
662
|
+
encoded_phone_number = ERB::Util.url_encode(phone_number)
|
663
|
+
html_options["href"] = "tel:#{country_code}#{encoded_phone_number}"
|
664
|
+
|
665
|
+
content_tag("a", name || phone_number, html_options, &block)
|
666
|
+
end
|
667
|
+
|
574
668
|
private
|
575
669
|
def convert_options_to_data_attributes(options, html_options)
|
576
670
|
if html_options
|
@@ -594,7 +688,7 @@ module ActionView
|
|
594
688
|
end
|
595
689
|
|
596
690
|
def add_method_to_attributes!(html_options, method)
|
597
|
-
if method_not_get_method?(method) && html_options["rel"]
|
691
|
+
if method_not_get_method?(method) && !html_options["rel"]&.match?(/nofollow/)
|
598
692
|
if html_options["rel"].blank?
|
599
693
|
html_options["rel"] = "nofollow"
|
600
694
|
else
|
data/lib/action_view/layouts.rb
CHANGED
@@ -306,7 +306,7 @@ module ActionView
|
|
306
306
|
RUBY
|
307
307
|
when Proc
|
308
308
|
define_method :_layout_from_proc, &_layout
|
309
|
-
|
309
|
+
private :_layout_from_proc
|
310
310
|
<<-RUBY
|
311
311
|
result = _layout_from_proc(#{_layout.arity == 0 ? '' : 'self'})
|
312
312
|
return #{default_behavior} if result.nil?
|
@@ -321,6 +321,7 @@ module ActionView
|
|
321
321
|
end
|
322
322
|
|
323
323
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
324
|
+
# frozen_string_literal: true
|
324
325
|
def _layout(lookup_context, formats)
|
325
326
|
if _conditional_layout?
|
326
327
|
#{layout_definition}
|
@@ -395,7 +396,7 @@ module ActionView
|
|
395
396
|
end
|
396
397
|
|
397
398
|
def _normalize_layout(value)
|
398
|
-
value.is_a?(String) && value
|
399
|
+
value.is_a?(String) && !value.match?(/\blayouts/) ? "layouts/#{value}" : value
|
399
400
|
end
|
400
401
|
|
401
402
|
# Returns the default layout for this controller.
|
@@ -23,7 +23,7 @@ module ActionView
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def render_partial(event)
|
26
|
-
|
26
|
+
debug do
|
27
27
|
message = +" Rendered #{from_rails_root(event.payload[:identifier])}"
|
28
28
|
message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout]
|
29
29
|
message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
|
@@ -32,19 +32,26 @@ module ActionView
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
def render_layout(event)
|
36
|
+
info do
|
37
|
+
message = +" Rendered layout #{from_rails_root(event.payload[:identifier])}"
|
38
|
+
message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
35
42
|
def render_collection(event)
|
36
43
|
identifier = event.payload[:identifier] || "templates"
|
37
44
|
|
38
|
-
|
39
|
-
" Rendered collection of #{from_rails_root(identifier)}"
|
40
|
-
" #{
|
45
|
+
debug do
|
46
|
+
message = +" Rendered collection of #{from_rails_root(identifier)}"
|
47
|
+
message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout]
|
48
|
+
message << " #{render_count(event.payload)} (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
|
49
|
+
message
|
41
50
|
end
|
42
51
|
end
|
43
52
|
|
44
53
|
def start(name, id, payload)
|
45
|
-
|
46
|
-
log_rendering_start(payload)
|
47
|
-
end
|
54
|
+
log_rendering_start(payload, name)
|
48
55
|
|
49
56
|
super
|
50
57
|
end
|
@@ -82,9 +89,18 @@ module ActionView
|
|
82
89
|
end
|
83
90
|
end
|
84
91
|
|
85
|
-
def log_rendering_start(payload)
|
86
|
-
|
87
|
-
|
92
|
+
def log_rendering_start(payload, name)
|
93
|
+
debug do
|
94
|
+
qualifier =
|
95
|
+
if name == "render_template.action_view"
|
96
|
+
""
|
97
|
+
elsif name == "render_layout.action_view"
|
98
|
+
"layout "
|
99
|
+
end
|
100
|
+
|
101
|
+
return unless qualifier
|
102
|
+
|
103
|
+
message = +" Rendering #{qualifier}#{from_rails_root(payload[:identifier])}"
|
88
104
|
message << " within #{from_rails_root(payload[:layout])}" if payload[:layout]
|
89
105
|
message
|
90
106
|
end
|
@@ -1,9 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "concurrent/map"
|
4
|
-
require "active_support/core_ext/module/remove_method"
|
5
4
|
require "active_support/core_ext/module/attribute_accessors"
|
6
|
-
require "active_support/deprecation"
|
7
5
|
require "action_view/template/resolver"
|
8
6
|
|
9
7
|
module ActionView
|
@@ -16,8 +14,6 @@ module ActionView
|
|
16
14
|
# only once during the request, it speeds up all cache accesses.
|
17
15
|
class LookupContext #:nodoc:
|
18
16
|
attr_accessor :prefixes, :rendered_format
|
19
|
-
deprecate :rendered_format
|
20
|
-
deprecate :rendered_format=
|
21
17
|
|
22
18
|
mattr_accessor :fallbacks, default: FallbackFileSystemResolver.instances
|
23
19
|
|
@@ -30,7 +26,7 @@ module ActionView
|
|
30
26
|
Accessors.define_method(:"default_#{name}", &block)
|
31
27
|
Accessors.module_eval <<-METHOD, __FILE__, __LINE__ + 1
|
32
28
|
def #{name}
|
33
|
-
@details
|
29
|
+
@details[:#{name}] || []
|
34
30
|
end
|
35
31
|
|
36
32
|
def #{name}=(value)
|
@@ -132,9 +128,6 @@ module ActionView
|
|
132
128
|
end
|
133
129
|
alias :find_template :find
|
134
130
|
|
135
|
-
alias :find_file :find
|
136
|
-
deprecate :find_file
|
137
|
-
|
138
131
|
def find_all(name, prefixes = [], partial = false, keys = [], options = {})
|
139
132
|
@view_paths.find_all(*args_for_lookup(name, prefixes, partial, keys, options))
|
140
133
|
end
|
@@ -155,18 +148,10 @@ module ActionView
|
|
155
148
|
view_paths = build_view_paths((@view_paths.paths + self.class.fallbacks).uniq)
|
156
149
|
|
157
150
|
if block_given?
|
158
|
-
|
159
|
-
Calling `with_fallbacks` with a block is
|
151
|
+
raise ArgumentError, <<~eowarn.squish
|
152
|
+
Calling `with_fallbacks` with a block is not supported. Call methods on
|
160
153
|
the lookup context returned by `with_fallbacks` instead.
|
161
154
|
eowarn
|
162
|
-
|
163
|
-
begin
|
164
|
-
_view_paths = @view_paths
|
165
|
-
@view_paths = view_paths
|
166
|
-
yield
|
167
|
-
ensure
|
168
|
-
@view_paths = _view_paths
|
169
|
-
end
|
170
155
|
else
|
171
156
|
ActionView::LookupContext.new(view_paths, @details, @prefixes)
|
172
157
|
end
|
data/lib/action_view/path_set.rb
CHANGED
data/lib/action_view/railtie.rb
CHANGED
@@ -6,54 +6,47 @@ require "rails"
|
|
6
6
|
module ActionView
|
7
7
|
# = Action View Railtie
|
8
8
|
class Railtie < Rails::Engine # :nodoc:
|
9
|
-
NULL_OPTION = Object.new
|
10
|
-
|
11
9
|
config.action_view = ActiveSupport::OrderedOptions.new
|
12
10
|
config.action_view.embed_authenticity_token_in_remote_forms = nil
|
13
11
|
config.action_view.debug_missing_translation = true
|
14
12
|
config.action_view.default_enforce_utf8 = nil
|
15
|
-
config.action_view.finalize_compiled_template_methods = NULL_OPTION
|
16
13
|
|
17
14
|
config.eager_load_namespaces << ActionView
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
app.config.action_view.delete(:embed_authenticity_token_in_remote_forms)
|
23
|
-
end
|
16
|
+
config.after_initialize do |app|
|
17
|
+
ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms =
|
18
|
+
app.config.action_view.delete(:embed_authenticity_token_in_remote_forms)
|
24
19
|
end
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
ActionView::Helpers::FormHelper.form_with_generates_remote_forms = form_with_generates_remote_forms
|
30
|
-
end
|
21
|
+
config.after_initialize do |app|
|
22
|
+
form_with_generates_remote_forms = app.config.action_view.delete(:form_with_generates_remote_forms)
|
23
|
+
ActionView::Helpers::FormHelper.form_with_generates_remote_forms = form_with_generates_remote_forms
|
31
24
|
end
|
32
25
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
ActionView::Helpers::FormHelper.form_with_generates_ids = form_with_generates_ids
|
38
|
-
end
|
26
|
+
config.after_initialize do |app|
|
27
|
+
form_with_generates_ids = app.config.action_view.delete(:form_with_generates_ids)
|
28
|
+
unless form_with_generates_ids.nil?
|
29
|
+
ActionView::Helpers::FormHelper.form_with_generates_ids = form_with_generates_ids
|
39
30
|
end
|
40
31
|
end
|
41
32
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
ActionView::Helpers::FormTagHelper.default_enforce_utf8 = default_enforce_utf8
|
47
|
-
end
|
33
|
+
config.after_initialize do |app|
|
34
|
+
default_enforce_utf8 = app.config.action_view.delete(:default_enforce_utf8)
|
35
|
+
unless default_enforce_utf8.nil?
|
36
|
+
ActionView::Helpers::FormTagHelper.default_enforce_utf8 = default_enforce_utf8
|
48
37
|
end
|
49
38
|
end
|
50
39
|
|
51
|
-
|
40
|
+
config.after_initialize do |app|
|
52
41
|
ActiveSupport.on_load(:action_view) do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
42
|
+
app.config.action_view.each do |k, v|
|
43
|
+
if k == :raise_on_missing_translations
|
44
|
+
ActiveSupport::Deprecation.warn \
|
45
|
+
"action_view.raise_on_missing_translations is deprecated and will be removed in Rails 6.2. " \
|
46
|
+
"Set i18n.raise_on_missing_translations instead. " \
|
47
|
+
"Note that this new setting also affects how missing translations are handled in controllers."
|
48
|
+
end
|
49
|
+
send "#{k}=", v
|
57
50
|
end
|
58
51
|
end
|
59
52
|
end
|
@@ -62,14 +55,6 @@ module ActionView
|
|
62
55
|
ActiveSupport.on_load(:action_view) { self.logger ||= Rails.logger }
|
63
56
|
end
|
64
57
|
|
65
|
-
initializer "action_view.set_configs" do |app|
|
66
|
-
ActiveSupport.on_load(:action_view) do
|
67
|
-
app.config.action_view.each do |k, v|
|
68
|
-
send "#{k}=", v
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
58
|
initializer "action_view.caching" do |app|
|
74
59
|
ActiveSupport.on_load(:action_view) do
|
75
60
|
if app.config.action_view.cache_template_loading.nil?
|
@@ -78,14 +63,6 @@ module ActionView
|
|
78
63
|
end
|
79
64
|
end
|
80
65
|
|
81
|
-
initializer "action_view.per_request_digest_cache" do |app|
|
82
|
-
ActiveSupport.on_load(:action_view) do
|
83
|
-
unless ActionView::Resolver.caching?
|
84
|
-
app.executor.to_run ActionView::CacheExpiry::Executor.new(watcher: app.config.file_watcher)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
66
|
initializer "action_view.setup_action_pack" do |app|
|
90
67
|
ActiveSupport.on_load(:action_controller) do
|
91
68
|
ActionView::RoutingUrlFor.include(ActionDispatch::Routing::UrlFor)
|
@@ -96,6 +73,18 @@ module ActionView
|
|
96
73
|
PartialRenderer.collection_cache = app.config.action_controller.cache_store
|
97
74
|
end
|
98
75
|
|
76
|
+
config.after_initialize do |app|
|
77
|
+
enable_caching = if app.config.action_view.cache_template_loading.nil?
|
78
|
+
app.config.cache_classes
|
79
|
+
else
|
80
|
+
app.config.action_view.cache_template_loading
|
81
|
+
end
|
82
|
+
|
83
|
+
unless enable_caching
|
84
|
+
app.executor.to_run ActionView::CacheExpiry::Executor.new(watcher: app.config.file_watcher)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
99
88
|
rake_tasks do |app|
|
100
89
|
unless app.config.api_only
|
101
90
|
load "action_view/tasks/cache_digests.rake"
|