app/controllers/sandbox_assets/base_controller.rb in rails-sandbox-assets-0.0.5 vs app/controllers/sandbox_assets/base_controller.rb in rails-sandbox-assets-0.1.0
- old
+ new
@@ -1,6 +1,6 @@
-require "sandbox_assets/test_asset"
+require_dependency "sandbox_assets/test_asset"
module SandboxAssets
class BaseController < ActionController::Base
before_filter :find_tests
before_filter :find_stylesheets
@@ -22,17 +22,27 @@
@stylesheets = TestAsset.find_stylesheets(params)
end
def extract_template_from_params
@template ||= params[:template] unless cfg.disable_template_param
+ @iframe_template ||= params[:iframe_template] unless cfg.disable_template_param
end
def render_template
+ (render_iframe_template; return) if params[:action] == 'iframe'
render @template if template
end
+ def render_iframe_template
+ render @iframe_template if iframe_template
+ end
+
def template
@template ||= cfg.template
+ end
+
+ def iframe_template
+ @iframe_template ||= cfg.iframe_template
end
def cfg
@cfg ||= Engine.config.sandbox_assets
end