1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-15 18:10:53 +01:00

Move Board Manage actions up a level

Summary: Moves "reorder columns" and "change background" up a level, redesigns "manage" page to be a little cleaner.

Test Plan: Change colors, reorder columns, manage page, disable board, re-enable board.

Reviewers: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17879
This commit is contained in:
Chad Little 2017-05-14 14:15:06 -07:00 committed by epriestley
parent c7a6422559
commit bc6d25ffc0
4 changed files with 51 additions and 88 deletions

View file

@ -28,6 +28,7 @@ final class PhabricatorProjectBoardBackgroundController
$this->setProject($board); $this->setProject($board);
$id = $board->getID(); $id = $board->getID();
$view_uri = $this->getApplicationURI("board/{$id}/");
$manage_uri = $this->getApplicationURI("board/{$id}/manage/"); $manage_uri = $this->getApplicationURI("board/{$id}/manage/");
if ($request->isFormPost()) { if ($request->isFormPost()) {
@ -47,7 +48,7 @@ final class PhabricatorProjectBoardBackgroundController
->applyTransactions($board, $xactions); ->applyTransactions($board, $xactions);
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI($manage_uri); ->setURI($view_uri);
} }
$nav = $this->getProfileMenu(); $nav = $this->getProfileMenu();

View file

@ -31,112 +31,58 @@ final class PhabricatorProjectBoardManageController
$board_id = $board->getID(); $board_id = $board->getID();
$header = $this->buildHeaderView($board); $header = $this->buildHeaderView($board);
$actions = $this->buildActionView($board);
$properties = $this->buildPropertyView($board);
$properties->setActionList($actions);
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/"); $crumbs->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/");
$crumbs->addTextCrumb(pht('Manage')); $crumbs->addTextCrumb(pht('Manage'));
$crumbs->setBorder(true);
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$nav = $this->getProfileMenu(); $nav = $this->getProfileMenu();
$columns_list = $this->buildColumnsList($board, $columns);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter($columns_list);
$title = array( $title = array(
pht('Manage Workboard'), pht('Manage Workboard'),
$board->getDisplayName(), $board->getDisplayName(),
); );
$columns_list = $this->buildColumnsList($board, $columns);
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
->setNavigation($nav) ->setNavigation($nav)
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->appendChild( ->appendChild($view);
array(
$box,
$columns_list,
));
} }
private function buildHeaderView(PhabricatorProject $board) { private function buildHeaderView(PhabricatorProject $board) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$header = id(new PHUIHeaderView())
->setUser($viewer)
->setHeader(pht('Workboard: %s', $board->getDisplayName()));
return $header;
}
private function buildActionView(PhabricatorProject $board) {
$viewer = $this->getRequest()->getUser();
$id = $board->getID();
$actions = id(new PhabricatorActionListView())
->setUser($viewer);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$board, $board,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$reorder_uri = $this->getApplicationURI("board/{$id}/reorder/"); $id = $board->getID();
$actions->addAction(
id(new PhabricatorActionView())
->setIcon('fa-exchange')
->setName(pht('Reorder Columns'))
->setHref($reorder_uri)
->setDisabled(!$can_edit)
->setWorkflow(true));
$background_uri = $this->getApplicationURI("board/{$id}/background/");
$actions->addAction(
id(new PhabricatorActionView())
->setIcon('fa-paint-brush')
->setName(pht('Change Background Color'))
->setHref($background_uri)
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
$disable_uri = $this->getApplicationURI("board/{$id}/disable/"); $disable_uri = $this->getApplicationURI("board/{$id}/disable/");
$actions->addAction( $button = id(new PHUIButtonView())
id(new PhabricatorActionView()) ->setTag('a')
->setIcon('fa-ban') ->setIcon('fa-ban')
->setName(pht('Disable Board')) ->setText(pht('Disable Board'))
->setHref($disable_uri) ->setHref($disable_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)); ->setWorkflow(true);
return $actions; $header = id(new PHUIHeaderView())
} ->setHeader(pht('Workboard: %s', $board->getDisplayName()))
private function buildPropertyView(
PhabricatorProject $board) {
$viewer = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView())
->setUser($viewer) ->setUser($viewer)
->setObject($board); ->setPolicyObject($board)
->setProfileHeader(true)
->addActionLink($button);
$background = $board->getDisplayWorkboardBackgroundColor(); return $header;
if ($background !== null) {
$map = PhabricatorProjectWorkboardBackgroundColor::getOptions();
$map = ipull($map, 'name');
$name = idx($map, $background, $background);
$properties->addProperty(pht('Background Color'), $name);
}
return $properties;
} }
private function buildColumnsList( private function buildColumnsList(
@ -165,6 +111,11 @@ final class PhabricatorProjectBoardManageController
if ($column->isHidden()) { if ($column->isHidden()) {
$item->setDisabled(true); $item->setDisabled(true);
$item->addAttribute(pht('Hidden'));
$item->setImageIcon('fa-columns grey');
} else {
$item->addAttribute(pht('Visible'));
$item->setImageIcon('fa-columns');
} }
$view->addItem($item); $view->addItem($item);

View file

@ -23,13 +23,13 @@ final class PhabricatorProjectBoardReorderController
$this->setProject($project); $this->setProject($project);
$project_id = $project->getID(); $project_id = $project->getID();
$manage_uri = $this->getApplicationURI("board/{$project_id}/manage/"); $view_uri = $this->getApplicationURI("board/{$project_id}/");
$reorder_uri = $this->getApplicationURI("board/{$project_id}/reorder/"); $reorder_uri = $this->getApplicationURI("board/{$project_id}/reorder/");
if ($request->isFormPost()) { if ($request->isFormPost()) {
// User clicked "Done", make sure the page reloads to show the new // User clicked "Done", make sure the page reloads to show the new
// column order. // column order.
return id(new AphrontRedirectResponse())->setURI($manage_uri); return id(new AphrontRedirectResponse())->setURI($view_uri);
} }
$columns = id(new PhabricatorProjectColumnQuery()) $columns = id(new PhabricatorProjectColumnQuery())

View file

@ -705,10 +705,21 @@ final class PhabricatorProjectBoardViewController
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true); ->setWorkflow(true);
$reorder_uri = $this->getApplicationURI("board/{$id}/reorder/");
$manage_items[] = id(new PhabricatorActionView()) $manage_items[] = id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-exchange')
->setName(pht('Manage Board')) ->setName(pht('Reorder Columns'))
->setHref($manage_uri); ->setHref($reorder_uri)
->setDisabled(!$can_edit)
->setWorkflow(true);
$background_uri = $this->getApplicationURI("board/{$id}/background/");
$manage_items[] = id(new PhabricatorActionView())
->setIcon('fa-paint-brush')
->setName(pht('Change Background Color'))
->setHref($background_uri)
->setDisabled(!$can_edit)
->setWorkflow(false);
if ($show_hidden) { if ($show_hidden) {
$hidden_uri = $this->getURIWithState() $hidden_uri = $this->getURIWithState()
@ -727,6 +738,12 @@ final class PhabricatorProjectBoardViewController
->setName($hidden_text) ->setName($hidden_text)
->setHref($hidden_uri); ->setHref($hidden_uri);
$manage_uri = $this->getApplicationURI("board/{$id}/manage/");
$manage_items[] = id(new PhabricatorActionView())
->setIcon('fa-gear')
->setName(pht('Manage Workboard'))
->setHref($manage_uri);
$batch_edit_uri = $request->getRequestURI(); $batch_edit_uri = $request->getRequestURI();
$batch_edit_uri->setQueryParam('batch', self::BATCH_EDIT_ALL); $batch_edit_uri->setQueryParam('batch', self::BATCH_EDIT_ALL);
$can_batch_edit = PhabricatorPolicyFilter::hasCapability( $can_batch_edit = PhabricatorPolicyFilter::hasCapability(
@ -734,12 +751,6 @@ final class PhabricatorProjectBoardViewController
PhabricatorApplication::getByClass('PhabricatorManiphestApplication'), PhabricatorApplication::getByClass('PhabricatorManiphestApplication'),
ManiphestBulkEditCapability::CAPABILITY); ManiphestBulkEditCapability::CAPABILITY);
$manage_items[] = id(new PhabricatorActionView())
->setIcon('fa-list-ul')
->setName(pht('Batch Edit Visible Tasks...'))
->setHref($batch_edit_uri)
->setDisabled(!$can_batch_edit);
$manage_menu = id(new PhabricatorActionListView()) $manage_menu = id(new PhabricatorActionListView())
->setUser($viewer); ->setUser($viewer);
foreach ($manage_items as $item) { foreach ($manage_items as $item) {