Class: UikitRails::StyleguideController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- UikitRails::StyleguideController
- Defined in:
- app/controllers/uikit_rails/styleguide_controller.rb
Overview
Serves the component styleguide: index of installed components and live previews.
Instance Method Summary collapse
- #index ⇒ Object
-
#render_preview ⇒ Object
Development only: executes arbitrary ERB from the styleguide (same as preview.yml).
- #show ⇒ Object
Instance Method Details
#index ⇒ Object
10 11 12 |
# File 'app/controllers/uikit_rails/styleguide_controller.rb', line 10 def index @components = installed_components end |
#render_preview ⇒ Object
Development only: executes arbitrary ERB from the styleguide (same as preview.yml).
27 28 29 30 31 32 |
# File 'app/controllers/uikit_rails/styleguide_controller.rb', line 27 def render_preview return head(:forbidden) unless Rails.env.development? @component = params[:component] render_snippet_json end |
#show ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/uikit_rails/styleguide_controller.rb', line 14 def show @component = params[:component] @components = installed_components unless @components.include?(@component) redirect_to uikit_rails.root_path, alert: "Component '#{@component}' is not installed." return end load_preview end |