app/controllers/lookbook/previews_controller.rb in lookbook-2.0.0.beta.1 vs app/controllers/lookbook/previews_controller.rb in lookbook-2.0.0.beta.2

- old
+ new

@@ -38,11 +38,11 @@ def show if @target begin opts = {layout: @preview.layout} - if params[:lookbook_embed] == "true" + if embedded? opts[:append_html] = render_to_string("lookbook/partials/_iframe_content_scripts", layout: nil) end @preview_html = preview_controller.process(:render_in_layout_to_string, "lookbook/previews/group", inspector_data, **opts) rescue => exception render_in_layout "lookbook/error", @@ -54,18 +54,23 @@ end end private + def embedded? + params[:lookbook_embed] == "true" + end + def scenario_json(scenario) { name: scenario.name, inspect_path: scenario.url_path, preview_path: scenario.preview_path } end def permit_framing + headers["X-Frame-Options"] = Lookbook.config.preview_embeds.policy if embedded? headers["X-Frame-Options"] = "SAMEORIGIN" if headers["X-Frame-Options"] == "DENY" end end end