diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2023-11-27 20:58:55 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2023-11-27 20:58:55 +0000 |
commit | 7b911245d31509da8fa656bbedc37213d3148897 (patch) | |
tree | e3c7dd7cb0bd2438a895474056cfadbb4ac3262a /config/initializers/10-patches.rb | |
parent | 859bc07edb1f74ab348ff3c54b9af48e714575a2 (diff) | |
download | redmine-7b911245d31509da8fa656bbedc37213d3148897.tar.gz redmine-7b911245d31509da8fa656bbedc37213d3148897.zip |
Updates Rails to 7.1.2 (#36320).
Patch by Takashi Kato.
git-svn-id: https://svn.redmine.org/redmine/trunk@22488 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'config/initializers/10-patches.rb')
-rw-r--r-- | config/initializers/10-patches.rb | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 4bca5edf4..adac86583 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -47,20 +47,6 @@ module ActionView end end end - - class Resolver - def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[]) - locals = locals.map(&:to_s).sort!.freeze - - cached(key, [name, prefix, partial], details, locals) do - if (details[:formats] & [:xml, :json]).any? - details = details.dup - details[:formats] = details[:formats].dup + [:api] - end - _find_all(name, prefix, partial, details, key, locals) - end - end - end end ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| html_tag || ''.html_safe } @@ -69,17 +55,14 @@ ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| html_tag || ' module ActionView module Helpers module Tags - class Base - private - alias :add_options_without_non_empty_blank_option :add_options + SelectRenderer.prepend(Module.new do def add_options(option_tags, options, value = nil) - if options[:include_blank] == true - options = options.dup - options[:include_blank] = ' '.html_safe + if options.delete(:include_blank) + options[:prompt] = ' '.html_safe end - add_options_without_non_empty_blank_option(option_tags, options, value) + super end - end + end) end module FormHelper @@ -156,6 +139,29 @@ module ActionController end end +module ActionView + LookupContext.prepend(Module.new do + def formats=(values) + if (Array(values) & [:xml, :json]).any? + values << :api + end + super values + end + end) + + Rendering.prepend(Module.new do + def rendered_format + if lookup_context.formats.first == :api + return request.format + end + + super + end + end) +end + +Mime::SET << 'api' + # Adds asset_id parameters to assets like Rails 3 to invalidate caches in browser module ActionView module Helpers |