Sha256: 3195099e816ecd556972bb25dc9e15e85db503eefabbcfa0d16e218419d0aaea

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

require "active_support/concern"

module ViewComponent # :nodoc:
  module Previewable
    extend ActiveSupport::Concern

    included do
      # Set a custom default preview layout through app configuration:
      #
      #     config.view_component.default_preview_layout = "component_preview"
      #
      # This affects preview index pages as well as individual component previews
      #
      mattr_accessor :default_preview_layout, instance_writer: false

      # Set the location of component previews through app configuration:
      #
      #     config.view_component.preview_paths << "#{Rails.root}/lib/component_previews"
      #
      mattr_accessor :preview_paths, instance_writer: false

      # TODO: deprecated, remove in v3.0.0
      mattr_accessor :preview_path, instance_writer: false

      # Enable or disable component previews through app configuration:
      #
      #     config.view_component.show_previews = true
      #
      # Defaults to +true+ for development environment
      #
      mattr_accessor :show_previews, instance_writer: false

      # Set the entry route for component previews through app configuration:
      #
      #     config.view_component.preview_route = "/previews"
      #
      # Defaults to +/rails/view_components+ when `show_previews' is enabled
      #
      mattr_accessor :preview_route, instance_writer: false do
        "/rails/view_components"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
view_component-2.19.1 lib/view_component/previewable.rb
view_component-2.19.0 lib/view_component/previewable.rb
view_component-2.18.2 lib/view_component/previewable.rb
view_component-2.18.1 lib/view_component/previewable.rb
view_component-2.18.0 lib/view_component/previewable.rb