Module: RuCaptcha::ViewHelpers

Defined in:
lib/rucaptcha/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#rucaptcha_image_tag(opts = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/rucaptcha/view_helpers.rb', line 14

def rucaptcha_image_tag(opts = {})
  opts[:class] = opts[:class] || 'rucaptcha-image'
  opts[:src] = ru_captcha.root_path
  opts[:onclick] = "this.src = '#{ru_captcha.root_path}?t=' + Date.now();"
  tag(:img, opts)
end

#rucaptcha_input_tag(opts = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/rucaptcha/view_helpers.rb', line 3

def rucaptcha_input_tag(opts = {})
  opts[:name]           = '_rucaptcha'
  opts[:type]           = 'text'
  opts[:autocorrect]    = 'off'
  opts[:autocapitalize] = 'off'
  opts[:pattern]        = '[a-zA-Z]*'
  opts[:autocomplete]   = 'off'
  opts[:maxlength] ||= 5
  tag(:input, opts)
end