Class: Effective::FormBuilderInputs::EffectiveStaticControl

Inherits:
Effective::FormBuilderInput show all
Defined in:
app/models/effective/form_builder_inputs/effective_static_control.rb

Instance Method Summary collapse

Methods inherited from Effective::FormBuilderInput

#field_name, #initialize, #js_options, #options, #value

Constructor Details

This class inherits a constructor from Effective::FormBuilderInput

Instance Method Details

#default_input_htmlObject



6
7
8
# File 'app/models/effective/form_builder_inputs/effective_static_control.rb', line 6

def default_input_html
  {class: 'form-control-static'}
end

#html_optionsObject



19
20
21
22
23
# File 'app/models/effective/form_builder_inputs/effective_static_control.rb', line 19

def html_options
  super.tap do |html_options|
    html_options[:class].delete('form-control')
  end
end

#to_htmlObject



10
11
12
13
14
15
16
17
# File 'app/models/effective/form_builder_inputs/effective_static_control.rb', line 10

def to_html
  if value.kind_of?(String) && value.start_with?('<p>') && value.end_with?('</p>')
    (:p, value[3...-4].html_safe, tag_options)
  else
    (:p, (value.html_safe? ? value : (value.to_s || '').html_safe), tag_options)
  end

end