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

Attach Diffusion Pagers to their ObjectBoxView

Summary: Adds the ability to set a pager onto an object box directly and pick up appropriate styles.

Test Plan: grep for renderTablePagerBox, test layouts with and without a pager.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12604

Differential Revision: https://secure.phabricator.com/D17754
This commit is contained in:
Chad Little 2017-04-21 11:22:06 -07:00
parent 050538cf7e
commit 7c61ace086
12 changed files with 57 additions and 55 deletions

View file

@ -9,12 +9,12 @@ return array(
'names' => array(
'conpherence.pkg.css' => 'ff161f2d',
'conpherence.pkg.js' => 'b5b51108',
'core.pkg.css' => '959330a2',
'core.pkg.css' => 'd23d18e6',
'core.pkg.js' => '47a69358',
'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '90b30783',
'differential.pkg.js' => 'ddfeb49b',
'diffusion.pkg.css' => '30dd8a58',
'diffusion.pkg.css' => 'b93d9b8c',
'diffusion.pkg.js' => '84c8f8fd',
'favicon.ico' => '30672e08',
'maniphest.pkg.css' => '4845691a',
@ -71,7 +71,7 @@ return array(
'rsrc/css/application/differential/revision-history.css' => '0e8eb855',
'rsrc/css/application/differential/revision-list.css' => 'f3c47d33',
'rsrc/css/application/differential/table-of-contents.css' => 'ae4b7a55',
'rsrc/css/application/diffusion/diffusion-icons.css' => '60c21c3b',
'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba',
'rsrc/css/application/diffusion/diffusion-readme.css' => '297373eb',
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
@ -164,7 +164,7 @@ return array(
'rsrc/css/phui/phui-invisible-character-view.css' => '6993d9f0',
'rsrc/css/phui/phui-lightbox.css' => '0a035e40',
'rsrc/css/phui/phui-list.css' => '12eb8ce6',
'rsrc/css/phui/phui-object-box.css' => '8b289e3d',
'rsrc/css/phui/phui-object-box.css' => '9cff003c',
'rsrc/css/phui/phui-pager.css' => '77d8a794',
'rsrc/css/phui/phui-pinboard-view.css' => '2495140e',
'rsrc/css/phui/phui-property-list-view.css' => '2dc7993f',
@ -578,7 +578,7 @@ return array(
'differential-revision-history-css' => '0e8eb855',
'differential-revision-list-css' => 'f3c47d33',
'differential-table-of-contents-css' => 'ae4b7a55',
'diffusion-icons-css' => '60c21c3b',
'diffusion-icons-css' => 'a6a1e2ba',
'diffusion-readme-css' => '297373eb',
'diffusion-source-css' => '750add59',
'diviner-shared-css' => '896f1d43',
@ -872,7 +872,7 @@ return array(
'phui-invisible-character-view-css' => '6993d9f0',
'phui-lightbox-css' => '0a035e40',
'phui-list-view-css' => '12eb8ce6',
'phui-object-box-css' => '8b289e3d',
'phui-object-box-css' => '9cff003c',
'phui-oi-big-ui-css' => '19f9369b',
'phui-oi-color-css' => 'cd2b9b77',
'phui-oi-drag-ui-css' => 'f12cbc9f',

View file

@ -57,7 +57,8 @@ final class DiffusionBranchTableController extends DiffusionController {
$content = id(new PHUIObjectBoxView())
->setHeaderText($repository->getName())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($table);
->setTable($table)
->setPager($pager);
}
$crumbs = $this->buildCrumbs(
@ -66,8 +67,6 @@ final class DiffusionBranchTableController extends DiffusionController {
));
$crumbs->setBorder(true);
$pager_box = $this->renderTablePagerBox($pager);
$header = id(new PHUIHeaderView())
->setHeader(pht('Branches'))
->setHeaderIcon('fa-code-fork');
@ -76,7 +75,6 @@ final class DiffusionBranchTableController extends DiffusionController {
->setHeader($header)
->setFooter(array(
$content,
$pager_box,
));
return $this->newPage()

View file

@ -370,7 +370,8 @@ final class DiffusionBrowseController extends DiffusionController {
$browse_panel = id(new PHUIObjectBoxView())
->setHeader($browse_header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($browse_table);
->setTable($browse_table)
->setPager($pager);
$browse_panel->setShowHide(
array(pht('Show Search')),
@ -395,7 +396,6 @@ final class DiffusionBrowseController extends DiffusionController {
'view' => 'browse',
));
$pager_box = $this->renderTablePagerBox($pager);
$crumbs->setBorder(true);
$view = id(new PHUITwoColumnView())
@ -411,7 +411,6 @@ final class DiffusionBrowseController extends DiffusionController {
array(
$open_revisions,
$readme,
$pager_box,
));
if ($details) {
@ -489,14 +488,12 @@ final class DiffusionBrowseController extends DiffusionController {
nonempty($drequest->getPath(), '/'));
}
$box = id(new PHUIObjectBoxView())
return id(new PHUIObjectBoxView())
->setHeaderText($header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($table);
->setTable($table)
->setPager($pager);
$pager_box = $this->renderTablePagerBox($pager);
return array($box, $pager_box);
}
private function renderGrepResults(array $results, $pattern) {
@ -1775,9 +1772,8 @@ final class DiffusionBrowseController extends DiffusionController {
}
$header = id(new PHUIHeaderView())
->setHeader(pht('Open Revisions'))
->setSubheader(
pht('Recently updated open revisions affecting this file.'));
->setHeader(pht('Recently Open Revisions'))
->setHeaderIcon('fa-gear');
$view = id(new DifferentialRevisionListView())
->setHeader($header)

View file

@ -92,6 +92,7 @@ final class DiffusionCompareController extends DiffusionController {
array(
'view' => 'compare',
));
$crumbs->setBorder(true);
$pager = id(new PHUIPagerView())
->readFromRequest($request);
@ -310,16 +311,11 @@ final class DiffusionCompareController extends DiffusionController {
$header = id(new PHUIHeaderView())
->setHeader(pht('Commits'));
$object_box = id(new PHUIObjectBoxView())
return id(new PHUIObjectBoxView())
->setHeader($header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($history_table);
->setTable($history_table)
->setPager($pager);
$pager_box = $this->renderTablePagerBox($pager);
return array(
$object_box,
$pager_box,
);
}
}

View file

@ -317,12 +317,6 @@ abstract class DiffusionController extends PhabricatorController {
->appendChild($body);
}
protected function renderTablePagerBox(PHUIPagerView $pager) {
return id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE)
->appendChild($pager);
}
protected function renderCommitHashTag(DiffusionRequest $drequest) {
$stable_commit = $drequest->getStableCommit();
$commit = phutil_tag(

View file

@ -57,7 +57,8 @@ final class DiffusionHistoryController extends DiffusionController {
$history_panel = id(new PHUIObjectBoxView())
->setHeader($history_header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($history_table);
->setTable($history_table)
->setPager($pager);
$header = $this->buildHeader($drequest);
@ -69,13 +70,10 @@ final class DiffusionHistoryController extends DiffusionController {
));
$crumbs->setBorder(true);
$pager_box = $this->renderTablePagerBox($pager);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$history_panel,
$pager_box,
));
return $this->newPage()

View file

@ -456,7 +456,8 @@ final class DiffusionLintController extends DiffusionController {
$content[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Lint Details'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($table);
->setTable($table)
->setPager($pager);
$crumbs = $this->buildCrumbs(
array(
@ -465,7 +466,6 @@ final class DiffusionLintController extends DiffusionController {
'view' => 'lint',
));
$pager_box = $this->renderTablePagerBox($pager);
$header = id(new PHUIHeaderView())
->setHeader(pht('Lint: %s', $drequest->getRepository()->getDisplayName()))
->setHeaderIcon('fa-code');
@ -474,7 +474,6 @@ final class DiffusionLintController extends DiffusionController {
->setHeader($header)
->setFooter(array(
$content,
$pager_box,
));
return $this->newPage()

View file

@ -354,9 +354,9 @@ final class DiffusionRepositoryController extends DiffusionController {
}
if ($repository->isSVN()) {
$label = pht('Checkout');
$label = phutil_tag_div('diffusion-clone-label', pht('Checkout'));
} else {
$label = pht('Clone');
$label = phutil_tag_div('diffusion-clone-label', pht('Clone'));
}
$view->addProperty(
@ -686,15 +686,10 @@ final class DiffusionRepositoryController extends DiffusionController {
$pager->setURI($browse_uri, 'offset');
if ($pager->willShowPagingControls()) {
$pager_box = $this->renderTablePagerBox($pager);
} else {
$pager_box = null;
$browse_panel->setPager($pager);
}
return array(
$browse_panel,
$pager_box,
);
return $browse_panel;
}
private function renderCloneURI(

View file

@ -87,15 +87,13 @@ final class DiffusionTagListController extends DiffusionController {
$box = id(new PHUIObjectBoxView())
->setHeaderText($repository->getDisplayName())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($view);
$pager_box = $this->renderTablePagerBox($pager);
->setTable($view)
->setPager($pager);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$box,
$pager_box,
));
return $this->newPage()

View file

@ -18,6 +18,7 @@ final class PHUIObjectBoxView extends AphrontTagView {
private $table;
private $collapsed = false;
private $anchor;
private $pager;
private $showAction;
private $hideAction;
@ -126,6 +127,11 @@ final class PHUIObjectBoxView extends AphrontTagView {
return $this;
}
public function setPager(PHUIPagerView $pager) {
$this->pager = $pager;
return $this;
}
public function setAnchor(PhabricatorAnchorView $anchor) {
$this->anchor = $anchor;
return $this;
@ -294,6 +300,10 @@ final class PHUIObjectBoxView extends AphrontTagView {
$lists = null;
}
$pager = null;
if ($this->pager) {
$pager = phutil_tag_div('phui-object-box-pager', $this->pager);
}
$content = array(
($this->showHideOpen == false ? $this->anchor : null),
@ -308,6 +318,7 @@ final class PHUIObjectBoxView extends AphrontTagView {
($this->showHideOpen == true ? $this->anchor : null),
$lists,
$this->table,
$pager,
$this->renderChildren(),
);

View file

@ -13,6 +13,11 @@ input.diffusion-clone-uri {
color: {$lightgreytext};
}
.diffusion-clone-label {
height: 30px;
line-height: 28px;
}
.diffusion-browse-name {
margin-left: 8px;
}

View file

@ -146,3 +146,15 @@ div.phui-object-box.phui-object-box-flush {
padding: 4px 8px;
background-color: {$lightgreybackground};
}
/* - Pager at the bottom ---------------------------------------------------- */
.phui-object-box-pager {
background-color: {$bluebackground};
border-top: 1px solid {$lightblueborder};
}
.phui-object-box-pager a.button {
margin-top: 8px;
margin-bottom: 8px;
}