From 6872b9680877168fc53e66ee246e99deb049f0f4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 7 Mar 2016 16:14:01 -0800 Subject: [PATCH] Convert Nuance sources and queues to two-column + curtain Summary: Ref T10537. Update the detail views. Test Plan: {F1162212} {F1162213} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10537 Differential Revision: https://secure.phabricator.com/D15430 --- .../controller/NuanceQueueViewController.php | 49 ++++------- .../controller/NuanceSourceViewController.php | 84 +++++++------------ 2 files changed, 46 insertions(+), 87 deletions(-) diff --git a/src/applications/nuance/controller/NuanceQueueViewController.php b/src/applications/nuance/controller/NuanceQueueViewController.php index a5fa908c4a..8f4e85565a 100644 --- a/src/applications/nuance/controller/NuanceQueueViewController.php +++ b/src/applications/nuance/controller/NuanceQueueViewController.php @@ -19,29 +19,25 @@ final class NuanceQueueViewController $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Queues'), $this->getApplicationURI('queue/')); $crumbs->addTextCrumb($queue->getName()); + $crumbs->setBorder(true); $header = $this->buildHeaderView($queue); - $actions = $this->buildActionView($queue); - $properties = $this->buildPropertyView($queue, $actions); - - $box = id(new PHUIObjectBoxView()) - ->setHeader($header) - ->addPropertyList($properties); + $curtain = $this->buildCurtain($queue); $timeline = $this->buildTransactionTimeline( $queue, new NuanceQueueTransactionQuery()); $timeline->setShouldTerminate(true); - return $this->buildApplicationPage( - array( - $crumbs, - $box, - $timeline, - ), - array( - 'title' => $title, - )); + $view = id(new PHUITwoColumnView()) + ->setHeader($header) + ->setCurtain($curtain) + ->setMainColumn($timeline); + + return $this->newPage() + ->setTitle($title) + ->setCrumbs($crumbs) + ->appendChild($view); } private function buildHeaderView(NuanceQueue $queue) { @@ -55,19 +51,18 @@ final class NuanceQueueViewController return $header; } - private function buildActionView(NuanceQueue $queue) { + private function buildCurtain(NuanceQueue $queue) { $viewer = $this->getViewer(); $id = $queue->getID(); - $actions = id(new PhabricatorActionListView()) - ->setUser($viewer); - $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, $queue, PhabricatorPolicyCapability::CAN_EDIT); - $actions->addAction( + $curtain = $this->newCurtainView($queue); + + $curtain->addAction( id(new PhabricatorActionView()) ->setName(pht('Edit Queue')) ->setIcon('fa-pencil') @@ -75,19 +70,7 @@ final class NuanceQueueViewController ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); - return $actions; + return $curtain; } - private function buildPropertyView( - NuanceQueue $queue, - PhabricatorActionListView $actions) { - $viewer = $this->getViewer(); - - $properties = id(new PHUIPropertyListView()) - ->setUser($viewer) - ->setObject($queue) - ->setActionList($actions); - - return $properties; - } } diff --git a/src/applications/nuance/controller/NuanceSourceViewController.php b/src/applications/nuance/controller/NuanceSourceViewController.php index 90eaea8046..babd4e88f8 100644 --- a/src/applications/nuance/controller/NuanceSourceViewController.php +++ b/src/applications/nuance/controller/NuanceSourceViewController.php @@ -16,53 +16,38 @@ final class NuanceSourceViewController $source_id = $source->getID(); - $timeline = $this->buildTransactionTimeline( - $source, - new NuanceSourceTransactionQuery()); - $timeline->setShouldTerminate(true); - $header = $this->buildHeaderView($source); - $actions = $this->buildActionView($source); - $properties = $this->buildPropertyView($source, $actions); - - $box = id(new PHUIObjectBoxView()) - ->setHeader($header) - ->addPropertyList($properties); + $curtain = $this->buildCurtain($source); + $properties = $this->buildPropertyView($source); $title = $source->getName(); - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb(pht('Sources'), $this->getApplicationURI('source/')); - - $crumbs->addTextCrumb($title); - - - $can_edit = PhabricatorPolicyFilter::hasCapability( - $viewer, - $source, - PhabricatorPolicyCapability::CAN_EDIT); $routing_list = id(new PHUIPropertyListView()) ->addProperty( pht('Default Queue'), $viewer->renderHandle($source->getDefaultQueuePHID())); - $routing_header = id(new PHUIHeaderView()) - ->setHeader(pht('Routing Rules')); + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb(pht('Sources'), $this->getApplicationURI('source/')); + $crumbs->addTextCrumb($title); + $crumbs->setBorder(true); - $routing = id(new PHUIObjectBoxView()) - ->setHeader($routing_header) - ->addPropertyList($routing_list); + $timeline = $this->buildTransactionTimeline( + $source, + new NuanceSourceTransactionQuery()); + $timeline->setShouldTerminate(true); - return $this->buildApplicationPage( - array( - $crumbs, - $box, - $routing, - $timeline, - ), - array( - 'title' => $title, - )); + $view = id(new PHUITwoColumnView()) + ->setHeader($header) + ->setCurtain($curtain) + ->addPropertySection(pht('DETAILS'), $properties) + ->addPropertySection(pht('ROUTING'), $routing_list) + ->setMainColumn($timeline); + + return $this->newPage() + ->setTitle($title) + ->setCrumbs($crumbs) + ->appendChild($view); } private function buildHeaderView(NuanceSource $source) { @@ -76,7 +61,7 @@ final class NuanceSourceViewController return $header; } - private function buildActionView(NuanceSource $source) { + private function buildCurtain(NuanceSource $source) { $viewer = $this->getViewer(); $id = $source->getID(); @@ -88,7 +73,9 @@ final class NuanceSourceViewController $source, PhabricatorPolicyCapability::CAN_EDIT); - $actions->addAction( + $curtain = $this->newCurtainView($source); + + $curtain->addAction( id(new PhabricatorActionView()) ->setName(pht('Edit Source')) ->setIcon('fa-pencil') @@ -100,35 +87,24 @@ final class NuanceSourceViewController $definition = $source->requireDefinition(); $source_actions = $definition->getSourceViewActions($request); foreach ($source_actions as $source_action) { - $actions->addAction($source_action); + $curtain->addAction($source_action); } - return $actions; + return $curtain; } private function buildPropertyView( - NuanceSource $source, - PhabricatorActionListView $actions) { - $viewer = $this->getRequest()->getUser(); + NuanceSource $source) { + $viewer = $this->getViewer(); $properties = id(new PHUIPropertyListView()) - ->setUser($viewer) - ->setObject($source) - ->setActionList($actions); + ->setViewer($viewer); $definition = $source->requireDefinition(); $properties->addProperty( pht('Source Type'), $definition->getName()); - $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( - $viewer, - $source); - - $properties->addProperty( - pht('Editable By'), - $descriptions[PhabricatorPolicyCapability::CAN_EDIT]); - return $properties; } }