Files
nairobi/app/components/admin/search_component.rb
Javi Martín a9427f5971 Allow custom options in search form component
So we keep the same API as the form_tag method.
2020-12-04 19:57:05 +01:00

20 lines
366 B
Ruby

class Admin::SearchComponent < ApplicationComponent
attr_reader :url, :label, :form_options
def initialize(url:, label:, **form_options)
@url = url
@label = label
@form_options = form_options
end
private
def search_terms
params[:search]
end
def options
{ method: :get, role: "search" }.merge(form_options)
end
end