Module: ActionView::Helpers::FormTagHelper
- Defined in:
- lib/mead_captcha/form_tag_helper.rb
Instance Method Summary collapse
-
#mead_honeypot_tag(options = {}, tag: nil, name: nil, value: nil, &block) ⇒ Object
Creates a honeypot on forms By default it creates a
that wraps around a- #mead_obfuscate_tag(name, &block) ⇒ Object
Obfuscates the name of a field and provides the name to a block.
Instance Method Details
#mead_honeypot_tag(options = {}, tag: nil, name: nil, value: nil, &block) ⇒ Object
Creates a honeypot on forms By default it creates a
that wraps around a25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
# File 'lib/mead_captcha/form_tag_helper.rb', line 25 def mead_honeypot_tag( = {}, tag: nil, name: nil, value: nil, &block) = .stringify_keys = .delete('label_options') || {} = .delete('wrapper_options') || {} name ||= mead_field_name tag ||= :div if block_given? content_tag(tag, , &block) else label = label_tag(name, name.titleize, mead_label_attributes.merge()) field = text_field_tag(name, value, mead_input_attributes.merge()) content_tag(tag, label + field, mead_wrapper_attributes.merge()) end end
#mead_obfuscate_tag(name, &block) ⇒ Object
Obfuscates the name of a field and provides the name to a block.
Examples mead_obfuscate_tag(:first_name) do |first_name| label_tag first_name text_field_tag first_name
=>
By default it creates a text_field_tag and obfuscates the name of the field.
54 55 56 57 58 59 60
# File 'lib/mead_captcha/form_tag_helper.rb', line 54 def mead_obfuscate_tag(name, &block) if block_given? capture(mead_obfuscate_field(name), &block) else mead_obfuscate_field(name) end end
- #mead_obfuscate_tag(name, &block) ⇒ Object