Permalink
Browse files

Formtastic 2.0 integration

  • Loading branch information...
1 parent 7408dba commit f54e6c45de170cad42a32a096f4cdca10f7bf43c @galetahub galetahub committed Jan 5, 2012
Showing with 10 additions and 14 deletions.
  1. +0 −1 lib/ckeditor.rb
  2. +1 −1 lib/ckeditor/engine.rb
  3. +9 −12 lib/ckeditor/hooks/formtastic.rb
View
1 lib/ckeditor.rb
@@ -14,7 +14,6 @@ module Helpers
end
module Hooks
- autoload :FormtasticBuilder, 'ckeditor/hooks/formtastic'
autoload :SimpleFormBuilder, 'ckeditor/hooks/simple_form'
end
View
2 lib/ckeditor/engine.rb
@@ -21,7 +21,7 @@ class Engine < ::Rails::Engine
initializer "ckeditor.hooks" do
if Object.const_defined?("Formtastic")
- ::Formtastic::SemanticFormBuilder.send :include, Ckeditor::Hooks::FormtasticBuilder
+ require "ckeditor/hooks/formtastic"
end
if Object.const_defined?("SimpleForm")
View
21 lib/ckeditor/hooks/formtastic.rb
@@ -1,15 +1,12 @@
-module Ckeditor
- module Hooks
- module FormtasticBuilder
- def self.included(base)
- base.send(:include, InstanceMethods)
- end
-
- module InstanceMethods
- def ckeditor_input(method, options)
- basic_input_helper(:cktext_area, :text, method, options)
- end
- end
+require "formtastic"
+
+class CkeditorInput
+ include ::Formtastic::Inputs::Base
+
+ def to_html
+ input_wrapping do
+ label_html <<
+ builder.cktext_area(method, input_html_options)
end
end
end

0 comments on commit f54e6c4

Please sign in to comment.