Class: DrgcmsFormFields::TextArea
- Inherits:
-
DrgcmsField
- Object
- DrgcmsField
- DrgcmsFormFields::TextArea
- 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
Instance Method Summary collapse
-
#render ⇒ Object
Render text_area field html code.
-
#ro_standard ⇒ Object
Return value for readonly field.
Methods inherited from DrgcmsField
get_data, #hash_to_options, #initialize, #record_text_for, #set_initial_value, #set_style, #t
Constructor Details
This class inherits a constructor from DrgcmsFormFields::DrgcmsField
Instance Method Details
#render ⇒ Object
Render text_area field html code
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 |
# File 'app/models/drgcms_form_fields.rb', line 1279 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_standard ⇒ Object
Return value for readonly field
1270 1271 1272 1273 1274 |
# File 'app/models/drgcms_form_fields.rb', line 1270 def ro_standard value = @record[@yaml['name']] @html << "<div class='dc-readonly'>#{value.gsub("\n",'<br>')}</div>" unless value.blank? self end |