Module: ActionView::Helpers::NegativeCaptchaHelpers

Defined in:
lib/negative_captcha/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#negative_captcha(captcha) ⇒ Object



4
5
6
7
8
9
# File 'lib/negative_captcha/view_helpers.rb', line 4

def negative_captcha(captcha)
  [
    hidden_field_tag('timestamp', captcha.timestamp),
    hidden_field_tag('spinner', captcha.spinner),
  ].join.html_safe
end

#negative_check_box_tag(negative_captcha, field, options = {}) ⇒ Object



65
66
67
68
69
70
71
72
73
74
# File 'lib/negative_captcha/view_helpers.rb', line 65

def negative_check_box_tag(negative_captcha, field, options={})
  check_box_tag(
    negative_captcha.fields[field],
    negative_captcha.values[field],
    options
  ) +
  ('div', :style => negative_captcha.css) do
    check_box_tag(field, '', :tabindex => '999')
  end
end

#negative_email_field_tag(negative_captcha, field, options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/negative_captcha/view_helpers.rb', line 22

def negative_email_field_tag(negative_captcha, field, options={})
  email_field_tag(
    negative_captcha.fields[field],
    negative_captcha.values[field],
    options
  ) +
    ('div', :style => 'position: absolute; left: -2000px;') do
    email_field_tag(field, '', :tabindex => '999', :autocomplete => 'off')
  end.html_safe
end

#negative_file_field_tag(negative_captcha, field, options = {}) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/negative_captcha/view_helpers.rb', line 55

def negative_file_field_tag(negative_captcha, field, options={})
  file_field_tag(
    negative_captcha.fields[field],
    options.merge(:value => negative_captcha.values[field])
  ) +
  ('div', :style => negative_captcha.css) do
    file_field_tag(field, :tabindex => '999')
  end
end

#negative_hidden_field_tag(negative_captcha, field, options = {}) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/negative_captcha/view_helpers.rb', line 44

def negative_hidden_field_tag(negative_captcha, field, options={})
  hidden_field_tag(
    negative_captcha.fields[field],
    negative_captcha.values[field],
    options
  ) +
  ('div', :style => negative_captcha.css) do
    hidden_field_tag(field, '', :tabindex => '999')
  end.html_safe
end

#negative_label_tag(negative_captcha, field, name, options = {}, &block) ⇒ Object



87
88
89
# File 'lib/negative_captcha/view_helpers.rb', line 87

def negative_label_tag(negative_captcha, field, name, options={}, &block)
  label_tag(negative_captcha.fields[field], name, options, &block)
end

#negative_password_field_tag(negative_captcha, field, options = {}) ⇒ Object



76
77
78
79
80
81
82
83
84
85
# File 'lib/negative_captcha/view_helpers.rb', line 76

def negative_password_field_tag(negative_captcha, field, options={})
  password_field_tag(
    negative_captcha.fields[field],
    negative_captcha.values[field],
    options
  ) +
  ('div', :style => negative_captcha.css) do
    password_field_tag(field, '', :tabindex => '999')
  end.html_safe
end

#negative_text_area_tag(negative_captcha, field, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/negative_captcha/view_helpers.rb', line 33

def negative_text_area_tag(negative_captcha, field, options={})
  text_area_tag(
    negative_captcha.fields[field],
    negative_captcha.values[field],
    options
  ) +
    ('div', :style => negative_captcha.css) do
    text_area_tag(field, '', :tabindex => '999', :autocomplete => 'off')
  end.html_safe
end

#negative_text_field_tag(negative_captcha, field, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/negative_captcha/view_helpers.rb', line 11

def negative_text_field_tag(negative_captcha, field, options={})
  text_field_tag(
    negative_captcha.fields[field],
    negative_captcha.values[field],
    options
  ) +
    ('div', :style => negative_captcha.css) do
    text_field_tag(field, '', :tabindex => '999', :autocomplete => 'off')
  end.html_safe
end