mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Share code for context link rendering on side-by-side diffs
Summary: Ref T2009. I've clicked these links like 200 times in testing now, so I'm feeling pretty good about them. Test Plan: Viewed links in side-by-side diff, clicked them. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T2009 Differential Revision: https://secure.phabricator.com/D11981
This commit is contained in:
parent
aa98d9e5f8
commit
cb886eb60e
1 changed files with 2 additions and 62 deletions
|
@ -88,74 +88,16 @@ final class DifferentialChangesetTwoUpRenderer
|
|||
// increments $ii by the entire size of the gap and then continues
|
||||
// the loop.
|
||||
$gap = array_pop($gaps);
|
||||
|
||||
// TODO: Move this to renderShowContextLinks() once that is stable.
|
||||
|
||||
$top = $gap[0];
|
||||
$len = $gap[1];
|
||||
|
||||
$end = $top + $len - 20;
|
||||
|
||||
$contents = array();
|
||||
|
||||
if ($len > 40) {
|
||||
$is_first_block = false;
|
||||
if ($ii == 0) {
|
||||
$is_first_block = true;
|
||||
}
|
||||
|
||||
$contents[] = javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
'mustcapture' => true,
|
||||
'sigil' => 'show-more',
|
||||
'meta' => array(
|
||||
'ref' => $reference,
|
||||
'range' => "{$top}-{$len}/{$top}-20",
|
||||
),
|
||||
),
|
||||
$is_first_block
|
||||
? pht('Show First 20 Lines')
|
||||
: pht("\xE2\x96\xB2 Show 20 Lines"));
|
||||
}
|
||||
|
||||
$contents[] = javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
'mustcapture' => true,
|
||||
'sigil' => 'show-more',
|
||||
'meta' => array(
|
||||
'type' => 'all',
|
||||
'ref' => $reference,
|
||||
'range' => "{$top}-{$len}/{$top}-{$len}",
|
||||
),
|
||||
),
|
||||
pht('Show All %d Lines', $len));
|
||||
$contents = $this->renderShowContextLinks($top, $len, $rows);
|
||||
|
||||
$is_last_block = false;
|
||||
if ($ii + $len >= $rows) {
|
||||
$is_last_block = true;
|
||||
}
|
||||
|
||||
if ($len > 40) {
|
||||
$contents[] = javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
'mustcapture' => true,
|
||||
'sigil' => 'show-more',
|
||||
'meta' => array(
|
||||
'ref' => $reference,
|
||||
'range' => "{$top}-{$len}/{$end}-20",
|
||||
),
|
||||
),
|
||||
$is_last_block
|
||||
? pht('Show Last 20 Lines')
|
||||
: pht("\xE2\x96\xBC Show 20 Lines"));
|
||||
}
|
||||
|
||||
$context = null;
|
||||
$context_line = null;
|
||||
if (!$is_last_block && $depths[$ii + $len]) {
|
||||
|
@ -181,9 +123,7 @@ final class DifferentialChangesetTwoUpRenderer
|
|||
'colspan' => 2,
|
||||
'class' => 'show-more',
|
||||
),
|
||||
phutil_implode_html(
|
||||
" \xE2\x80\xA2 ", // Bullet
|
||||
$contents)),
|
||||
$contents),
|
||||
phutil_tag(
|
||||
'th',
|
||||
array(
|
||||
|
|
Loading…
Reference in a new issue