Module: Dima::Html::TextEditor
- Included in:
- DateField, EmailField, NumberField, TextField, WebField
- Defined in:
- lib/dima/html/field.rb
Overview
Text editor support.
Instance Method Summary collapse
Instance Method Details
#editor(opts) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dima/html/field.rb', line 8 def editor(opts) if opts[:textarea] editor = Node.new(tag: 'textarea', text: opts[:val]) else editor = Node.new(tag: 'input', attributes: { type: 'text', value: opts[:val] }) end editor[:name] = "dim[#{name}]" editor.add_class('dim-main-content') editor.add_class("#{opts[:type]}") style = '' style += "width: #{opts[:width]}px;" if opts[:width] style += "height: #{opts[:height]}px;" if opts[:height] editor.attributes[:style] = style unless Dima::Utils.empty?(style) editor end |