summaryrefslogtreecommitdiffstats
path: root/config/initializers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-22 17:37:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-22 17:37:16 +0000
commit2d1866d966d94c688f9cb87c5bf3f096dffac844 (patch)
tree7a733c1cc51448ab69b3f892285305dbfb0ae15e /config/initializers
parenta6ec78a4dc658e3517ed682792016b6530458696 (diff)
downloadredmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.tar.gz
redmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.zip
Merged rails-4.1 branch (#14534).
git-svn-id: http://svn.redmine.org/redmine/trunk@13482 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/10-patches.rb53
-rw-r--r--config/initializers/30-redmine.rb8
2 files changed, 12 insertions, 49 deletions
diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb
index 8df4cdec5..ff74c308c 100644
--- a/config/initializers/10-patches.rb
+++ b/config/initializers/10-patches.rb
@@ -54,56 +54,23 @@ module ActionView
end
end
-# Do not HTML escape text templates
-module ActionView
- class Template
- module Handlers
- class ERB
- def call(template)
- if template.source.encoding_aware?
- # First, convert to BINARY, so in case the encoding is
- # wrong, we can still find an encoding tag
- # (<%# encoding %>) inside the String using a regular
- # expression
- template_source = template.source.dup.force_encoding("BINARY")
-
- erb = template_source.gsub(ENCODING_TAG, '')
- encoding = $2
-
- erb.force_encoding valid_encoding(template.source.dup, encoding)
-
- # Always make sure we return a String in the default_internal
- erb.encode!
- else
- erb = template.source.dup
- end
-
- self.class.erb_implementation.new(
- erb,
- :trim => (self.class.erb_trim_mode == "-"),
- :escape => template.identifier =~ /\.text/ # only escape HTML templates
- ).src
- end
- end
- end
- end
-end
-
ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| html_tag || ''.html_safe }
# HTML5: <option value=""></option> is invalid, use <option value="">&nbsp;</option> instead
module ActionView
module Helpers
- class InstanceTag
- private
- def add_options_with_non_empty_blank_option(option_tags, options, value = nil)
- if options[:include_blank] == true
- options = options.dup
- options[:include_blank] = '&nbsp;'.html_safe
+ module Tags
+ class Base
+ private
+ def add_options_with_non_empty_blank_option(option_tags, options, value = nil)
+ if options[:include_blank] == true
+ options = options.dup
+ options[:include_blank] = '&nbsp;'.html_safe
+ end
+ add_options_without_non_empty_blank_option(option_tags, options, value)
end
- add_options_without_non_empty_blank_option(option_tags, options, value)
+ alias_method_chain :add_options, :non_empty_blank_option
end
- alias_method_chain :add_options, :non_empty_blank_option
end
module FormTagHelper
diff --git a/config/initializers/30-redmine.rb b/config/initializers/30-redmine.rb
index f0fc4d4c6..a736902c9 100644
--- a/config/initializers/30-redmine.rb
+++ b/config/initializers/30-redmine.rb
@@ -1,5 +1,7 @@
I18n.default_locale = 'en'
I18n.backend = Redmine::I18n::Backend.new
+# Forces I18n to load available locales from the backend
+I18n.config.available_locales = nil
require 'redmine'
@@ -20,9 +22,3 @@ Redmine::Plugin.load
unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false
Redmine::Plugin.mirror_assets
end
-
-Rails.application.config.to_prepare do
- Redmine::FieldFormat::RecordList.subclasses.each do |klass|
- klass.instance.reset_target_class
- end
-end \ No newline at end of file