Class: Rails::AddOns::SearchFormHelper::SearchFormBuilder

Inherits:
SimpleForm::FormBuilder
  • Object
show all
Defined in:
app/helpers/rails/add_ons/search_form_helper.rb

Instance Method Summary collapse

Instance Method Details

#boolean(name, options = {}) ⇒ Object


19
20
21
22
23
# File 'app/helpers/rails/add_ons/search_form_helper.rb', line 19

def boolean(name, options = {})
  translated_label = translate_label_for_boolean(name)
  options.reverse_merge!(collection: [[I18n.t("search_form_builder.yes"), 1], [I18n.t("search_form_builder.no"), 0]], include_blank: true, label: translated_label)
  input name, options
end

#input(name, options = {}) ⇒ Object


25
26
27
28
# File 'app/helpers/rails/add_ons/search_form_helper.rb', line 25

def input(name, options = {})
  translated_label = translate_label(name)
  super(name, options.reverse_merge(label: translated_label))
end

#reset(title = nil, options = {}) ⇒ Object


35
36
37
38
39
# File 'app/helpers/rails/add_ons/search_form_helper.rb', line 35

def reset(title = nil, options = {})
  title ||= I18n.t('search_form_builder.reset')
  link_html = options.delete(:link_html) || {}
  template.link_to(title, template.url_for(), link_html)
end

#submit(title = nil, options = {}) ⇒ Object


30
31
32
33
# File 'app/helpers/rails/add_ons/search_form_helper.rb', line 30

def submit(title = nil, options = {})
  title ||= I18n.t('search_form_builder.submit')
  super(title, options)
end