app/controllers/lookbook/application_controller.rb in lookbook-2.1.1 vs app/controllers/lookbook/application_controller.rb in lookbook-2.2.0

- old
+ new

@@ -46,11 +46,12 @@ @pages = Engine.pages @theme = Engine.theme @config = Lookbook.config @engine = Lookbook.engine @embed = !!params[:lookbook_embed] - @blank_slate = Engine.pages.none? && Engine.previews.none? + @sidebar_panels = sidebar_panels + @blank_slate = @sidebar_panels.none? end def raise_not_found(message = "Page not found") raise Lookbook::RoutingError, message end @@ -68,9 +69,16 @@ def current_layout self.class.send(:_layout) end private + + def sidebar_panels + panels_config = Lookbook.config.preview_inspector.sidebar_panels.map(&:to_sym) + panels_config.select do |panel| + (panel == :pages && Engine.pages.any?) || (panel == :previews && Engine.previews.any?) + end + end def get_status_code(err) if err.respond_to?(:status) err.status else