Class: JsonInput

Inherits:
Formtastic::Inputs::TextInput
  • Object
show all
Defined in:
app/inputs/json_input.rb

Direct Known Subclasses

JsonbInput

Instance Method Summary collapse

Instance Method Details

#to_htmlObject



4
5
6
7
8
9
10
11
12
13
14
# File 'app/inputs/json_input.rb', line 4

def to_html
  html = '<div class="jsoneditor-wrap">'
  current_value = @object.public_send method
  html << builder.text_area(method, input_html_options.merge(
                                      value: (current_value.respond_to?(:to_json) ? current_value.to_json : '')))
  html << '</div>'
  html << '<div style="clear: both"></div>'
  input_wrapping do
    label_html << html.html_safe
  end
end