1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 07:20:57 +01:00

Update blame view in Diffusion

Summary: Ref T12824, adds more information to the blame view, exposes date, commit summary, lighter colors.

Test Plan:
Review many diffs with and without blame on.

{F5111758}

{F5111759}

Reviewers: epriestley

Reviewed By: epriestley

Spies: Korvin

Maniphest Tasks: T12824

Differential Revision: https://secure.phabricator.com/D18452
This commit is contained in:
Chad Little 2017-08-23 08:44:04 -07:00
parent 748725a47d
commit ac91ab1ef9
3 changed files with 78 additions and 77 deletions

View file

@ -74,7 +74,7 @@ return array(
'rsrc/css/application/diffusion/diffusion-icons.css' => '0c15255e',
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
'rsrc/css/application/diffusion/diffusion-source.css' => '48d222a6',
'rsrc/css/application/diffusion/diffusion.css' => 'ceacf994',
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
@ -574,7 +574,7 @@ return array(
'diffusion-icons-css' => '0c15255e',
'diffusion-readme-css' => '419dd5b6',
'diffusion-repository-css' => 'ee6f20ec',
'diffusion-source-css' => '750add59',
'diffusion-source-css' => '48d222a6',
'diviner-shared-css' => '896f1d43',
'font-fontawesome' => 'e838e088',
'font-lato' => 'c7ccd872',

View file

@ -1116,7 +1116,6 @@ final class DiffusionBrowseController extends DiffusionController {
));
}
$skip_text = pht('Skip Past This Commit');
foreach ($display as $line_index => $line) {
$row = array();
@ -1132,12 +1131,14 @@ final class DiffusionBrowseController extends DiffusionController {
$revision_link = null;
$commit_link = null;
$before_link = null;
$commit_date = null;
$style = 'background: '.$line['color'].';';
$style = 'border-right: 2px solid '.$line['color'].';';
if ($identifier && !$line['duplicate']) {
if (isset($commit_links[$identifier])) {
$commit_link = $commit_links[$identifier];
$commit_link = $commit_links[$identifier]['link'];
$commit_date = $commit_links[$identifier]['date'];
}
if (isset($revision_map[$identifier])) {
@ -1148,6 +1149,10 @@ final class DiffusionBrowseController extends DiffusionController {
}
$skip_href = $line_href.'?before='.$identifier.'&view=blame';
$skip_text = pht('Skip Past This Commit');
$icon = id(new PHUIIconView())
->setIcon('fa-caret-square-o-left');
$before_link = javelin_tag(
'a',
array(
@ -1159,7 +1164,7 @@ final class DiffusionBrowseController extends DiffusionController {
'size' => 300,
),
),
"\xC2\xAB");
$icon);
}
if ($show_blame) {
@ -1183,20 +1188,26 @@ final class DiffusionBrowseController extends DiffusionController {
'class' => 'diffusion-rev-link',
),
$object_links);
$row[] = phutil_tag(
'th',
array(
'class' => 'diffusion-blame-date',
),
$commit_date);
}
$line_link = phutil_tag(
'a',
array(
'href' => $line_href,
'style' => $style,
),
$line_number);
$row[] = javelin_tag(
'th',
array(
'class' => 'diffusion-line-link',
'class' => 'diffusion-line-link ',
'sigil' => 'phabricator-source-line',
'style' => $style,
),
@ -1510,33 +1521,6 @@ final class DiffusionBrowseController extends DiffusionController {
return head($parents);
}
private function renderRevisionTooltip(
DifferentialRevision $revision,
$handles) {
$viewer = $this->getRequest()->getUser();
$date = phabricator_date($revision->getDateModified(), $viewer);
$id = $revision->getID();
$title = $revision->getTitle();
$header = "D{$id} {$title}";
$author = $handles[$revision->getAuthorPHID()]->getName();
return "{$header}\n{$date} \xC2\xB7 {$author}";
}
private function renderCommitTooltip(
PhabricatorRepositoryCommit $commit,
$author) {
$viewer = $this->getRequest()->getUser();
$date = phabricator_date($commit->getEpoch(), $viewer);
$summary = trim($commit->getSummary());
return "{$summary}\n{$date} \xC2\xB7 {$author}";
}
protected function markupText($text) {
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
$engine->setConfig('viewer', $this->getRequest()->getUser());
@ -1737,9 +1721,6 @@ final class DiffusionBrowseController extends DiffusionController {
->setViewer($viewer)
->withRepository($repository)
->withIdentifiers($identifiers)
// TODO: We only fetch this to improve author display behavior, but
// shouldn't really need to?
->needCommitData(true)
->execute();
$commits = mpull($commits, null, 'getCommitIdentifier');
} else {
@ -1751,25 +1732,27 @@ final class DiffusionBrowseController extends DiffusionController {
private function renderCommitLinks(array $commits, $handles) {
$links = array();
$viewer = $this->getViewer();
foreach ($commits as $identifier => $commit) {
$tooltip = $this->renderCommitTooltip(
$commit,
$commit->renderAuthorShortName($handles));
$date = phabricator_date($commit->getEpoch(), $viewer);
$summary = trim($commit->getSummary());
$commit_link = javelin_tag(
$commit_link = phutil_tag(
'a',
array(
'href' => $commit->getURI(),
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => $tooltip,
'align' => 'E',
'size' => 600,
),
),
$commit->getLocalName());
$summary);
$links[$identifier] = $commit_link;
$commit_date = phutil_tag(
'a',
array(
'href' => $commit->getURI(),
),
$date);
$links[$identifier]['link'] = $commit_link;
$links[$identifier]['date'] = $commit_date;
}
return $links;
@ -1780,19 +1763,10 @@ final class DiffusionBrowseController extends DiffusionController {
foreach ($revisions as $revision) {
$revision_id = $revision->getID();
$tooltip = $this->renderRevisionTooltip($revision, $handles);
$revision_link = javelin_tag(
$revision_link = phutil_tag(
'a',
array(
'href' => '/'.$revision->getMonogram(),
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => $tooltip,
'align' => 'E',
'size' => 600,
),
),
$revision->getMonogram());

View file

@ -7,24 +7,22 @@
background: {$page.content};
}
.diffusion-source tr.phabricator-source-highlight {
background: {$sh-yellowbackground};
.diffusion-source tr.phabricator-source-highlight th,
.diffusion-source tr.phabricator-source-highlight td {
background: {$gentle.highlight};
}
.diffusion-source th {
text-align: right;
vertical-align: top;
background: {$lightgreybackground};
color: {$bluetext};
color: {$darkbluetext};
border-right: 1px solid {$thinblueborder};
}
.diffusion-source td {
vertical-align: top;
white-space: pre-wrap;
padding-top: 1px;
padding-bottom: 1px;
padding-left: 8px;
padding: 3px 12px;
width: 100%;
word-break: break-all;
}
@ -34,29 +32,46 @@
}
.diffusion-blame-link,
.diffusion-rev-link {
.diffusion-rev-link,
.diffusion-blame-date {
white-space: nowrap;
}
.diffusion-blame-link {
min-width: 28px;
.diffusion-blame-date {
background: {$lightgreybackground};
font: {$basefont};
font-size: {$smallestfontsize};
}
.diffusion-blame-link,
.diffusion-line-link {
background: {$lightgreybackground};
}
.diffusion-source th.diffusion-rev-link {
text-align: left;
min-width: 130px;
background: {$lightgreybackground};
font: {$basefont};
font-size: {$smallestfontsize};
}
.diffusion-blame-link a,
.diffusion-rev-link a,
.diffusion-line-link a {
.diffusion-source a {
color: {$darkbluetext};
}
.diffusion-rev-link a {
max-width: 340px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.diffusion-rev-link a,
.diffusion-rev-link span {
margin: 2px 8px 0;
display: inline-block;
.diffusion-rev-link span,
.diffusion-blame-date a {
margin: 3px 8px;
display: block;
}
.diffusion-rev-link span {
@ -69,7 +84,19 @@
.diffusion-line-link a {
/* Give the user a larger click target. */
display: block;
padding: 2px 8px;
padding: 4px 8px 3px;
}
.diffusion-line-link a {
color: {$lightgreytext};
}
.diffusion-blame-link a .phui-icon-view {
color: {$bluetext};
}
.diffusion-blame-link a:hover .phui-icon-view {
color: {$sky};
}
.diffusion-line-link {