Permalink
Browse files

Update for mongoid 3 / new formtastic

  • Loading branch information...
1 parent 84dd680 commit d182c67affe5caf16c20e123be78a64c0a6a244b @glebtv committed Nov 15, 2012
View
1 .gitignore 100644 → 100755
@@ -18,3 +18,4 @@ spec/dummy/vendor/bundle/
spec/dummy/app/helpers/manage
spec/dummy/config/database.yml
spec/dummy/log/development.log
+.idea
View
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in gemspec
+gemspec
View
6 README.rdoc 100644 → 100755
@@ -1,5 +1,7 @@
=SimpleCaptcha
+This is a fork of wolcanus's fork of SimpleCaptcha to support Mongoid 3 and new formtastic.
+
This is a fork of galetahub SimpleCaptcha to support Mongoid.
Its implementation requires
adding up a single line in views and in controllers/models.
@@ -25,11 +27,11 @@ backward compatibility with previous versions of Rails.
==Installation
- gem "wolcanus-simple_captcha", :require => "simple_captcha"
+ gem "glebtv-simple_captcha", :require => "simple_captcha"
or
- gem 'wolcanus-simple_captcha', :require => 'simple_captcha', :git => 'git://github.com/wolcanus/simple-captcha.git'
+ gem 'glebtv-simple_captcha', :require => 'simple_captcha', :git => 'git://github.com/glebtv/simple-captcha.git'
==Setup
View
2 Rakefile 100644 → 100755
@@ -1,6 +1,6 @@
require 'rake'
require 'rake/testtask'
-require 'rake/rdoctask'
+require 'rdoc/task'
desc 'Default: run unit tests.'
task :default => :test
Binary file not shown.
View
10 lib/simple_captcha/engine.rb 100644 → 100755
@@ -14,17 +14,11 @@ class Engine < ::Rails::Engine
ActionView::Base.send(:include, SimpleCaptcha::ViewHelper)
ActionView::Helpers::FormBuilder.send(:include, SimpleCaptcha::FormBuilder)
- if Object.const_defined?("Formtastic")
- if Formtastic.const_defined?("Helpers")
- Formtastic::Helpers::FormHelper.builder = SimpleCaptcha::CustomFormBuilder
- else
- Formtastic::SemanticFormHelper.builder = SimpleCaptcha::CustomFormBuilder
- end
+ if Object.const_defined?("Formtastic") && Formtastic.const_defined?("Inputs")
+ require "simple_captcha/formtastic"
end
end
config.app_middleware.use SimpleCaptcha::Middleware
end
end
-
-
View
17 lib/simple_captcha/formtastic.rb 100644 → 100755
@@ -1,11 +1,14 @@
-module SimpleCaptcha
- class CustomFormBuilder < Formtastic::SemanticFormBuilder
+require "formtastic"
- private
+class SimpleCaptchaInput
+ include ::Formtastic::Inputs::Base
+ include ::Formtastic::Inputs::Base::Stringish
- def simple_captcha_input(method, options)
- options.update :object => sanitized_object_name
- self.send(:show_simple_captcha, options)
+ def to_html
+ input_wrapping do
+ input_html_options.update :object => method
+ label_html << builder.show_simple_captcha(input_html_options)
+ # label_html << builder.text_field(method, input_html_options)
end
end
-end
+end
View
18 simple_captcha.gemspec 100644 → 100755
@@ -3,19 +3,19 @@ $:.push File.expand_path("../lib", __FILE__)
require "simple_captcha/version"
Gem::Specification.new do |s|
- s.name = "wolcanus-simple_captcha"
+ s.name = "glebtv-simple_captcha"
s.version = SimpleCaptcha::VERSION.dup
- s.platform = Gem::Platform::RUBY
- s.summary = "A fork of galetahub SimpleCaptcha for mongoid support."
- s.description = "SimpleCaptcha is available to be used with Rails 3 or above and also it provides the backward compatibility with previous versions of Rails."
+ s.platform = Gem::Platform::RUBY
+ s.summary = "A fork of a wolcanus fork of galetahub SimpleCaptcha for mongoid support."
+ s.description = "."
s.authors = ["Weverton do Couto Timoteo"]
s.email = "weverton@wolcan.us"
- s.homepage = "http://github.com/wolcanus/simple-captcha"
+ s.homepage = "http://github.com/glebtv/simple-captcha"
s.add_dependency("mongoid", ["~> 3.0.0"])
-
- s.files = Dir["{lib}/**/*"] + ["Rakefile", "README.rdoc"]
+
+ s.files = Dir["{lib}/**/*"] + %w(Rakefile README.rdoc)
s.test_files = Dir["{test}/**/*"]
- s.extra_rdoc_files = ["README.rdoc"]
- s.require_paths = ["lib"]
+ s.extra_rdoc_files = %w(README.rdoc)
+ s.require_paths = %w(lib)
end

0 comments on commit d182c67

Please sign in to comment.