From 1e5f96e77333139e31ea5dfae9737b2296021247 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 3 Mar 2015 13:51:28 -0800 Subject: [PATCH] Modernize Owners a bit Summary: Update Owners per current UI standards, add crumbs at each level, removed AphrontPanels, check spacing. Test Plan: Tested a list of owner packages, editing a package, creating a package, and various filters. Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11961 --- .../PhabricatorOwnersController.php | 11 ++-- .../PhabricatorOwnersDetailController.php | 65 +++++++++---------- .../PhabricatorOwnersEditController.php | 8 +++ .../PhabricatorOwnersListController.php | 17 +++-- 4 files changed, 55 insertions(+), 46 deletions(-) diff --git a/src/applications/owners/controller/PhabricatorOwnersController.php b/src/applications/owners/controller/PhabricatorOwnersController.php index 65b0292cb0..4066b297dc 100644 --- a/src/applications/owners/controller/PhabricatorOwnersController.php +++ b/src/applications/owners/controller/PhabricatorOwnersController.php @@ -44,8 +44,11 @@ abstract class PhabricatorOwnersController extends PhabricatorController { break; } - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb($title); + return $nav; + } + + protected function buildApplicationCrumbs() { + $crumbs = parent::buildApplicationCrumbs(); $crumbs->addAction( id(new PHUIListItemView()) @@ -53,9 +56,7 @@ abstract class PhabricatorOwnersController extends PhabricatorController { ->setHref('/owners/new/') ->setIcon('fa-plus-square')); - $nav->setCrumbs($crumbs); - - return $nav; + return $crumbs; } public function buildApplicationMenu() { diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php index 5a56a73190..e261eb848a 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -111,27 +111,24 @@ final class PhabricatorOwnersDetailController 'wide', )); - $panel = new AphrontPanelView(); - $panel->setNoBackground(); - $panel->setHeader( + $panel = new PHUIObjectBoxView(); + $header = new PHUIHeaderView(); + $header->setHeader( pht('Package Details for "%s"', $package->getName())); - $panel->addButton( - javelin_tag( - 'a', - array( - 'href' => '/owners/delete/'.$package->getID().'/', - 'class' => 'button grey', - 'sigil' => 'workflow', - ), - pht('Delete Package'))); - $panel->addButton( - phutil_tag( - 'a', - array( - 'href' => '/owners/edit/'.$package->getID().'/', - 'class' => 'button', - ), - pht('Edit Package'))); + $header->addActionLink( + id(new PHUIButtonView()) + ->setTag('a') + ->setHref('/owners/delete/'.$package->getID().'/') + ->addSigil('workflow') + ->setText(pht('Delete Package'))); + + $header->addActionLink( + id(new PHUIButtonView()) + ->setTag('a') + ->setHref('/owners/edit/'.$package->getID().'/') + ->setText(pht('Edit Package'))); + + $panel->setHeader($header); $panel->appendChild($table); $key = 'package/'.$package->getID(); @@ -185,13 +182,10 @@ final class PhabricatorOwnersDetailController $commit_views[] = array( 'view' => $view, 'header' => pht('Recent Commits in Package'), - 'button' => phutil_tag( - 'a', - array( - 'href' => $commit_uri, - 'class' => 'button grey', - ), - pht('View All Package Commits')), + 'button' => id(new PHUIButtonView()) + ->setTag('a') + ->setHref($commit_uri) + ->setText(pht('View All Package Commits')), ); $phids = array(); @@ -203,26 +197,29 @@ final class PhabricatorOwnersDetailController $commit_panels = array(); foreach ($commit_views as $commit_view) { - $commit_panel = new AphrontPanelView(); - $commit_panel->setNoBackground(); - $commit_panel->setHeader($commit_view['header']); + $commit_panel = new PHUIObjectBoxView(); + $header = new PHUIHeaderView(); + $header->setHeader($commit_view['header']); if (isset($commit_view['button'])) { - $commit_panel->addButton($commit_view['button']); + $header->addActionLink($commit_view['button']); } $commit_view['view']->setHandles($handles); + $commit_panel->setHeader($header); $commit_panel->appendChild($commit_view['view']); $commit_panels[] = $commit_panel; } + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb($package->getName()); + $nav = $this->buildSideNavView(); + $nav->appendChild($crumbs); $nav->appendChild($panel); $nav->appendChild($commit_panels); return $this->buildApplicationPage( - array( - $nav, - ), + $nav, array( 'title' => pht('Package %s', $package->getName()), )); diff --git a/src/applications/owners/controller/PhabricatorOwnersEditController.php b/src/applications/owners/controller/PhabricatorOwnersEditController.php index 718dc6ce2d..249b461fbb 100644 --- a/src/applications/owners/controller/PhabricatorOwnersEditController.php +++ b/src/applications/owners/controller/PhabricatorOwnersEditController.php @@ -251,7 +251,15 @@ final class PhabricatorOwnersEditController ->setFormErrors($errors) ->setForm($form); + $crumbs = $this->buildApplicationCrumbs(); + if ($package->getID()) { + $crumbs->addTextCrumb(pht('Edit %s', $package->getName())); + } else { + $crumbs->addTextCrumb(pht('New Package')); + } + $nav = $this->buildSideNavView(); + $nav->appendChild($crumbs); $nav->appendChild($form_box); return $this->buildApplicationPage( diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php index b492f73eaf..0d9041df80 100644 --- a/src/applications/owners/controller/PhabricatorOwnersListController.php +++ b/src/applications/owners/controller/PhabricatorOwnersListController.php @@ -130,7 +130,7 @@ final class PhabricatorOwnersListController } $packages = $package->loadAllFromArray($data); - $header = pht('Owned Packages'); + $header = pht('Project Packages'); $nodata = pht('No owned packages'); break; case 'all': @@ -198,15 +198,19 @@ final class PhabricatorOwnersListController ->setValue(pht('Search for Packages'))); $filter->appendChild($form); + $title = pht('Package Index'); + + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb($header); + $crumbs->setBorder(true); $nav = $this->buildSideNavView(); + $nav->appendChild($crumbs); $nav->appendChild($filter); $nav->appendChild($content); return $this->buildApplicationPage( - array( - $nav, - ), + $nav, array( 'title' => pht('Package Index'), )); @@ -330,10 +334,9 @@ final class PhabricatorOwnersListController 'narrow', )); - $panel = new AphrontPanelView(); - $panel->setHeader($header); + $panel = new PHUIObjectBoxView(); + $panel->setHeaderText($header); $panel->appendChild($table); - $panel->setNoBackground(); return $panel; }