Class: DrgcmsFormFields::TextArea

Inherits:
DrgcmsField show all
Defined in:
app/models/drgcms_form_fields.rb

Overview

Implementation of text_area DRG CMS form field.

Form options:

  • type: text_area (required)

  • name: Field name (required)

  • html: html options which apply to text_area field (optional)

Form example:

10:
  name: css
  type: text_area
  html:
    size: 100x30

Instance Attribute Summary

Attributes inherited from DrgcmsField

#js

Instance Method Summary collapse

Methods inherited from DrgcmsField

get_data, #hash_to_options, #html, #initialize, #record_text_for, #set_initial_value, #set_style, #t

Constructor Details

This class inherits a constructor from DrgcmsFormFields::DrgcmsField

Instance Method Details

#renderObject

Render text_area field html code



1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
# File 'app/models/drgcms_form_fields.rb', line 1287

def render
  return ro_standard if @readonly
  set_initial_value
#
#  @yaml['html'] ||= {}
#  value_send_as = 'p_' + @yaml['name']
#  @yaml['html']['value'] = @parent.params[value_send_as] if @parent.params[value_send_as]

  record = record_text_for(@yaml['name'])
  @html << @parent.text_area(record, @yaml['name'], @yaml['html'])
  self
end

#ro_standardObject

Return value for readonly field



1278
1279
1280
1281
1282
# File 'app/models/drgcms_form_fields.rb', line 1278

def ro_standard
  value = @record[@yaml['name']]
  @html << "<div class='dc-readonly'>#{value.gsub("\n",'<br>')}</div>" unless value.blank?
  self
end