mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 16:30:59 +01:00
Modernized Phriction's Diff Controller
Summary: Refs T2686 - Added additional crumb to link back to History view - Revert buttons hidden for Stub and Move changes, too - added colors to the change set to reflect the colors in the diff Test Plan: looked at various changes, verified correct appearance Reviewers: epriestley, chad, btrahan CC: aran, Korvin Maniphest Tasks: T2686 Differential Revision: https://secure.phabricator.com/D5401
This commit is contained in:
parent
cb84cb1c0f
commit
4c57f8aaf1
3 changed files with 43 additions and 38 deletions
|
@ -3397,7 +3397,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phriction-document-css' =>
|
||||
array(
|
||||
'uri' => '/res/8d09bd7f/rsrc/css/application/phriction/phriction-document-css.css',
|
||||
'uri' => '/res/e71e4a67/rsrc/css/application/phriction/phriction-document-css.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
|
|
@ -107,6 +107,11 @@ final class PhrictionDiffController
|
|||
$crumbs->addCrumb($view);
|
||||
}
|
||||
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName(pht('History'))
|
||||
->setHref(PhrictionDocument::getSlugURI($slug, 'history')));
|
||||
|
||||
|
||||
$title = "Version $l vs $r";
|
||||
|
||||
|
@ -115,7 +120,8 @@ final class PhrictionDiffController
|
|||
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName($title));
|
||||
->setName($title)
|
||||
->setHref($request->getRequestURI()));
|
||||
|
||||
|
||||
$comparison_table = $this->renderComparisonTable(
|
||||
|
@ -166,7 +172,6 @@ final class PhrictionDiffController
|
|||
}
|
||||
|
||||
|
||||
|
||||
$output = hsprintf(
|
||||
'<br><div class="phriction-document-history-diff">'.
|
||||
'%s<br /><br />%s'.
|
||||
|
@ -202,9 +207,14 @@ final class PhrictionDiffController
|
|||
$document_id = $content->getDocumentID();
|
||||
$version = $content->getVersion();
|
||||
|
||||
if ($content->getChangeType() == PhrictionChangeType::CHANGE_DELETE) {
|
||||
// Don't show an edit/revert button for changes which deleted the content
|
||||
// since it's silly.
|
||||
$hidden_statuses = array(
|
||||
PhrictionChangeType::CHANGE_DELETE => true, // Silly
|
||||
PhrictionChangeType::CHANGE_MOVE_AWAY => true, // Plain silly
|
||||
PhrictionChangeType::CHANGE_STUB => true, // Utterly silly
|
||||
);
|
||||
if (isset($hidden_statuses[$content->getChangeType()])) {
|
||||
// Don't show an edit/revert button for changes which deleted, moved or
|
||||
// stubbed the content since it's silly.
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -236,37 +246,35 @@ final class PhrictionDiffController
|
|||
$phids = mpull($content, 'getAuthorPHID');
|
||||
$handles = $this->loadViewerHandles($phids);
|
||||
|
||||
$rows = array();
|
||||
$list = new PhabricatorObjectItemListView();
|
||||
|
||||
$first = true;
|
||||
foreach ($content as $c) {
|
||||
$rows[] = array(
|
||||
phabricator_date($c->getDateCreated(), $user),
|
||||
phabricator_time($c->getDateCreated(), $user),
|
||||
'Version '.$c->getVersion(),
|
||||
$handles[$c->getAuthorPHID()]->renderLink(),
|
||||
$c->getDescription(),
|
||||
);
|
||||
$author = $handles[$c->getAuthorPHID()]->renderLink();
|
||||
$item = id(new PhabricatorObjectItemView())
|
||||
->setHeader(pht('%s by %s, %s',
|
||||
PhrictionChangeType::getChangeTypeLabel($c->getChangeType()),
|
||||
$author,
|
||||
pht('Version %s', $c->getVersion())))
|
||||
->addAttribute(pht('%s %s',
|
||||
phabricator_date($c->getDateCreated(), $user),
|
||||
phabricator_time($c->getDateCreated(), $user)));
|
||||
|
||||
if ($c->getDescription()) {
|
||||
$item->addAttribute($c->getDescription());
|
||||
}
|
||||
|
||||
if ($first == true) {
|
||||
$item->setBarColor('green');
|
||||
$first = false;
|
||||
} else {
|
||||
$item->setBarColor('red');
|
||||
}
|
||||
|
||||
$list->addItem($item);
|
||||
}
|
||||
|
||||
|
||||
$table = new AphrontTableView($rows);
|
||||
$table->setHeaders(
|
||||
array(
|
||||
pht('Date'),
|
||||
pht('Time'),
|
||||
pht('Version'),
|
||||
pht('Author'),
|
||||
pht('Description'),
|
||||
));
|
||||
$table->setColumnClasses(
|
||||
array(
|
||||
'',
|
||||
'right',
|
||||
'pri',
|
||||
'',
|
||||
'wide',
|
||||
));
|
||||
|
||||
return $table;
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,11 +64,8 @@
|
|||
font-size: 11px;
|
||||
}
|
||||
|
||||
|
||||
.phriction-document-history-diff {
|
||||
margin: 0 0 0 2em;
|
||||
padding-bottom: 2em;
|
||||
max-width: 1162px;
|
||||
padding: 0 2em 2em;
|
||||
}
|
||||
|
||||
.phriction-revert-table {
|
||||
|
|
Loading…
Reference in a new issue