Skip to content

Instantly share code, notes, and snippets.

@ktec
Forked from vlado/formtastic_mark_it_up_editor.rb
Created July 8, 2010 13:13
Show Gist options
  • Save ktec/467980 to your computer and use it in GitHub Desktop.
Save ktec/467980 to your computer and use it in GitHub Desktop.
added markitup viewhelpers and force output to a string
module FormtasticExtensions
module Formtastic
module MarkItUpEditor
include MarkItUp::ViewHelpers
def self.included(base)
base.class_eval do
@mark_it_up_dependencies_included = false
end
end
protected
def mark_it_up_input(method, options = {})
dom_id = "#{@object_name}_#{method}"
output = ''
output << text_input(method, options)
output << mark_it_up(dom_id, options[:mark_it_up], @mark_it_up_dependencies_included)
end
end
end
end
if Object.const_defined?("Formtastic")
Formtastic::SemanticFormBuilder.send(:include, FormtasticExtensions::Formtastic::MarkItUpEditor)
end
@ktec
Copy link
Author

ktec commented Jul 8, 2010

Adding output='' prevents the output being escaped by formtastic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment