Differential D17269 Diff 41842 src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | public function renderTextChange( | ||||
$primitives = $this->buildPrimitives($range_start, $range_len); | $primitives = $this->buildPrimitives($range_start, $range_len); | ||||
return $this->renderPrimitives($primitives, $rows); | return $this->renderPrimitives($primitives, $rows); | ||||
} | } | ||||
protected function renderPrimitives(array $primitives, $rows) { | protected function renderPrimitives(array $primitives, $rows) { | ||||
$out = array(); | $out = array(); | ||||
$viewer = $this->getUser(); | |||||
$old_bright = $viewer->getCSSValue('old-bright'); | |||||
$new_bright = $viewer->getCSSValue('new-bright'); | |||||
$context_style = array( | $context_style = array( | ||||
'background: #F7F7F7;', | 'background: #F7F7F7;', | ||||
'color: #74777D;', | 'color: #74777D;', | ||||
'border-style: dashed;', | 'border-style: dashed;', | ||||
'border-color: #C7CCD9;', | 'border-color: #C7CCD9;', | ||||
'border-width: 1px 0;', | 'border-width: 1px 0;', | ||||
); | ); | ||||
$context_style = implode(' ', $context_style); | $context_style = implode(' ', $context_style); | ||||
foreach ($primitives as $k => $p) { | foreach ($primitives as $k => $p) { | ||||
$type = $p['type']; | $type = $p['type']; | ||||
switch ($type) { | switch ($type) { | ||||
case 'old': | case 'old': | ||||
case 'new': | case 'new': | ||||
case 'old-file': | case 'old-file': | ||||
case 'new-file': | case 'new-file': | ||||
$is_old = ($type == 'old' || $type == 'old-file'); | $is_old = ($type == 'old' || $type == 'old-file'); | ||||
if ($is_old) { | if ($is_old) { | ||||
if ($p['htype']) { | if ($p['htype']) { | ||||
$style = 'background: #ffd0d0;'; | $style = "background: {$old_bright};"; | ||||
} else { | } else { | ||||
$style = null; | $style = null; | ||||
} | } | ||||
} else { | } else { | ||||
if ($p['htype']) { | if ($p['htype']) { | ||||
$style = 'background: #d0ffd0;'; | $style = "background: {$new_bright};"; | ||||
} else { | } else { | ||||
$style = null; | $style = null; | ||||
} | } | ||||
} | } | ||||
$out[] = array( | $out[] = array( | ||||
'style' => $style, | 'style' => $style, | ||||
'render' => $p['render'], | 'render' => $p['render'], | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |