From 218ab398b0ef1c47809836b420091688560d5716 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 27 Oct 2015 19:32:35 +0000 Subject: [PATCH] Allow ObjectLists to be set to Dialogs Summary: Better formatting for object lists when in a dialog (like subscribers). Test Plan: Test a subscription list. {F911522} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D14353 --- resources/celerity/map.php | 6 ++--- .../view/SubscriptionListDialogBuilder.php | 5 ++-- src/view/AphrontDialogView.php | 24 +++++++++++++++---- webroot/rsrc/css/aphront/dialog-view.css | 10 ++++++++ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index ee959fa58a..00498fa482 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => 'd80f5c3e', + 'core.pkg.css' => 'd25d16e4', 'core.pkg.js' => '47dc9ebb', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '2de124c9', @@ -18,7 +18,7 @@ return array( 'maniphest.pkg.js' => '3ec6a6d5', 'rsrc/css/aphront/aphront-bars.css' => '231ac33c', 'rsrc/css/aphront/dark-console.css' => '6378ef3d', - 'rsrc/css/aphront/dialog-view.css' => 'fe58b18d', + 'rsrc/css/aphront/dialog-view.css' => 'be0e3a46', 'rsrc/css/aphront/lightbox-attachment.css' => '7acac05d', 'rsrc/css/aphront/list-filter-view.css' => '5d6f0526', 'rsrc/css/aphront/multi-column.css' => 'fd18389d', @@ -489,7 +489,7 @@ return array( 'almanac-css' => 'dbb9b3af', 'aphront-bars' => '231ac33c', 'aphront-dark-console-css' => '6378ef3d', - 'aphront-dialog-view-css' => 'fe58b18d', + 'aphront-dialog-view-css' => 'be0e3a46', 'aphront-list-filter-view-css' => '5d6f0526', 'aphront-multi-column-view-css' => 'fd18389d', 'aphront-panel-view-css' => '8427b78d', diff --git a/src/applications/subscriptions/view/SubscriptionListDialogBuilder.php b/src/applications/subscriptions/view/SubscriptionListDialogBuilder.php index a4d382e170..7d1b8d799c 100644 --- a/src/applications/subscriptions/view/SubscriptionListDialogBuilder.php +++ b/src/applications/subscriptions/view/SubscriptionListDialogBuilder.php @@ -54,15 +54,14 @@ final class SubscriptionListDialogBuilder extends Phobject { ->setUser($this->getViewer()) ->setWidth(AphrontDialogView::WIDTH_FORM) ->setTitle($this->getTitle()) - ->appendChild($this->buildBody($this->getViewer(), $handles)) + ->setObjectList($this->buildBody($this->getViewer(), $handles)) ->addCancelButton($object_handle->getURI(), pht('Close')); } private function buildBody(PhabricatorUser $viewer, array $handles) { $list = id(new PHUIObjectItemListView()) - ->setUser($viewer) - ->setFlush(true); + ->setUser($viewer); foreach ($handles as $handle) { $item = id(new PHUIObjectItemView()) ->setHeader($handle->getFullName()) diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php index a336e990a2..f8bc3fa060 100644 --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -23,6 +23,7 @@ final class AphrontDialogView private $errors = array(); private $flush; private $validationException; + private $objectList; const WIDTH_DEFAULT = 'default'; @@ -132,6 +133,13 @@ final class AphrontDialogView return $this; } + public function setObjectList(PHUIObjectItemListView $list) { + $this->objectList = true; + $box = id(new PHUIObjectBoxView()) + ->setObjectList($list); + return $this->appendChild($box); + } + public function appendParagraph($paragraph) { return $this->appendChild( phutil_tag( @@ -236,15 +244,17 @@ final class AphrontDialogView __CLASS__)); } - $more = $this->class; + $classes = array(); + $classes[] = 'aphront-dialog-view'; + $classes[] = $this->class; if ($this->flush) { - $more .= ' aphront-dialog-flush'; + $classes[] = 'aphront-dialog-flush'; } switch ($this->width) { case self::WIDTH_FORM: case self::WIDTH_FULL: - $more .= ' aphront-dialog-view-width-'.$this->width; + $classes[] = 'aphront-dialog-view-width-'.$this->width; break; case self::WIDTH_DEFAULT: break; @@ -256,11 +266,15 @@ final class AphrontDialogView } if ($this->isStandalone) { - $more .= ' aphront-dialog-view-standalone'; + $classes[] = 'aphront-dialog-view-standalone'; + } + + if ($this->objectList) { + $classes[] = 'aphront-dialog-object-list'; } $attributes = array( - 'class' => 'aphront-dialog-view '.$more, + 'class' => implode(' ', $classes), 'sigil' => 'jx-dialog', ); diff --git a/webroot/rsrc/css/aphront/dialog-view.css b/webroot/rsrc/css/aphront/dialog-view.css index 88da74e8e1..3043400357 100644 --- a/webroot/rsrc/css/aphront/dialog-view.css +++ b/webroot/rsrc/css/aphront/dialog-view.css @@ -128,3 +128,13 @@ border: 0; border-top: 1px solid {$thinblueborder}; } + +.aphront-dialog-object-list .phui-object-box { + border: none; + padding: 0; + margin: 0; +} + +.aphront-dialog-object-list .aphront-dialog-body { + padding: 0 12px; +}