Differential D20845 Diff 49697 src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
Show First 20 Lines • Show All 363 Lines • ▼ Show 20 Lines | public function renderTextChange( | ||||
return $this->wrapChangeInTable(phutil_implode_html('', $html)); | return $this->wrapChangeInTable(phutil_implode_html('', $html)); | ||||
} | } | ||||
public function renderDocumentEngineBlocks( | public function renderDocumentEngineBlocks( | ||||
PhabricatorDocumentEngineBlocks $block_list, | PhabricatorDocumentEngineBlocks $block_list, | ||||
$old_changeset_key, | $old_changeset_key, | ||||
$new_changeset_key) { | $new_changeset_key) { | ||||
$engine = $this->getDocumentEngine(); | |||||
$old_ref = null; | |||||
$new_ref = null; | |||||
$refs = $block_list->getDocumentRefs(); | |||||
if ($refs) { | |||||
list($old_ref, $new_ref) = $refs; | |||||
} | |||||
$old_comments = $this->getOldComments(); | $old_comments = $this->getOldComments(); | ||||
$new_comments = $this->getNewComments(); | $new_comments = $this->getNewComments(); | ||||
$gap_view = javelin_tag( | $gap_view = javelin_tag( | ||||
'tr', | 'tr', | ||||
array( | array( | ||||
'sigil' => 'context-target', | 'sigil' => 'context-target', | ||||
), | ), | ||||
phutil_tag( | phutil_tag( | ||||
'td', | 'td', | ||||
array( | array( | ||||
'colspan' => 6, | 'colspan' => 6, | ||||
'class' => 'show-more', | 'class' => 'show-more', | ||||
), | ), | ||||
pht("\xE2\x80\xA2 \xE2\x80\xA2 \xE2\x80\xA2"))); | pht("\xE2\x80\xA2 \xE2\x80\xA2 \xE2\x80\xA2"))); | ||||
$rows = array(); | $rows = array(); | ||||
$in_gap = false; | $in_gap = false; | ||||
foreach ($block_list->newTwoUpLayout() as $row) { | foreach ($block_list->newTwoUpLayout() as $row) { | ||||
list($old, $new) = $row; | list($old, $new) = $row; | ||||
if ($old) { | if ($old) { | ||||
$old_key = $old->getBlockKey(); | $old_key = $old->getBlockKey(); | ||||
$old_classes = $old->getClasses(); | |||||
if ($old->getDifferenceType() === '-') { | |||||
$old_classes[] = 'old'; | |||||
$old_classes[] = 'old-full'; | |||||
} | |||||
$old_classes[] = 'diff-flush'; | |||||
$old_classes = implode(' ', $old_classes); | |||||
$is_visible = $old->getIsVisible(); | $is_visible = $old->getIsVisible(); | ||||
} else { | } else { | ||||
$old_key = null; | $old_key = null; | ||||
$old_classes = null; | |||||
} | } | ||||
if ($new) { | if ($new) { | ||||
$new_key = $new->getBlockKey(); | $new_key = $new->getBlockKey(); | ||||
$new_classes = $new->getClasses(); | |||||
if ($new->getDifferenceType() === '+') { | |||||
$new_classes[] = 'new'; | |||||
$new_classes[] = 'new-full'; | |||||
} | |||||
$new_classes[] = 'diff-flush'; | |||||
$new_classes = implode(' ', $new_classes); | |||||
$is_visible = $new->getIsVisible(); | $is_visible = $new->getIsVisible(); | ||||
} else { | } else { | ||||
$new_key = null; | $new_key = null; | ||||
$new_classes = null; | |||||
} | } | ||||
if (!$is_visible) { | if (!$is_visible) { | ||||
if (!$in_gap) { | if (!$in_gap) { | ||||
$in_gap = true; | $in_gap = true; | ||||
$rows[] = $gap_view; | $rows[] = $gap_view; | ||||
} | } | ||||
continue; | continue; | ||||
Show All 11 Lines | foreach ($block_list->newTwoUpLayout() as $row) { | ||||
if ($new) { | if ($new) { | ||||
$is_add = ($new->getDifferenceType() === '+'); | $is_add = ($new->getDifferenceType() === '+'); | ||||
} else { | } else { | ||||
$is_add = false; | $is_add = false; | ||||
} | } | ||||
if ($is_rem && $is_add) { | if ($is_rem && $is_add) { | ||||
list($old_content, $new_content) = array( | $block_diff = $engine->newBlockDiffViews( | ||||
$old->newContentView(), | $old_ref, | ||||
$new->newContentView(), | $old, | ||||
); | $new_ref, | ||||
$new); | |||||
$old_content = $block_diff->getOldContent(); | |||||
$new_content = $block_diff->getNewContent(); | |||||
$old_classes = $block_diff->getOldClasses(); | |||||
$new_classes = $block_diff->getNewClasses(); | |||||
} else { | } else { | ||||
$old_classes = array(); | |||||
$new_classes = array(); | |||||
if ($old) { | if ($old) { | ||||
$old_content = $old->newContentView(); | $old_content = $engine->newBlockContentView( | ||||
$old_ref, | |||||
$old); | |||||
if ($is_rem) { | |||||
$old_classes[] = 'old'; | |||||
$old_classes[] = 'old-full'; | |||||
} | |||||
} else { | } else { | ||||
$old_content = null; | $old_content = null; | ||||
} | } | ||||
if ($new) { | if ($new) { | ||||
$new_content = $new->newContentView(); | $new_content = $engine->newBlockContentView( | ||||
$new_ref, | |||||
$new); | |||||
if ($is_add) { | |||||
$new_classes[] = 'new'; | |||||
$new_classes[] = 'new-full'; | |||||
} | |||||
} else { | } else { | ||||
$new_content = null; | $new_content = null; | ||||
} | } | ||||
} | } | ||||
$old_classes[] = 'diff-flush'; | |||||
$old_classes = implode(' ', $old_classes); | |||||
$new_classes[] = 'diff-flush'; | |||||
$new_classes = implode(' ', $new_classes); | |||||
$old_inline_rows = array(); | $old_inline_rows = array(); | ||||
if ($old_key !== null) { | if ($old_key !== null) { | ||||
$old_inlines = idx($old_comments, $old_key, array()); | $old_inlines = idx($old_comments, $old_key, array()); | ||||
foreach ($old_inlines as $inline) { | foreach ($old_inlines as $inline) { | ||||
$inline = $this->buildInlineComment( | $inline = $this->buildInlineComment( | ||||
$inline, | $inline, | ||||
$on_right = false); | $on_right = false); | ||||
$old_inline_rows[] = $this->getRowScaffoldForInline($inline); | $old_inline_rows[] = $this->getRowScaffoldForInline($inline); | ||||
▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines |