app/controllers/lookbook/application_controller.rb in lookbook-1.3.4 vs app/controllers/lookbook/application_controller.rb in lookbook-1.4.0

- old
+ new

@@ -7,20 +7,20 @@ helper Lookbook::ApplicationHelper helper Lookbook::OutputHelper helper Lookbook::ComponentHelper before_action :generate_theme_overrides - before_action :assign_collections + before_action :assign_instance_vars def self.controller_path "lookbook" end def index - landing = Lookbook.pages.find(&:landing) || Lookbook.pages.first + landing = Lookbook.pages.find(&:landing?) || Lookbook.pages.first if landing.present? - redirect_to lookbook_page_path(landing.lookup_path) + redirect_to lookbook_page_path(landing.path) else render "lookbook/index" end end @@ -28,13 +28,15 @@ def generate_theme_overrides @theme_overrides ||= Lookbook.theme.to_css end - def assign_collections - @previews = Preview.all - @pages = Page.all + def assign_instance_vars + @previews = Lookbook.previews + @pages = Lookbook.pages + @config = Lookbook.config + @engine = Lookbook.engine end def feature_enabled?(feature) Lookbook::Features.enabled?(feature) end @@ -46,10 +48,10 @@ def prettify_error(exception) error_params = {} if exception.is_a?(ViewComponent::PreviewTemplateError) error_params = { - file_path: @preview&.full_path, + file_path: @preview&.file_path, line_number: 0, source_code: @target&.source } end Lookbook::Error.new(exception, **error_params)