Class: Dima::Html::EmailField

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

Overview

Display email.

Instance Attribute Summary

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 Method Details

#simple_value_nodeObject



260
261
262
263
264
265
266
267
268
# File 'lib/dima/html/field.rb', line 260

def simple_value_node
  if self.edit?
    editor(val: self.val.to_s, type: 'dim-email', width: width)
  else
    node = Node.new(tag: 'span', attributes: { class: 'dim-main-content dim-email' })
    node << Node.new(tag: 'a', attributes: { href: 'mailto:' + self.val.to_s }, text: self.val.to_s)
    node
  end
end

#value_from_text(val) ⇒ Object



270
271
272
# File 'lib/dima/html/field.rb', line 270

def value_from_text(val)
  self.val = val
end