Sha256: 649f7e63ded085ada349c8168ffd510bad9fbfe8b04c79113d2639ade83bdaff

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

module HotwireCombobox
  class Engine < ::Rails::Engine
    isolate_namespace HotwireCombobox

    initializer "hotwire_combobox.view_helpers" do
      ActiveSupport.on_load :action_view do
        require "hotwire_combobox/helper"
        ActionView::Base.include HotwireCombobox::Helper

        unless HotwireCombobox.bypass_convenience_methods?
          module FormBuilderExtensions
            def combobox(*args, **kwargs)
              @template.hw_combobox_tag(*args, **kwargs.merge(form: self))
            end
          end

          ActionView::Helpers::FormBuilder.include FormBuilderExtensions
        end
      end
    end

    initializer "hotwire_combobox.importmap", before: "importmap" do |app|
      if Rails.application.respond_to?(:importmap)
        app.config.importmap.paths << Engine.root.join("config/hw_importmap.rb")
      end
    end

    initializer "hotwire_combobox.assets.precompile" do |app|
      if Rails.application.config.respond_to?(:assets)
        app.config.assets.precompile << "hw_combobox_manifest.js"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hotwire_combobox-0.1.41 lib/hotwire_combobox/engine.rb
hotwire_combobox-0.1.40 lib/hotwire_combobox/engine.rb
hotwire_combobox-0.1.39 lib/hotwire_combobox/engine.rb
hotwire_combobox-0.1.38 lib/hotwire_combobox/engine.rb