Class: Rails::ComponentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Rails::ComponentsController
- Defined in:
- lib/railties/lib/rails/components_controller.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
17 18 19 20 21 |
# File 'lib/railties/lib/rails/components_controller.rb', line 17 def index @previews = ActionView::Component::Preview.all @page_title = "Component Previews" render template: "components/index" end |
#previews ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/railties/lib/rails/components_controller.rb', line 23 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_args = @preview.render_args(@example_name) layout = @render_args[:layout] opts = layout.nil? ? {} : { layout: layout } render template: "components/preview", **opts end end |