2009-12-31 15:28:48 -05:00
|
|
|
require "action_view"
|
2010-01-12 18:41:04 -05:00
|
|
|
require "rails"
|
|
|
|
|
|
|
|
module ActionView
|
2010-06-16 14:27:50 -04:00
|
|
|
# = Action View Railtie
|
2012-12-01 13:10:08 -05:00
|
|
|
class Railtie < Rails::Railtie # :nodoc:
|
2010-03-26 13:47:55 -04:00
|
|
|
config.action_view = ActiveSupport::OrderedOptions.new
|
2012-03-28 11:54:06 -04:00
|
|
|
config.action_view.embed_authenticity_token_in_remote_forms = false
|
2015-12-01 10:49:44 -05:00
|
|
|
config.action_view.debug_missing_translation = true
|
2012-03-27 22:03:50 -04:00
|
|
|
|
2012-08-01 14:54:22 -04:00
|
|
|
config.eager_load_namespaces << ActionView
|
|
|
|
|
2012-03-27 22:03:50 -04:00
|
|
|
initializer "action_view.embed_authenticity_token_in_remote_forms" do |app|
|
|
|
|
ActiveSupport.on_load(:action_view) do
|
|
|
|
ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms =
|
|
|
|
app.config.action_view.delete(:embed_authenticity_token_in_remote_forms)
|
|
|
|
end
|
|
|
|
end
|
2010-06-22 18:30:22 -04:00
|
|
|
|
2012-01-18 12:05:36 -05:00
|
|
|
initializer "action_view.logger" do
|
|
|
|
ActiveSupport.on_load(:action_view) { self.logger ||= Rails.logger }
|
|
|
|
end
|
|
|
|
|
2010-03-26 13:47:55 -04:00
|
|
|
initializer "action_view.set_configs" do |app|
|
2010-03-29 20:08:08 -04:00
|
|
|
ActiveSupport.on_load(:action_view) do
|
2010-03-26 13:47:55 -04:00
|
|
|
app.config.action_view.each do |k,v|
|
|
|
|
send "#{k}=", v
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-12-16 15:37:48 -05:00
|
|
|
|
|
|
|
initializer "action_view.caching" do |app|
|
|
|
|
ActiveSupport.on_load(:action_view) do
|
|
|
|
if app.config.action_view.cache_template_loading.nil?
|
|
|
|
ActionView::Resolver.caching = app.config.cache_classes
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-06-26 08:48:40 -04:00
|
|
|
|
2015-02-15 14:34:18 -05:00
|
|
|
initializer "action_view.collection_caching" do |app|
|
|
|
|
ActiveSupport.on_load(:action_controller) do
|
|
|
|
PartialRenderer.collection_cache = app.config.action_controller.cache_store
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-30 17:11:49 -04:00
|
|
|
initializer "action_view.per_request_digest_cache" do |app|
|
|
|
|
ActiveSupport.on_load(:action_view) do
|
|
|
|
if app.config.consider_all_requests_local
|
|
|
|
app.middleware.use ActionView::Digestor::PerRequestDigestCacheExpiry
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-12-05 13:34:22 -05:00
|
|
|
initializer "action_view.setup_action_pack" do |app|
|
2013-06-26 08:48:40 -04:00
|
|
|
ActiveSupport.on_load(:action_controller) do
|
2015-01-31 23:12:37 -05:00
|
|
|
ActionView::RoutingUrlFor.include(ActionDispatch::Routing::UrlFor)
|
2013-06-26 08:48:40 -04:00
|
|
|
end
|
|
|
|
end
|
2013-07-17 09:13:16 -04:00
|
|
|
|
2015-05-05 13:42:39 -04:00
|
|
|
rake_tasks do |app|
|
|
|
|
unless app.config.api_only
|
|
|
|
load "action_view/tasks/dependencies.rake"
|
|
|
|
end
|
2013-09-26 15:19:19 -04:00
|
|
|
end
|
2010-01-12 18:41:04 -05:00
|
|
|
end
|
2010-12-16 15:37:48 -05:00
|
|
|
end
|