Sha256: 4ccb44cfad1e0b1768d8f8ca1efc2b87beb788acd074b55d5b91082b7501339c

Contents?: true

Size: 957 Bytes

Versions: 1

Compression:

Stored size: 957 Bytes

Contents

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

    initializer "hotwire_combobox.view_helpers" do
      ActiveSupport.on_load :action_view do
        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|
      app.config.importmap.paths << Engine.root.join("config/importmap.rb")
    end

    initializer "hotwire_combobox.assets.precompile" do |app|
      Dir.glob(File.join(Engine.root, "app/assets/**/*.{js,css}")).each do |path|
        app.config.assets.precompile << path
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hotwire_combobox-0.1.18 lib/hotwire_combobox/engine.rb