Skip to content

Commit 90d0f8a

Browse files
author
epriestley
committed
Revert changes to Diffusion blame view
Summary: Ref PHI174. This reverts most of these changes: - 3784312 / D18481 - 94cad30 / D18474 - 12ae08b / D18473 - 0a01334 / D18462 - ac91ab1 / D18452 These changes made the Diffusion blame view very similar to GitHub's blame view. See D18452 for a before/after of the bulk of these changes; the other revisions are bugfixes. I think this was generally a step backward, and not motivated by solving a specific problem. I've found the new UI less usable than the old one, and at least one install (see PHI174) also has. In particular, the revision/commit titles are very bulky and not terribly useful; the date column also isn't terribly useful; the "age" color actually IS pretty useful and was heavily de-emphasized. I've kept one bugfix here (missing `'a'` tag type) and kept the upgraded icon for "Skip Past This Commit". I'm going to follow this up with some additional changes: - Show a small author profile icon, similar to GitHub, to address PHI174 more directly. - Try a zebra-stripe on blocks of rows to make it more clear where changes affected by a particular commit begin and end. - Try a hue shift, not just a brightness/saturation shift, to make the "age" color more distinct. - Try computing colors as even steps, not based purely on age. Currently, if a file has one long-distant commit and several recent commits, all the recent ones show up as very bright green. I think this would probably be more useful if they were distributed more evenly across the available color bands. Test Plan: Viewed blame views in Diffusion, saw a more compact UI similar to the old UI. {F5251019} Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D18746
1 parent 7fa0d06 commit 90d0f8a

File tree

3 files changed

+88
-84
lines changed

3 files changed

+88
-84
lines changed

resources/celerity/map.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
'rsrc/css/application/diffusion/diffusion-icons.css' => '0c15255e',
7474
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
7575
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
76-
'rsrc/css/application/diffusion/diffusion-source.css' => '69ac9399',
76+
'rsrc/css/application/diffusion/diffusion-source.css' => '3a1056d8',
7777
'rsrc/css/application/diffusion/diffusion.css' => '45727264',
7878
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
7979
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
@@ -572,7 +572,7 @@
572572
'diffusion-icons-css' => '0c15255e',
573573
'diffusion-readme-css' => '419dd5b6',
574574
'diffusion-repository-css' => 'ee6f20ec',
575-
'diffusion-source-css' => '69ac9399',
575+
'diffusion-source-css' => '3a1056d8',
576576
'diviner-shared-css' => '896f1d43',
577577
'font-fontawesome' => 'e838e088',
578578
'font-lato' => 'c7ccd872',

src/applications/diffusion/controller/DiffusionBrowseController.php

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,10 @@ private function buildDisplayRows(
11271127
));
11281128
}
11291129

1130+
$skip_text = pht('Skip Past This Commit');
1131+
$skip_icon = id(new PHUIIconView())
1132+
->setIcon('fa-caret-square-o-left');
1133+
11301134
foreach ($display as $line_index => $line) {
11311135
$row = array();
11321136

@@ -1142,14 +1146,12 @@ private function buildDisplayRows(
11421146
$revision_link = null;
11431147
$commit_link = null;
11441148
$before_link = null;
1145-
$commit_date = null;
11461149

1147-
$style = 'border-right: 3px solid '.$line['color'].';';
1150+
$style = 'background: '.$line['color'].';';
11481151

11491152
if ($identifier && !$line['duplicate']) {
11501153
if (isset($commit_links[$identifier])) {
1151-
$commit_link = $commit_links[$identifier]['link'];
1152-
$commit_date = $commit_links[$identifier]['date'];
1154+
$commit_link = $commit_links[$identifier];
11531155
}
11541156

11551157
if (isset($revision_map[$identifier])) {
@@ -1160,10 +1162,6 @@ private function buildDisplayRows(
11601162
}
11611163

11621164
$skip_href = $line_href.'?before='.$identifier.'&view=blame';
1163-
$skip_text = pht('Skip Past This Commit');
1164-
$icon = id(new PHUIIconView())
1165-
->setIcon('fa-caret-square-o-left');
1166-
11671165
$before_link = javelin_tag(
11681166
'a',
11691167
array(
@@ -1175,7 +1173,7 @@ private function buildDisplayRows(
11751173
'size' => 300,
11761174
),
11771175
),
1178-
$icon);
1176+
$skip_icon);
11791177
}
11801178

11811179
if ($show_blame) {
@@ -1186,41 +1184,33 @@ private function buildDisplayRows(
11861184
),
11871185
$before_link);
11881186

1189-
$row[] = phutil_tag(
1190-
'th',
1191-
array(
1192-
'class' => 'diffusion-rev-link',
1193-
),
1194-
$commit_link);
1195-
1196-
if ($revision_map) {
1197-
$row[] = phutil_tag(
1198-
'th',
1199-
array(
1200-
'class' => 'diffusion-blame-revision',
1201-
),
1202-
$revision_link);
1187+
$object_links = array();
1188+
$object_links[] = $commit_link;
1189+
if ($revision_link) {
1190+
$object_links[] = phutil_tag('span', array(), '/');
1191+
$object_links[] = $revision_link;
12031192
}
12041193

12051194
$row[] = phutil_tag(
12061195
'th',
12071196
array(
1208-
'class' => 'diffusion-blame-date',
1197+
'class' => 'diffusion-rev-link',
12091198
),
1210-
$commit_date);
1199+
$object_links);
12111200
}
12121201

12131202
$line_link = phutil_tag(
12141203
'a',
12151204
array(
12161205
'href' => $line_href,
1206+
'style' => $style,
12171207
),
12181208
$line_number);
12191209

12201210
$row[] = javelin_tag(
12211211
'th',
12221212
array(
1223-
'class' => 'diffusion-line-link ',
1213+
'class' => 'diffusion-line-link',
12241214
'sigil' => 'phabricator-source-line',
12251215
'style' => $style,
12261216
),
@@ -1536,6 +1526,33 @@ private function loadParentCommitOf($commit) {
15361526
return head($parents);
15371527
}
15381528

1529+
private function renderRevisionTooltip(
1530+
DifferentialRevision $revision,
1531+
$handles) {
1532+
$viewer = $this->getRequest()->getUser();
1533+
1534+
$date = phabricator_date($revision->getDateModified(), $viewer);
1535+
$id = $revision->getID();
1536+
$title = $revision->getTitle();
1537+
$header = "D{$id} {$title}";
1538+
1539+
$author = $handles[$revision->getAuthorPHID()]->getName();
1540+
1541+
return "{$header}\n{$date} \xC2\xB7 {$author}";
1542+
}
1543+
1544+
private function renderCommitTooltip(
1545+
PhabricatorRepositoryCommit $commit,
1546+
$author) {
1547+
1548+
$viewer = $this->getRequest()->getUser();
1549+
1550+
$date = phabricator_date($commit->getEpoch(), $viewer);
1551+
$summary = trim($commit->getSummary());
1552+
1553+
return "{$summary}\n{$date} \xC2\xB7 {$author}";
1554+
}
1555+
15391556
protected function markupText($text) {
15401557
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
15411558
$engine->setConfig('viewer', $this->getRequest()->getUser());
@@ -1743,6 +1760,9 @@ private function loadBlame($path, $commit, $timeout) {
17431760
->setViewer($viewer)
17441761
->withRepository($repository)
17451762
->withIdentifiers($identifiers)
1763+
// TODO: We only fetch this to improve author display behavior, but
1764+
// shouldn't really need to?
1765+
->needCommitData(true)
17461766
->execute();
17471767
$commits = mpull($commits, null, 'getCommitIdentifier');
17481768
} else {
@@ -1754,27 +1774,25 @@ private function loadBlame($path, $commit, $timeout) {
17541774

17551775
private function renderCommitLinks(array $commits, $handles) {
17561776
$links = array();
1757-
$viewer = $this->getViewer();
17581777
foreach ($commits as $identifier => $commit) {
1759-
$date = phabricator_date($commit->getEpoch(), $viewer);
1760-
$summary = trim($commit->getSummary());
1761-
1762-
$commit_link = phutil_tag(
1763-
'a',
1764-
array(
1765-
'href' => $commit->getURI(),
1766-
),
1767-
$summary);
1778+
$tooltip = $this->renderCommitTooltip(
1779+
$commit,
1780+
$commit->renderAuthorShortName($handles));
17681781

1769-
$commit_date = phutil_tag(
1782+
$commit_link = javelin_tag(
17701783
'a',
17711784
array(
17721785
'href' => $commit->getURI(),
1786+
'sigil' => 'has-tooltip',
1787+
'meta' => array(
1788+
'tip' => $tooltip,
1789+
'align' => 'E',
1790+
'size' => 600,
1791+
),
17731792
),
1774-
$date);
1793+
$commit->getLocalName());
17751794

1776-
$links[$identifier]['link'] = $commit_link;
1777-
$links[$identifier]['date'] = $commit_date;
1795+
$links[$identifier] = $commit_link;
17781796
}
17791797

17801798
return $links;
@@ -1785,10 +1803,19 @@ private function renderRevisionLinks(array $revisions, $handles) {
17851803

17861804
foreach ($revisions as $revision) {
17871805
$revision_id = $revision->getID();
1788-
$revision_link = phutil_tag(
1806+
1807+
$tooltip = $this->renderRevisionTooltip($revision, $handles);
1808+
1809+
$revision_link = javelin_tag(
17891810
'a',
17901811
array(
17911812
'href' => '/'.$revision->getMonogram(),
1813+
'sigil' => 'has-tooltip',
1814+
'meta' => array(
1815+
'tip' => $tooltip,
1816+
'align' => 'E',
1817+
'size' => 600,
1818+
),
17921819
),
17931820
$revision->getMonogram());
17941821

webroot/rsrc/css/application/diffusion/diffusion-source.css

Lines changed: 18 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,24 @@
1313
-webkit-overflow-scrolling: touch;
1414
}
1515

16-
.diffusion-source tr.phabricator-source-highlight th,
17-
.diffusion-source tr.phabricator-source-highlight td {
18-
background: {$gentle.highlight};
16+
.diffusion-source tr.phabricator-source-highlight {
17+
background: {$sh-yellowbackground};
1918
}
2019

2120
.diffusion-source th {
2221
text-align: right;
2322
vertical-align: top;
24-
color: {$darkbluetext};
23+
background: {$lightgreybackground};
24+
color: {$bluetext};
2525
border-right: 1px solid {$thinblueborder};
2626
}
2727

2828
.diffusion-source td {
2929
vertical-align: top;
3030
white-space: pre-wrap;
31-
padding: 3px 12px;
31+
padding-top: 1px;
32+
padding-bottom: 1px;
33+
padding-left: 8px;
3234
width: 100%;
3335
word-break: break-all;
3436
}
@@ -43,42 +45,29 @@
4345
}
4446

4547
.diffusion-blame-link,
46-
.diffusion-rev-link,
47-
.diffusion-blame-date {
48+
.diffusion-rev-link {
4849
white-space: nowrap;
4950
}
5051

51-
.diffusion-blame-date,
52-
.diffusion-blame-link,
53-
.diffusion-blame-revision,
54-
.diffusion-rev-link {
55-
background: {$lightgreybackground};
56-
font: {$basefont};
57-
font-size: {$smallerfontsize};
52+
.diffusion-blame-link {
53+
min-width: 28px;
5854
}
5955

6056
.diffusion-source th.diffusion-rev-link {
6157
text-align: left;
6258
min-width: 130px;
6359
}
6460

65-
.diffusion-source a {
61+
.diffusion-blame-link a,
62+
.diffusion-rev-link a,
63+
.diffusion-line-link a {
6664
color: {$darkbluetext};
6765
}
6866

69-
.diffusion-rev-link a {
70-
max-width: 300px;
71-
overflow: hidden;
72-
white-space: nowrap;
73-
text-overflow: ellipsis;
74-
margin: 3px 8px;
75-
display: block;
76-
}
77-
78-
.diffusion-blame-date a,
79-
.diffusion-blame-revision a {
80-
float: right;
81-
margin: 3px 8px;
67+
.diffusion-rev-link a,
68+
.diffusion-rev-link span {
69+
margin: 2px 8px 0;
70+
display: inline-block;
8271
}
8372

8473
.diffusion-rev-link span {
@@ -91,19 +80,7 @@
9180
.diffusion-line-link a {
9281
/* Give the user a larger click target. */
9382
display: block;
94-
padding: 4px 8px 3px;
95-
}
96-
97-
.diffusion-line-link a {
98-
color: {$lightgreytext};
99-
}
100-
101-
.diffusion-blame-link a .phui-icon-view {
102-
color: {$bluetext};
103-
}
104-
105-
.diffusion-blame-link a:hover .phui-icon-view {
106-
color: {$sky};
83+
padding: 2px 8px;
10784
}
10885

10986
.diffusion-line-link {

0 commit comments

Comments
 (0)