Class: Dima::Html::TextField

Inherits:
SimpleField show all
Includes:
TextEditor
Defined in:
lib/dima/html/field.rb

Overview

Text field.

Instance Attribute Summary collapse

Attributes inherited from SimpleField

#height, #klass, #lambda, #model, #name, #readonly, #width

Attributes inherited from Field

#after, #align, #before, #edit, #form, #has_errors, #hint, #label, #required, #tooltip, #url

Instance Method Summary collapse

Methods included from TextEditor

#editor

Methods inherited from SimpleField

#<<, #>>, #empty?, #main_content_node, #readonly?

Methods inherited from Field

#after_node, #before_node, #edit?, #empty_node, #label_node, #options, #to_n, #url_node, #val, #val=, #validate, #value_node

Methods included from Init

#initialize

Methods inherited from Element

#id, #id=

Instance Attribute Details

#textareaObject

Returns the value of attribute textarea.



240
241
242
# File 'lib/dima/html/field.rb', line 240

def textarea
  @textarea
end

Instance Method Details

#simple_value_nodeObject



242
243
244
245
246
247
248
# File 'lib/dima/html/field.rb', line 242

def simple_value_node
  if self.edit?
    editor(val: self.val.to_s, type: 'dim-text', width: width, height: height, textarea: self.textarea)
  else
    Node.new(tag: 'span', attributes: { class: 'dim-main-content dim-text' }, text: self.val.to_s)
  end
end

#value_from_text(val) ⇒ Object



250
251
252
# File 'lib/dima/html/field.rb', line 250

def value_from_text(val)
  self.val = val
end