Sha256: ad94cdea9221a9930ae24c9684c98794a03c42e803b1180c1d697add3815c604

Contents?: true

Size: 961 Bytes

Versions: 11

Compression:

Stored size: 961 Bytes

Contents

module Lookbook
  class PreviewsController < ApplicationController
    include TargetableConcern
    include WithPreviewControllerConcern

    layout "lookbook/inspector"
    helper Lookbook::PreviewHelper

    def self.controller_path
      "lookbook/previews"
    end

    def show
      if @target
        begin
          opts = {layout: @preview.layout}
          if params[:lookbook_embed] == "true"
            opts[:append_html] = "<script src=\"/lookbook-assets/js/embed.js?v=#{Lookbook.version}\"></script>".html_safe
          end
          preview_html = preview_controller.process(:render_in_layout_to_string, "lookbook/preview", inspector_data, **opts)
          render html: preview_html
        rescue => exception
          render_in_layout "lookbook/error",
            layout: "lookbook/standalone",
            error: prettify_error(exception)
        end
      else
        show_404 layout: "lookbook/standalone"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lookbook-1.5.0 app/controllers/lookbook/previews_controller.rb
lookbook-1.4.5 app/controllers/lookbook/previews_controller.rb
lookbook-1.4.4 app/controllers/lookbook/previews_controller.rb
lookbook-1.4.3 app/controllers/lookbook/previews_controller.rb
lookbook-1.4.2 app/controllers/lookbook/previews_controller.rb
lookbook-1.4.1 app/controllers/lookbook/previews_controller.rb
lookbook-1.4.0 app/controllers/lookbook/previews_controller.rb
lookbook-1.3.4 app/controllers/lookbook/previews_controller.rb
lookbook-1.3.3 app/controllers/lookbook/previews_controller.rb
lookbook-1.3.1 app/controllers/lookbook/previews_controller.rb
lookbook-1.3.0 app/controllers/lookbook/previews_controller.rb