Class: SimpleForm::Inputs::SimpleCaptchaInput

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_captcha_reloaded/adapters/simple_form.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/simple_captcha_reloaded/adapters/simple_form.rb', line 8

def input(wrapper_options=nil)
  set_options
  @captcha = SimpleCaptchaReloaded.generate_captcha(id: options[:captcha][:id], request: template.request)

  if SimpleForm::VERSION[/^3\.0/]
    input = super()
  else
    input = super
  end
  refresh = if options[:captcha][:refresh_button]
              refresh_button(@captcha)
            else
              ""
            end
  [
    image_tag(@captcha),
    captcha_key(@captcha),
    input,
    refresh
  ].join.html_safe
end