From b70b9bb6d7009ba6ac800f77f0dc4252c8a807eb Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 29 Jul 2011 13:46:53 -0700 Subject: [PATCH] Be more explicit in rendering context links in Differential Summary: See T368. The current rendering result can cause some confusion for the first/last chunks, make their behavior more explicit. Test Plan: - Clicked various "show more" links on a bunch of top/bottom/middle omitted context blocks in a variety of diffs. - Located a @generated shielded file and verified the initial render is correct when the entire file is default-hidden. Reviewed By: avitaloliver Reviewers: avitaloliver, jungejason, tuomaspelkonen, aran CC: aran, avitaloliver Differential Revision: 744 --- .../changeset/DifferentialChangesetParser.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php index 9d1b39d4a2..abe17d5e5d 100644 --- a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php @@ -1207,6 +1207,11 @@ class DifferentialChangesetParser { $contents = array(); if ($len > 40) { + $is_first_block = false; + if ($ii == 0) { + $is_first_block = true; + } + $contents[] = javelin_render_tag( 'a', array( @@ -1218,7 +1223,9 @@ class DifferentialChangesetParser { 'range' => "{$top}-{$len}/{$top}-20", ), ), - "\xE2\x96\xB2 Show 20 Lines"); + $is_first_block + ? "Show First 20 Lines" + : "\xE2\x96\xB2 Show 20 Lines"); } $contents[] = javelin_render_tag( @@ -1235,6 +1242,11 @@ class DifferentialChangesetParser { 'Show All '.$len.' Lines'); if ($len > 40) { + $is_last_block = false; + if ($ii + $len >= $rows) { + $is_last_block = true; + } + $contents[] = javelin_render_tag( 'a', array( @@ -1246,7 +1258,9 @@ class DifferentialChangesetParser { 'range' => "{$top}-{$len}/{$end}-20", ), ), - "\xE2\x96\xBC Show 20 Lines"); + $is_last_block + ? "Show Last 20 Lines" + : "\xE2\x96\xBC Show 20 Lines"); }; $container = javelin_render_tag(