Sha256: 2b5e36372a20213405b1f7578b62506ecd11fed6218b7febb75e94e0667a5010

Contents?: true

Size: 920 Bytes

Versions: 34

Compression:

Stored size: 920 Bytes

Contents

module SimpleCaptcha
  module FormBuilder
    def self.included(base)
      base.send(:include, SimpleCaptcha::ViewHelper)
      base.send(:include, SimpleCaptcha::FormBuilder::ClassMethods)
      
      base.delegate :render, :session, :to => :template
    end
    
    module ClassMethods
      # Example:
		  # <% form_for :post, :url => posts_path do |form| %>
		  #   ...
		  #   <%= form.simple_captcha :label => "Enter numbers.." %>
		  # <% end %>
		  #
		  def simple_captcha(options = {})
      	options.update :object => @object_name
      	show_simple_captcha(objectify_options(options))
      end
      
      private
        
        def template
          @template
        end
        
        def simple_captcha_field(options={})
          text_field(:captcha, :value => '', :autocomplete => 'off') +
          hidden_field(:captcha_key, {:value => options[:field_value]})
        end
    end
  end
end

Version data entries

34 entries across 34 versions & 7 rubygems

Version Path
glebtv-simple_captcha-0.6.5 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.6.4 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.6.3 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.6.2 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.6.1 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.6.0 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.5.2 lib/simple_captcha/hooks/form_builder.rb
wxianfeng_simple_captcha-0.5.0 lib/simple_captcha/form_builder.rb
glebtv-simple_captcha-0.5.1 lib/simple_captcha/hooks/form_builder.rb
wxianfeng_simple_captcha-0.4.0 lib/simple_captcha/form_builder.rb
wxianfeng_simple_captcha-0.3.0 lib/simple_captcha/form_builder.rb
glebtv-simple_captcha-0.4.6 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.4.5 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.4.4 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.4.3 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.4.1 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.3.1 lib/simple_captcha/hooks/form_builder.rb
glebtv-simple_captcha-0.2.1 lib/simple_captcha/form_builder.rb
glebtv-simple_captcha-0.2.0 lib/simple_captcha/form_builder.rb
glebtv-simple_captcha-0.1.6 lib/simple_captcha/form_builder.rb