Class: Ezframe::TextareaType

Inherits:
TextType show all
Defined in:
lib/ezframe/column_type.rb

Instance Attribute Summary

Attributes inherited from TypeBase

#attribute, #error, #parent

Instance Method Summary collapse

Methods inherited from TextType

#db_type, #normalize

Methods inherited from TypeBase

#db_type, #db_value, #form_html, get_class, #initialize, #key, #label, #multi_inputs?, #no_edit?, #no_view?, #normalize, type_name, #validate, #value, #view

Constructor Details

This class inherits a constructor from Ezframe::TypeBase

Instance Method Details

#form(opts = {}) ⇒ Object



139
140
141
142
143
144
145
146
147
148
# File 'lib/ezframe/column_type.rb', line 139

def form(opts = {})
  return nil if no_edit? && !opts[:force]
  val = @value
  if val && val.length>0
    val.gsub!(/\n/, "<br>")
  end
  h = Ht.textarea(name: self.key, label: @attribute[:label], child: val)
  h[:class] = @attribute[:class] if @attribute[:class]
  return h
end

#value=(val) ⇒ Object



133
134
135
136
137
# File 'lib/ezframe/column_type.rb', line 133

def value=(val)
  val = normalize(val)
  val.gsub!(/<br>/, "\n") if val
  @value = val
end