Class: ActionView::Helpers::FormBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/negative_captcha/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#negative_check_box_field(captcha, method, options = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/negative_captcha/form_builder.rb', line 50

def negative_check_box_field(captcha, method, options = {})
  html = @template.negative_check_box_tag(
    captcha,
    method,
    options
  ).html_safe

  if @object.errors[method].present?
    html = "<div class='fieldWithErrors'>#{html}</div>"
  end

  html.html_safe
end

#negative_file_field(captcha, method, options = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/negative_captcha/form_builder.rb', line 36

def negative_file_field(captcha, method, options = {})
  html = @template.negative_file_field_tag(
    captcha,
    method,
    options
  ).html_safe

  if @object.errors[method].present?
    html = "<div class='fieldWithErrors'>#{html}</div>"
  end

  html.html_safe
end

#negative_hidden_field(captcha, method, options = {}) ⇒ Object



32
33
34
# File 'lib/negative_captcha/form_builder.rb', line 32

def negative_hidden_field(captcha, method, options = {})
  @template.negative_hidden_field_tag(captcha, method, options).html_safe
end

#negative_label(captcha, method, name, options = {}) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/negative_captcha/form_builder.rb', line 78

def negative_label(captcha, method, name, options = {})
  html = @template.negative_label_tag(
    captcha,
    method,
    name,
    options
  ).html_safe

  if @object.errors[method].present?
    html = "<div class='fieldWithErrors'>#{html}</div>"
  end

  html.html_safe
end

#negative_password_field(captcha, method, options = {}) ⇒ Object



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

def negative_password_field(captcha, method, options = {})
  html = @template.negative_password_field_tag(
    captcha,
    method,
    options
  ).html_safe

  if @object.errors[method].present?
    html = "<div class='fieldWithErrors'>#{html}</div>"
  end

  html.html_safe
end

#negative_text_area(captcha, method, options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/negative_captcha/form_builder.rb', line 18

def negative_text_area(captcha, method, options = {})
  html = @template.negative_text_area_tag(
    captcha,
    method,
    options
  ).html_safe

  if @object.errors[method].present?
    html = "<div class='fieldWithErrors'>#{html}</div>"
  end

  html.html_safe
end

#negative_text_field(captcha, method, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/negative_captcha/form_builder.rb', line 4

def negative_text_field(captcha, method, options = {})
  html = @template.negative_text_field_tag(
    captcha,
    method,
    options
  ).html_safe

  if @object.errors[method].present?
    html = "<div class='fieldWithErrors'>#{html}</div>"
  end

  html.html_safe
end