Class: Rails::ComponentsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/railties/lib/rails/components_controller.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#indexObject



16
17
18
19
20
# File 'lib/railties/lib/rails/components_controller.rb', line 16

def index
  @previews = ActionView::Component::Preview.all
  @page_title = "Component Previews"
  render template: "components/index"
end

#previewsObject



22
23
24
25
26
27
28
29
30
# File 'lib/railties/lib/rails/components_controller.rb', line 22

def previews
  if params[:path] == @preview.preview_name
    @page_title = "Component Previews for #{@preview.preview_name}"
    render template: "components/previews"
  else
    @example_name = File.basename(params[:path])
    render template: "components/preview", layout: false
  end
end