Method: Cms::FormBuilder#cms_template_editor
- Defined in:
- app/helpers/cms/form_builder.rb
#cms_template_editor(method, options = {}) ⇒ Object
Renders a template editor that allows developers to edit the view used to render a specific block. Render both a ‘Handler’ select box (erb, builder, etc) and a text_area for editing. Will not display the editor if the underlying object is marked as ‘render_inline(false)’. This allows developers to edit the render.html.erb directly to update how the model displays.
For example, Portlets will often specify a :template to allow runtime update of their view.
Options:
:default_handler - Which handler will be the default when creating new instances. (Defaults to erb)
:instructions - Instructions that will be displayed below the text area. (Blank by default)
:label - The name for the label (Defaults to humanized version of field name)
174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'app/helpers/cms/form_builder.rb', line 174 def cms_template_editor(method, ={}) if object.class.render_inline # Set some defaults [:default_value] = @object.class.default_template set_default_value!(method, ) [:default_handler] = "erb" unless [:default_handler] = .extract_only!(:label, :instructions) = .extract_only!(:default_handler) add_tabindex!() render_cms_form_partial :template_editor, :method => method, :dropdown_options => , :options => , :cms_options => end end |