From 4c2e36f561c5253ef4f1719083b8ecc465ce9107 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 19 Feb 2015 08:11:17 -0800 Subject: [PATCH] Have DifferentialRevisionListView return ObjectBoxView Summary: Uses PHUIObjectBoxView to display lists of diffs in Differential and Diffusion, unless embedded on a dashboard. Test Plan: Test Dashboard panel, Differential home, Commit, and Diff {F282173} {F282174} Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11659 --- resources/celerity/map.php | 10 +++++----- .../DifferentialRevisionViewController.php | 5 ++--- .../query/DifferentialRevisionSearchEngine.php | 3 ++- .../view/DifferentialRevisionListView.php | 17 ++++++++++++++++- .../controller/DiffusionBrowseController.php | 5 ++--- .../css/application/dashboard/dashboard.css | 4 ++++ .../css/phui/phui-object-item-list-view.css | 4 ++++ 7 files changed, 35 insertions(+), 13 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index f04d41530b..3b7ee427c9 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => 'a3a54ca1', + 'core.pkg.css' => '8edbf4c0', 'core.pkg.js' => '23d653bb', 'darkconsole.pkg.js' => '8ab24e01', 'differential.pkg.css' => '380f07e5', @@ -52,7 +52,7 @@ return array( 'rsrc/css/application/conpherence/widget-pane.css' => '3d575438', 'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4', 'rsrc/css/application/countdown/timer.css' => '86b7b0a0', - 'rsrc/css/application/dashboard/dashboard.css' => 'ec324e2a', + 'rsrc/css/application/dashboard/dashboard.css' => 'c0062064', 'rsrc/css/application/diff/inline-comment-summary.css' => 'eb5f8e8c', 'rsrc/css/application/differential/add-comment.css' => 'c478bcaa', 'rsrc/css/application/differential/changeset-view.css' => 'b2b71e76', @@ -138,7 +138,7 @@ return array( 'rsrc/css/phui/phui-info-panel.css' => '27ea50a1', 'rsrc/css/phui/phui-list.css' => '53deb25c', 'rsrc/css/phui/phui-object-box.css' => 'b8b7fd78', - 'rsrc/css/phui/phui-object-item-list-view.css' => 'da095b41', + 'rsrc/css/phui/phui-object-item-list-view.css' => '86e05b7c', 'rsrc/css/phui/phui-pinboard-view.css' => '3dd4a269', 'rsrc/css/phui/phui-property-list-view.css' => '51480060', 'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b', @@ -717,7 +717,7 @@ return array( 'phabricator-content-source-view-css' => '4b8b05d4', 'phabricator-core-css' => 'd7f6ec35', 'phabricator-countdown-css' => '86b7b0a0', - 'phabricator-dashboard-css' => 'ec324e2a', + 'phabricator-dashboard-css' => 'c0062064', 'phabricator-drag-and-drop-file-upload' => '8c49f386', 'phabricator-draggable-list' => 'a16ec1c6', 'phabricator-fatal-config-template-css' => '25d446d6', @@ -792,7 +792,7 @@ return array( 'phui-info-panel-css' => '27ea50a1', 'phui-list-view-css' => '53deb25c', 'phui-object-box-css' => 'b8b7fd78', - 'phui-object-item-list-view-css' => 'da095b41', + 'phui-object-item-list-view-css' => '86e05b7c', 'phui-pinboard-view-css' => '3dd4a269', 'phui-property-list-view-css' => '51480060', 'phui-remarkup-preview-css' => '19ad512b', diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 43a21e73e9..0f06f3e20e 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -778,6 +778,7 @@ final class DifferentialRevisionViewController extends DifferentialController { $user = $this->getRequest()->getUser(); $view = id(new DifferentialRevisionListView()) + ->setHeader(pht('Open Revisions Affecting These Files')) ->setRevisions($revisions) ->setUser($user); @@ -785,9 +786,7 @@ final class DifferentialRevisionViewController extends DifferentialController { $handles = $this->loadViewerHandles($phids); $view->setHandles($handles); - return id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Open Revisions Affecting These Files')) - ->appendChild($view); + return $view; } diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php index 82e720a4e5..65afcd55a6 100644 --- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php +++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php @@ -261,7 +261,8 @@ final class DifferentialRevisionSearchEngine $viewer = $this->requireViewer(); $template = id(new DifferentialRevisionListView()) - ->setUser($viewer); + ->setUser($viewer) + ->setNoBox($this->isPanelContext()); $views = array(); if ($query->getQueryKey() == 'active') { diff --git a/src/applications/differential/view/DifferentialRevisionListView.php b/src/applications/differential/view/DifferentialRevisionListView.php index 956819aead..985d84430b 100644 --- a/src/applications/differential/view/DifferentialRevisionListView.php +++ b/src/applications/differential/view/DifferentialRevisionListView.php @@ -10,6 +10,7 @@ final class DifferentialRevisionListView extends AphrontView { private $highlightAge; private $header; private $noDataString; + private $noBox; public function setNoDataString($no_data_string) { $this->noDataString = $no_data_string; @@ -32,6 +33,11 @@ final class DifferentialRevisionListView extends AphrontView { return $this; } + public function setNoBox($box) { + $this->noBox = $box; + return $this; + } + public function getRequiredHandlePHIDs() { $phids = array(); foreach ($this->revisions as $revision) { @@ -179,9 +185,18 @@ final class DifferentialRevisionListView extends AphrontView { $list->addItem($item); } - $list->setHeader($this->header); $list->setNoDataString($this->noDataString); + + if ($this->header && !$this->noBox) { + $list->setFlush(true); + $list = id(new PHUIObjectBoxView()) + ->setHeaderText($this->header) + ->appendChild($list); + } else { + $list->setHeader($this->header); + } + return $list; } diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php index e7785ad267..84ea0fe721 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -208,6 +208,7 @@ abstract class DiffusionBrowseController extends DiffusionController { } $view = id(new DifferentialRevisionListView()) + ->setHeader(pht('Pending Differential Revisions')) ->setRevisions($revisions) ->setUser($user); @@ -215,9 +216,7 @@ abstract class DiffusionBrowseController extends DiffusionController { $handles = $this->loadViewerHandles($phids); $view->setHandles($handles); - return id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Pending Differential Revisions')) - ->appendChild($view); + return $view; } } diff --git a/webroot/rsrc/css/application/dashboard/dashboard.css b/webroot/rsrc/css/application/dashboard/dashboard.css index 5988aef8c3..5d389fa2f8 100644 --- a/webroot/rsrc/css/application/dashboard/dashboard.css +++ b/webroot/rsrc/css/application/dashboard/dashboard.css @@ -70,6 +70,10 @@ margin: 0; } +.dashboard-panel .phui-object-item-empty .phui-error-view { + margin: 0; +} + .dashboard-panel .dashboard-box { padding: 12px; background: #fff; diff --git a/webroot/rsrc/css/phui/phui-object-item-list-view.css b/webroot/rsrc/css/phui/phui-object-item-list-view.css index 0031df20bc..4b0b0f54f9 100644 --- a/webroot/rsrc/css/phui/phui-object-item-list-view.css +++ b/webroot/rsrc/css/phui/phui-object-item-list-view.css @@ -69,6 +69,10 @@ ul.phui-object-item-list-view { margin: 0 0 4px 0; } +.phui-object-box .phui-object-list-flush .phui-object-item { + margin: 0; +} + .phui-object-item-name { font-weight: bold; padding: 8px 8px 0;