1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +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(); $viewer = $this->getViewer();
$toc_view = id(new PHUIDiffTableOfContentsListView()) $toc_view = id(new PHUIDiffTableOfContentsListView())
->setUser($viewer) ->setViewer($viewer)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); ->setBare(true);
$have_owners = PhabricatorApplication::isClassInstalledForViewer( $have_owners = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorOwnersApplication', 'PhabricatorOwnersApplication',

View file

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

View file

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

View file

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

View file

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