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
|
2010-01-12 18:41:04 -05:00
|
|
|
class Railtie < Rails::Railtie
|
2010-03-26 13:47:55 -04:00
|
|
|
config.action_view = ActiveSupport::OrderedOptions.new
|
2010-06-22 19:34:25 -04:00
|
|
|
config.action_view.stylesheet_expansions = {}
|
2011-05-01 18:59:57 -04:00
|
|
|
config.action_view.javascript_expansions = { :defaults => %w(jquery jquery_ujs) }
|
2012-03-28 11:54:06 -04:00
|
|
|
config.action_view.embed_authenticity_token_in_remote_forms = false
|
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-11-15 15:51:10 -05:00
|
|
|
initializer "action_view.cache_asset_ids" do |app|
|
2010-01-14 13:53:07 -05:00
|
|
|
unless app.config.cache_classes
|
2010-03-29 20:08:08 -04:00
|
|
|
ActiveSupport.on_load(:action_view) do
|
2010-11-15 15:51:10 -05:00
|
|
|
ActionView::Helpers::AssetTagHelper::AssetPaths.cache_asset_ids = false
|
2010-03-07 09:24:30 -05:00
|
|
|
end
|
2010-01-14 13:53:07 -05:00
|
|
|
end
|
|
|
|
end
|
2010-03-26 13:47:55 -04:00
|
|
|
|
2010-06-22 18:30:22 -04:00
|
|
|
initializer "action_view.javascript_expansions" do |app|
|
|
|
|
ActiveSupport.on_load(:action_view) do
|
2010-06-22 19:34:25 -04:00
|
|
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion(
|
|
|
|
app.config.action_view.delete(:javascript_expansions)
|
|
|
|
)
|
|
|
|
|
|
|
|
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion(
|
|
|
|
app.config.action_view.delete(:stylesheet_expansions)
|
|
|
|
)
|
2010-06-22 18:30:22 -04:00
|
|
|
end
|
|
|
|
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
|
2010-01-12 18:41:04 -05:00
|
|
|
end
|
2010-12-16 15:37:48 -05:00
|
|
|
end
|