Sha256: 27a77aa72d7a031890b77bc5147a9887ce9e3f01dd782ac4755c05d31e1e760b
Contents?: true
Size: 896 Bytes
Versions: 2
Compression:
Stored size: 896 Bytes
Contents
module BMC::FormHelper include BMC::I18nHelper # Hidden submit to be the default triggered on <enter> keypress on a form # Does not work if display:none 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 def search_form(action: request.fullpath, placeholder: ta(:search)) render "bmc/search/form", action:, placeholder: end def hidden_inputs_for_get_form(url, except: nil, only: nil) query_values = Addressable::URI.parse(url).query_values.to_h.with_indifferent_access query_values.except!(*except) if except query_values.select! { only.map(&:to_sym).include?(_1.to_sym) } if only return if query_values.empty? query_values.sum("".html_safe) { |k, v| tag.input(type: "hidden", name: k, value: v) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bmc-1.6.1 | app/helpers/bmc/form_helper.rb |
bmc-1.6.0 | app/helpers/bmc/form_helper.rb |