Sha256: ba4cf79d91bc17eb2a206fc2d491ca2dc66e0dea4a5edbd377411436c11f65b0

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

module Kiqr
  class Engine < ::Rails::Engine
    engine_name "kiqr"

    # Load default_url_options automatically with KIQR. To set a custom URL in
    # production, set the `BASE_URL` environment variable to your apps domain.
    # It defaults to `http://localhost:3000` in the development and test environments.
    initializer "kiqr.setup_default_url_options" do
      config.action_mailer.default_url_options = Kiqr.default_url_options
    end

    # Include helpers to the applications controllers and views.
    initializer "kiqr.controller_and_view_helpers" do
      Kiqr.include_helpers(Kiqr::Controllers)
      Kiqr.include_helpers(Kiqr::Frontend)
      Kiqr.include_helpers(Kiqr::Translations)
    end

    initializer "kiqr.model_helpers" do
      ActiveSupport.on_load(:active_record) do
        extend Kiqr::Models
      end
    end

    initializer "kiqr.set_current_request_details" do
      ActiveSupport.on_load(:action_controller) do
        include Kiqr::Controllers::SetCurrentRequestDetails
      end
    end

    initializer "kiqr.add_flash_types" do
      # Add more types of flash message to match the available variants in Irelia::Notification::Component.
      ActiveSupport.on_load(:action_controller) do
        add_flash_types :success, :warning
      end
    end

    # => Devise layouts
    # Set the layout for Devise controllers
    initializer "kiqr.devise_layout" do
      config.to_prepare do
        DeviseController.layout "public"
        Devise::RegistrationsController.layout proc { |controller| user_signed_in? ? "application" : "public" }
      end
    end

    # => Load theme initializers
    # initializer "kiqr-themes-irelia.importmap", before: "importmap" do |app|
    #   theme_name = Kiqr.config.theme.to_s.camelize
    #   theme_class = "Kiqr::Themes::#{theme_name}".constantize
    #   theme_class.config.theme_path

    #   app.config.importmap.paths << File.join(theme_class.config.theme_path, "importmap.rb")
    # end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kiqr-0.1.0.alpha1 lib/kiqr/engine.rb