negative_captcha 0.2.beta2 → 0.2.beta3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,13 @@
1
1
  module ActionView
2
2
  module Helpers
3
3
  class FormBuilder
4
+ def negative_captcha(captcha)
5
+ [
6
+ hidden_field_tag('timestamp', captcha.timestamp),
7
+ hidden_field_tag('spinner', captcha.spinner),
8
+ ].join
9
+ end
10
+
4
11
  def negative_text_field(captcha, method, options = {})
5
12
  html = @template.negative_text_field_tag(
6
13
  captcha,
@@ -1,64 +1,62 @@
1
- module NegativeCaptchaViewHelpers
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- end
1
+ module ActionView
2
+ module Helpers
3
+ module FormTagHelpers
4
+ def negative_captcha(captcha)
5
+ [
6
+ hidden_field_tag('timestamp', captcha.timestamp),
7
+ hidden_field_tag('spinner', captcha.spinner),
8
+ ].join
9
+ end
6
10
 
7
- module ClassMethods
8
- def negative_captcha(captcha)
9
- [
10
- hidden_field_tag('timestamp', captcha.timestamp),
11
- hidden_field_tag('spinner', captcha.spinner),
12
- ].join
13
- end
11
+ def negative_text_field_tag(negative_captcha, field, options={})
12
+ text_field_tag(
13
+ negative_captcha.fields[field],
14
+ negative_captcha.values[field],
15
+ options
16
+ ) +
17
+ content_tag('div', :style => 'position: absolute; left: -2000px;') do
18
+ text_field_tag(field, '', :tabindex => '999', :autocomplete => 'off')
19
+ end
20
+ end
14
21
 
15
- def negative_text_field_tag(negative_captcha, field, options={})
16
- text_field_tag(
17
- negative_captcha.fields[field],
18
- negative_captcha.values[field],
19
- options
20
- ) +
21
- content_tag('div', :style => 'position: absolute; left: -2000px;') do
22
- text_field_tag(field, '', :tabindex => '999', :autocomplete => 'off')
22
+ def negative_text_area_tag(negative_captcha, field, options={})
23
+ text_area_tag(
24
+ negative_captcha.fields[field],
25
+ negative_captcha.values[field],
26
+ options
27
+ ) +
28
+ content_tag('div', :style => 'position: absolute; left: -2000px;') do
29
+ text_area_tag(field, '', :tabindex => '999', :autocomplete => 'off')
30
+ end
23
31
  end
24
- end
25
32
 
26
- def negative_text_area_tag(negative_captcha, field, options={})
27
- text_area_tag(
28
- negative_captcha.fields[field],
29
- negative_captcha.values[field],
30
- options
31
- ) +
32
- content_tag('div', :style => 'position: absolute; left: -2000px;') do
33
- text_area_tag(field, '', :tabindex => '999', :autocomplete => 'off')
33
+ def negative_hidden_field_tag(negative_captcha, field, options={})
34
+ hidden_field_tag(
35
+ negative_captcha.fields[field],
36
+ negative_captcha.values[field],
37
+ options
38
+ ) +
39
+ "<div style='position: absolute; left: -2000px;'>" +
40
+ hidden_field_tag(field, '', :tabindex => '999') +
41
+ "</div>"
34
42
  end
35
- end
36
43
 
37
- def negative_hidden_field_tag(negative_captcha, field, options={})
38
- hidden_field_tag(
39
- negative_captcha.fields[field],
40
- negative_captcha.values[field],
41
- options
42
- ) +
43
- "<div style='position: absolute; left: -2000px;'>" +
44
- hidden_field_tag(field, '', :tabindex => '999') +
45
- "</div>"
46
- end
44
+ def negative_password_field_tag(negative_captcha, field, options={})
45
+ password_field_tag(
46
+ negative_captcha.fields[field],
47
+ negative_captcha.values[field],
48
+ options
49
+ ) +
50
+ "<div style='position: absolute; left: -2000px;'>" +
51
+ password_field_tag(field, '', :tabindex => '999') +
52
+ "</div>"
53
+ end
47
54
 
48
- def negative_password_field_tag(negative_captcha, field, options={})
49
- password_field_tag(
50
- negative_captcha.fields[field],
51
- negative_captcha.values[field],
52
- options) +
53
- "<div style='position: absolute; left: -2000px;'>" +
54
- password_field_tag(field, '', :tabindex => '999') +
55
- "</div>"
55
+ def negative_label_tag(negative_captcha, field, name, options={})
56
+ label_tag(negative_captcha.fields[field], name, options)
57
+ end
56
58
  end
57
59
 
58
- def negative_label_tag(negative_captcha, field, name, options={})
59
- label_tag(negative_captcha.fields[field], name, options)
60
- end
60
+ #TODO: Select, check_box, etc
61
61
  end
62
-
63
- #TODO: Select, check_box, etc
64
62
  end
@@ -78,6 +78,4 @@ end
78
78
 
79
79
 
80
80
  require 'negative_captcha/view_helpers'
81
- ActionView::Base.send :include, NegativeCaptchaViewHelpers
82
-
83
81
  require "negative_captcha/form_builder"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: negative_captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.beta2
4
+ version: 0.2.beta3
5
5
  prerelease: 4
6
6
  platform: ruby
7
7
  authors: