Created
April 5, 2013 15:27
-
-
Save dcvezzani/5320204 to your computer and use it in GitHub Desktop.
Adds rich text editor (rich text only, no plain text option) form helper.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rails-app/browsercms/app/helpers/cms/form_builder.rb | |
# | |
# Adds additional form fields to the Rails FormBuilder which can be used to create CMS forms. | |
# | |
class Cms::FormBuilder < ActionView::Helpers::FormBuilder | |
... | |
# Renders a WYWIWYG rich text editor. | |
def cms_richtext_editor(method, options = {}) | |
add_tabindex!(options) | |
set_default_value!(method, options) | |
cms_options = options.extract_only!(:label, :instructions, :default_value) | |
render_cms_form_partial :richtext_editor, | |
:id => (options[:id] || "#{@object_name}_#{method}"), | |
:editor_enabled => (cookies["editorEnabled"].blank? ? true : (cookies["editorEnabled"] == 'true' || cookies["editorEnabled"] == ['true'])), | |
:object_name => @object_name, :method => method, | |
:options => options, :cms_options => cms_options | |
end | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment