class SimpleCaptchaInput
Public Instance Methods
captcha_key(captcha)
click to toggle source
# File lib/simple_captcha_reloaded/adapters/formtastic.rb, line 29 def captcha_key(captcha) builder.hidden_field :captcha_key, value: captcha[:captcha_id] end
image_tag(captcha)
click to toggle source
# File lib/simple_captcha_reloaded/adapters/formtastic.rb, line 25 def image_tag(captcha) template.content_tag(:img, nil, src: captcha[:captcha_url], alt: 'Captcha', class: 'simple-captcha-image') end
set_options!()
click to toggle source
# File lib/simple_captcha_reloaded/adapters/formtastic.rb, line 14 def set_options! default_options = { refresh_button: true, id: 'simple_captcha_wrapper' } options[:wrapper_html] ||= {} options[:captcha] ||= {} options[:captcha].reverse_merge!(default_options) options[:wrapper_html][:id] ||= options[:captcha][:id] end
to_html()
click to toggle source
# File lib/simple_captcha_reloaded/adapters/formtastic.rb, line 2 def to_html set_options! captcha = SimpleCaptchaReloaded.generate_captcha(id: options[:captcha][:id], request: template.request) input_wrapping do label_html << image_tag(captcha) << captcha_key(captcha) << builder.text_field(method, input_html_options) << refresh_button(captcha) end end