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

View file

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

View file

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

View file

@ -92,6 +92,7 @@ final class DiffusionCompareController extends DiffusionController {
array( array(
'view' => 'compare', 'view' => 'compare',
)); ));
$crumbs->setBorder(true);
$pager = id(new PHUIPagerView()) $pager = id(new PHUIPagerView())
->readFromRequest($request); ->readFromRequest($request);
@ -310,16 +311,11 @@ final class DiffusionCompareController extends DiffusionController {
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setHeader(pht('Commits')); ->setHeader(pht('Commits'));
$object_box = id(new PHUIObjectBoxView()) return id(new PHUIObjectBoxView())
->setHeader($header) ->setHeader($header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->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); ->appendChild($body);
} }
protected function renderTablePagerBox(PHUIPagerView $pager) {
return id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE)
->appendChild($pager);
}
protected function renderCommitHashTag(DiffusionRequest $drequest) { protected function renderCommitHashTag(DiffusionRequest $drequest) {
$stable_commit = $drequest->getStableCommit(); $stable_commit = $drequest->getStableCommit();
$commit = phutil_tag( $commit = phutil_tag(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -146,3 +146,15 @@ div.phui-object-box.phui-object-box-flush {
padding: 4px 8px; padding: 4px 8px;
background-color: {$lightgreybackground}; 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;
}