Class: MarkdownInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
lib/simple_form_markdown_editor_bootstrap/markdown_input.rb

Instance Method Summary collapse

Instance Method Details

#inputObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/simple_form_markdown_editor_bootstrap/markdown_input.rb', line 2

def input
  suffix = input_options[:suffix]

  input_id = "wmd-input#{suffix}"
  preview_id = "wmd-preview#{suffix}"
  button_bar_id = "wmd-button-bar#{suffix}"

  input_html_options.merge!({id: input_id})

  template.(:div, class: 'wmd-panel') do
    template.(:div, '', id: button_bar_id) +
    @builder.text_area(attribute_name, input_html_options)
  end +
  template.(:div, '', id: preview_id, class: 'wmd-preview')
end