Skip to content

Commit

Permalink
Change text color to blue for different columns when displaying Drift…
Browse files Browse the repository at this point in the history
… for VM
  • Loading branch information
hstastna committed May 14, 2018
1 parent 2e5eb63 commit 9b54973
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/controllers/application_controller/compare.rb
Expand Up @@ -1208,15 +1208,17 @@ def drift_add_section_field_expanded(view, section, field)
next if fld.nil?
val = fld[:_value_].to_s

style = nil
if idx.zero? # On base object
img_bkg = "cell-stripe"
elsif fld[:_match_]
img_bkg = "cell-bkg-plain-no-shade"
else
style = "color: #21a0ec;" if fld[:_match_] == false
img_bkg = "cell-bkg-plain-mark-txt-no-shade"
unset_same_flag
end
row.merge!(drift_add_txt_col(idx, val, img_bkg))
row.merge!(drift_add_txt_col(idx, val, img_bkg, style))
end
row
end
Expand All @@ -1240,8 +1242,12 @@ def drift_add_image_col(idx, img_src, img_bkg, val)
{"col#{idx + 1}".to_sym => html}
end

def drift_add_txt_col(idx, col, img_bkg)
html_text = "<div class='#{img_bkg}'>#{col}</div>"
def drift_add_txt_col(idx, col, img_bkg, style = nil)
html_text = if style.present?
"<div class='#{img_bkg}' style='#{style}'>#{col}</div>"
else
"<div class='#{img_bkg}'>#{col}</div>"
end
{"col#{idx + 1}".to_sym => html_text}
end

Expand Down

0 comments on commit 9b54973

Please sign in to comment.