Module: BMC::FormHelper
Instance Method Summary collapse
-
#form_hidden_submit ⇒ Object
Hidden submit to be the default triggered on <enter> keypress on a form Does not work if display:none.
- #hidden_inputs_for_get_form(url, except: []) ⇒ Object
- #search_form(action: request.fullpath) ⇒ Object
Methods included from I18nHelper
Instance Method Details
#form_hidden_submit ⇒ Object
Hidden submit to be the default triggered on <enter> keypress on a form Does not work if display:none
6 7 8 9 |
# File 'app/helpers/bmc/form_helper.rb', line 6 def form_hidden_submit css = "position:absolute;top:-9999px;left:-9999px;opacity:0;height:0;width:0;visibility: hidden" tag(:input, type: "submit", class: "hidden-submit", style: css) end |
#hidden_inputs_for_get_form(url, except: []) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/bmc/form_helper.rb', line 15 def hidden_inputs_for_get_form(url, except: []) query_values = Addressable::URI.parse(url).query_values.to_h .with_indifferent_access .except(*except) return if query_values.empty? query_values.sum { |k, v| tag.input(type: "hidden", name: k, value: v) } end |
#search_form(action: request.fullpath) ⇒ Object
11 12 13 |
# File 'app/helpers/bmc/form_helper.rb', line 11 def search_form(action: request.fullpath) render "bmc/search/form", action: action end |