Class: DrgcmsFormFields::JournalDiff
- Inherits:
-
DrgcmsField
- Object
- DrgcmsField
- DrgcmsFormFields::JournalDiff
- Defined in:
- app/models/drgcms_form_fields.rb
Overview
Implementation of journal_diff DRG CMS form field. journal_diff field is used to show differences between two fields in DcJournal collection.
Form options:
-
name:
field name (required) -
type:
journal_diff (required)
Form example:
10:
name: diff
type: journal_diff
html:
size: 100x25
Instance Attribute Summary
Attributes inherited from DrgcmsField
Instance Method Summary collapse
-
#render ⇒ Object
Render journal_diff field html code.
Methods inherited from DrgcmsField
get_data, #hash_to_options, #initialize, #record_text_for, #ro_standard, #set_initial_value, #t
Constructor Details
This class inherits a constructor from DrgcmsFormFields::DrgcmsField
Instance Method Details
#render ⇒ Object
Render journal_diff field html code
354 355 356 357 358 359 360 361 362 363 364 |
# File 'app/models/drgcms_form_fields.rb', line 354 def render @yaml['name'] = 'old' if @record[@yaml['name']].nil? @html << '<table width="99%">' JSON.parse(@record[@yaml['name']]).each do |k,v| @html << "<tr><td style='background-color: #654ddd;'>#{@parent.check_box('select', k)} #{k}:</td></tr> <tr><td style='background-color: #ffe;'>#{v[0]}</td></tr> <tr><td style='background-color: #eff;'>#{v[1]}</td></tr>" end @html << '</table>' self end |