Sha256: 856be1e3ceb36dcf2f931944730e3949749e707755d2d78161c36ff0b78193c6

Contents?: true

Size: 688 Bytes

Versions: 12

Compression:

Stored size: 688 Bytes

Contents

module ActsAsTextcaptcha
  module TextcaptchaHelper

    # builds html fields for spam question, answer and hidden encrypted spam answers
    def textcaptcha_fields(f, &block)
      model        = f.object
      captcha_html = ''
      if model.perform_textcaptcha?
         captcha_html += f.hidden_field(:spam_answers)
         if model.spam_answer
           captcha_html += f.hidden_field(:spam_answer)
         elsif model.spam_question
           captcha_html += capture(&block)
         end
      end

      # Rails 2 compatability
      if Rails::VERSION::MAJOR < 3
        concat captcha_html, &block.binding
      else
        captcha_html.html_safe
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
acts_as_textcaptcha-3.0.11 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.10 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.9 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.8 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.7 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.6 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.5 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.4 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.3 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.2 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.1 lib/acts_as_textcaptcha/textcaptcha_helper.rb
acts_as_textcaptcha-3.0.0 lib/acts_as_textcaptcha/textcaptcha_helper.rb