Class: DrgcmsFormFields::Comment
- Inherits:
-
DrgcmsField
- Object
- DrgcmsField
- DrgcmsFormFields::Comment
- Defined in:
- app/models/drgcms_form_fields/comment.rb
Overview
Implementation of comment DRG CMS form field. Comments may also be written on the place of form field.
Form options:
-
text:
any text. Text will be translated if key is found in translations. (required) -
type:
comment (required) -
caption:
Caption text written in label place. If set to false comment
will occupy whole row. (required)
Form example:
30:
type: comment
text: myapp.comment_text
caption: false
Instance Attribute Summary
Attributes inherited from DrgcmsField
Instance Method Summary collapse
-
#render ⇒ Object
Render comment field html code.
Methods inherited from DrgcmsField
#__css_code, get_data, #hash_to_options, #html, #initialize, #record_text_for, #ro_standard, #set_css_code, #set_default_value, #set_initial_value, #set_style, #t
Constructor Details
This class inherits a constructor from DrgcmsFormFields::DrgcmsField
Instance Method Details
#render ⇒ Object
Render comment field html code
46 47 48 49 50 |
# File 'app/models/drgcms_form_fields/comment.rb', line 46 def render comment = @yaml['comment'] || @yaml['text'] @html << "<div class=\"dc-comment\">#{t(comment, comment).gsub("\n",'<br>')}</div>" self end |