Sha256: fa874157a3aa114cc0a3b76a3a96d87b735eeea596d4a828fcbece8ce765fb32

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

class TemplateEditorInput < SimpleForm::Inputs::TextInput

  include Cms::FormBuilder::DefaultInput

  def label
    super if render_template_input?
  end

  def input
    if render_template_input?
      options[:default] = object.class.default_template
      options[:default_handler] = "erb" unless options[:default_handler]
      view = @builder.select "#{attribute_name}_handler", ActionView::Template.template_handler_extensions, selected: options[:default_handler]
      view << '<br />'.html_safe
      extract_default
      view << @builder.text_area(attribute_name, input_html_options).html_safe
    end
  end

  private
  def render_template_input?
    object.class.render_inline
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
browsercms-4.0.0.rc1 app/inputs/template_editor_input.rb
browsercms-4.0.0.beta app/inputs/template_editor_input.rb
browsercms-4.0.0.alpha app/inputs/template_editor_input.rb