app/controllers/lookbook/application_controller.rb in lookbook-1.5.5 vs app/controllers/lookbook/application_controller.rb in lookbook-2.0.0.beta.0
- old
+ new
@@ -2,45 +2,42 @@
class ApplicationController < ActionController::Base
content_security_policy(false) if respond_to?(:content_security_policy)
protect_from_forgery with: :exception
+ helper Lookbook::ClassNamesHelper if Engine.runtime_context.rails_older_than?("6.1.0")
helper Lookbook::ApplicationHelper
- helper Lookbook::OutputHelper
- helper Lookbook::ComponentHelper
+ helper Lookbook::UiElementsHelper
before_action :generate_theme_overrides
before_action :assign_instance_vars
def self.controller_path
"lookbook"
end
def index
- landing = Lookbook.pages.find(&:landing?) || Lookbook.pages.first
-
+ landing = Engine.pages.find(&:landing?) || Engine.pages.first
if landing.present?
- redirect_to lookbook_page_path(landing.path)
+ redirect_to lookbook_page_path(landing.lookup_path)
else
render "lookbook/index"
end
end
protected
def generate_theme_overrides
- @theme_overrides ||= Lookbook.theme.to_css
+ @theme_overrides ||= Engine.theme.to_css
end
def assign_instance_vars
- @previews = Lookbook.previews
- @pages = Lookbook.pages
+ @previews = Engine.previews
+ @pages = Engine.pages
+ @theme = Engine.theme
@config = Lookbook.config
@engine = Lookbook.engine
- end
-
- def feature_enabled?(feature)
- Lookbook::Features.enabled?(feature)
+ @embed = !!params[:lookbook_embed]
end
def render_in_layout(path, layout: nil, **locals)
@error = locals[:error]
render path, layout: layout.presence || (params[:lookbook_embed] ? "lookbook/basic" : "lookbook/application"), locals: locals