Module: CaptchaHelper
- Defined in:
- lib/captcha3/captcha_helper.rb
Instance Method Summary collapse
- #captcha_block(label = '请输入验证码') ⇒ Object
- #captcha_hidden_text ⇒ Object
- #captcha_image(options = {}) ⇒ Object
- #captcha_input_text(label, options = {}) ⇒ Object
Instance Method Details
#captcha_block(label = '请输入验证码') ⇒ Object
16 17 18 |
# File 'lib/captcha3/captcha_helper.rb', line 16 def captcha_block(label='请输入验证码') content_tag("div", captcha_hidden_text + captcha_input_text(label) + captcha_image, {:class => 'captcha'}) end |
#captcha_hidden_text ⇒ Object
11 12 13 14 |
# File 'lib/captcha3/captcha_helper.rb', line 11 def captcha_hidden_text @captcha_image ||= CaptchaUtil.random_image hidden_field_tag(:captcha_validation, @captcha_image.gsub(/\..+$/, '')) end |
#captcha_image(options = {}) ⇒ Object
2 3 4 5 |
# File 'lib/captcha3/captcha_helper.rb', line 2 def captcha_image( = {}) @captcha_image ||= CaptchaUtil.random_image image_tag("/system/captcha3/" + @captcha_image, ) end |
#captcha_input_text(label, options = {}) ⇒ Object
7 8 9 |
# File 'lib/captcha3/captcha_helper.rb', line 7 def captcha_input_text(label, = {}) content_tag('label', label, :for => 'captcha') + text_field_tag(:captcha, nil, ) end |