Sha256: 618b66e32deeb17ec3aae93024d9cac238e8406d6b3899aee484c607c5de14b1

Contents?: true

Size: 1.09 KB

Versions: 16

Compression:

Stored size: 1.09 KB

Contents

module Lookbook
  class InspectorController < ApplicationController
    include TargetableConcern
    include WithPreviewControllerConcern

    layout "lookbook/inspector"
    helper Lookbook::PreviewHelper

    def self.controller_path
      "lookbook/inspector"
    end

    def show
      if @target
        begin
          @main_panels = main_panels
          @drawer_panels = drawer_panels
        rescue => exception
          render_in_layout "lookbook/error", layout: "lookbook/inspector", error: prettify_error(exception)
        end
      else
        show_404
      end
    end

    def show_legacy
      Lookbook.logger.warn("Legacy URL path detected. These paths are deprecated and will be removed in a future version")
      redirect_to lookbook_inspect_path params[:path]
    end

    private

    def main_panels
      Engine.panels.in_group(:main).map do |config|
        PanelStore.resolve_config(config, inspector_data)
      end
    end

    def drawer_panels
      Engine.panels.in_group(:drawer).map do |config|
        PanelStore.resolve_config(config, inspector_data)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lookbook-1.5.5 app/controllers/lookbook/inspector_controller.rb
lookbook-1.5.4 app/controllers/lookbook/inspector_controller.rb
lookbook-1.5.3 app/controllers/lookbook/inspector_controller.rb
lookbook-1.5.2 app/controllers/lookbook/inspector_controller.rb
lookbook-1.5.1 app/controllers/lookbook/inspector_controller.rb
lookbook-1.5.0 app/controllers/lookbook/inspector_controller.rb
lookbook-1.4.5 app/controllers/lookbook/inspector_controller.rb
lookbook-1.4.4 app/controllers/lookbook/inspector_controller.rb
lookbook-1.4.3 app/controllers/lookbook/inspector_controller.rb
lookbook-1.4.2 app/controllers/lookbook/inspector_controller.rb
lookbook-1.4.1 app/controllers/lookbook/inspector_controller.rb
lookbook-1.4.0 app/controllers/lookbook/inspector_controller.rb
lookbook-1.3.4 app/controllers/lookbook/inspector_controller.rb
lookbook-1.3.3 app/controllers/lookbook/inspector_controller.rb
lookbook-1.3.1 app/controllers/lookbook/inspector_controller.rb
lookbook-1.3.0 app/controllers/lookbook/inspector_controller.rb