Module: Traptcha::ViewHelpers
- Defined in:
- lib/traptcha/view_helpers.rb
Instance Method Summary collapse
- #captcha_image_tag ⇒ Object
- #captcha_input_tag ⇒ Object
- #captcha_label_tag ⇒ Object
- #captcha_tag ⇒ Object
Instance Method Details
#captcha_image_tag ⇒ Object
5 6 7 8 9 |
# File 'lib/traptcha/view_helpers.rb', line 5 def captcha_image_tag captcha = Traptcha::Captcha.generate tag(:img, :src => "data:image/png;base64,#{Base64.encode64(captcha.to_png)}", :id => 'traptcha', :alt => 'captcha') + hidden_field_tag(:secure_hash, captcha.value) end |
#captcha_input_tag ⇒ Object
15 16 17 |
# File 'lib/traptcha/view_helpers.rb', line 15 def captcha_input_tag text_field_tag :captcha end |
#captcha_label_tag ⇒ Object
11 12 13 |
# File 'lib/traptcha/view_helpers.rb', line 11 def captcha_label_tag label_tag :captcha end |
#captcha_tag ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/traptcha/view_helpers.rb', line 19 def captcha_tag if block_given? yield captcha_image_tag, captcha_label_tag, captcha_input_tag else content_tag :ul do concat content_tag(:li, captcha_label_tag) concat content_tag(:li, captcha_image_tag) concat content_tag(:li, captcha_input_tag) end end end |