app/controllers/lookbook/application_controller.rb



module Lookbook
  class ApplicationController < ActionController::Base
    content_security_policy false, if: -> { Rails.env.development? }
    protect_from_forgery with: :exception

    helper Lookbook::ApplicationHelper
    helper Lookbook::OutputHelper
    helper Lookbook::ComponentHelper

    def self.controller_path
      "lookbook"
    end

    def index
      if feature_enabled? :pages
        landing = Lookbook.pages.find(&:landing) || Lookbook.pages.first
        if landing.present?
          redirect_to lookbook_page_path(landing.lookup_path)
        end
      end
    end

    protected

    def feature_enabled?(feature)
      Lookbook::Features.enabled?(feature)
    end
  end
end