Sha256: fefc4a56b0ae2f4d034b5c3927a12365a9881334d99e35497664c31d55a15c5f

Contents?: true

Size: 747 Bytes

Versions: 8

Compression:

Stored size: 747 Bytes

Contents

class TemplateEditorInput < SimpleForm::Inputs::TextInput

  include Cms::FormBuilder::DefaultInput

  def label(_wrapper_options = nil)
    super if render_template_input?
  end

  def input(_wrapper_options = nil)
    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

8 entries across 8 versions & 1 rubygems

Version Path
browsercms-artirix-4.0.4 app/inputs/template_editor_input.rb
browsercms-artirix-4.0.3.3 app/inputs/template_editor_input.rb
browsercms-artirix-4.0.3.2 app/inputs/template_editor_input.rb
browsercms-artirix-4.0.3.1 app/inputs/template_editor_input.rb
browsercms-artirix-4.0.3 app/inputs/template_editor_input.rb
browsercms-artirix-4.0.2 app/inputs/template_editor_input.rb
browsercms-artirix-4.0.1.1 app/inputs/template_editor_input.rb
browsercms-artirix-4.0.0.rc1.art4 app/inputs/template_editor_input.rb