1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Merge "Table of Contents", "Local Commits", "Update History" and "Similar Revisions"

Summary: Ref T10628. Turn these into tabs in a single box, since "local commits" and "similar revisions" are of particularly rare use.

Test Plan: {F1707196}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10628

Differential Revision: https://secure.phabricator.com/D16209
This commit is contained in:
epriestley 2016-06-30 17:15:27 -07:00
parent 2c43d055b1
commit 6c7e392f89
5 changed files with 61 additions and 22 deletions

View file

@ -28,8 +28,8 @@ abstract class DifferentialController extends PhabricatorController {
$viewer = $this->getViewer();
$toc_view = id(new PHUIDiffTableOfContentsListView())
->setUser($viewer)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
->setViewer($viewer)
->setBare(true);
$have_owners = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorOwnersApplication',

View file

@ -292,7 +292,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
'/differential/comment/inline/edit/'.$revision->getID().'/');
}
$diff_history = id(new DifferentialRevisionUpdateHistoryView())
$history = id(new DifferentialRevisionUpdateHistoryView())
->setUser($viewer)
->setDiffs($diffs)
->setSelectedVersusDiffID($diff_vs)
@ -300,7 +300,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
->setSelectedWhitespace($whitespace)
->setCommitsForLinks($commits_for_links);
$local_view = id(new DifferentialLocalCommitsView())
$local_table = id(new DifferentialLocalCommitsView())
->setUser($viewer)
->setLocalCommits(idx($props, 'local:commits'))
->setCommitsForLinks($commits_for_links);
@ -324,6 +324,36 @@ final class DifferentialRevisionViewController extends DifferentialController {
$visible_changesets,
$target->loadCoverageMap($viewer));
$tab_group = id(new PHUITabGroupView())
->addTab(
id(new PHUITabView())
->setName(pht('Files'))
->setKey('files')
->appendChild($toc_view))
->addTab(
id(new PHUITabView())
->setName(pht('History'))
->setKey('history')
->appendChild($history))
->addTab(
id(new PHUITabView())
->setName(pht('Commits'))
->setKey('commits')
->appendChild($local_table));
if ($other_view) {
$tab_group->addTab(
id(new PHUITabView())
->setName(pht('Similar'))
->setKey('similar')
->appendChild($other_view));
}
$tab_view = id(new PHUIObjectBoxView())
->setHeaderText(pht('Revision Contents'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addTabGroup($tab_group);
$comment_form = null;
if (!$viewer_is_anonymous) {
$comment_form = $this->buildCommentForm($revision, $field_list);
@ -348,15 +378,16 @@ final class DifferentialRevisionViewController extends DifferentialController {
'The content of this revision is hidden until the author has '.
'signed all of the required legal agreements.'));
} else {
$footer[] =
array(
$diff_history,
$warning,
$local_view,
$toc_view,
$other_view,
$changeset_view,
);
$anchor = id(new PhabricatorAnchorView())
->setAnchorName('toc')
->setNavigationMarker(true);
$footer[] = array(
$anchor,
$warning,
$tab_view,
$changeset_view,
);
}
if ($comment_form) {
@ -870,9 +901,9 @@ final class DifferentialRevisionViewController extends DifferentialController {
->setHeader(pht('Recent Similar Revisions'));
$view = id(new DifferentialRevisionListView())
->setHeader($header)
->setRevisions($revisions)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setNoBox(true)
->setUser($viewer);
$phids = $view->getRequiredHandlePHIDs();

View file

@ -125,10 +125,7 @@ final class DifferentialLocalCommitsView extends AphrontView {
$headers[] = pht('Date');
$table->setHeaders($headers);
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Local Commits'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($table);
return $table;
}
private static function formatCommit($commit) {

View file

@ -303,10 +303,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$show_diff,
));
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Revision Update History'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($content);
return $content;
}
const STAR_NONE = 'none';

View file

@ -7,6 +7,7 @@ final class PHUIDiffTableOfContentsListView extends AphrontView {
private $header;
private $infoView;
private $background;
private $bare;
public function addItem(PHUIDiffTableOfContentsItemView $item) {
$this->items[] = $item;
@ -38,6 +39,15 @@ final class PHUIDiffTableOfContentsListView extends AphrontView {
return $this;
}
public function setBare($bare) {
$this->bare = $bare;
return $this;
}
public function getBare() {
return $this->bare;
}
public function render() {
$this->requireResource('differential-core-view-css');
$this->requireResource('differential-table-of-contents-css');
@ -160,6 +170,10 @@ final class PHUIDiffTableOfContentsListView extends AphrontView {
->setAnchorName('toc')
->setNavigationMarker(true);
if ($this->bare) {
return $table;
}
$header = id(new PHUIHeaderView())
->setHeader(pht('Table of Contents'));