mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +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 Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17879
This commit is contained in:
parent
a5ad11d2d2
commit
89e567ffd9
4 changed files with 51 additions and 88 deletions
|
@ -28,6 +28,7 @@ final class PhabricatorProjectBoardBackgroundController
|
|||
$this->setProject($board);
|
||||
$id = $board->getID();
|
||||
|
||||
$view_uri = $this->getApplicationURI("board/{$id}/");
|
||||
$manage_uri = $this->getApplicationURI("board/{$id}/manage/");
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
|
@ -47,7 +48,7 @@ final class PhabricatorProjectBoardBackgroundController
|
|||
->applyTransactions($board, $xactions);
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI($manage_uri);
|
||||
->setURI($view_uri);
|
||||
}
|
||||
|
||||
$nav = $this->getProfileMenu();
|
||||
|
|
|
@ -31,112 +31,58 @@ final class PhabricatorProjectBoardManageController
|
|||
$board_id = $board->getID();
|
||||
|
||||
$header = $this->buildHeaderView($board);
|
||||
$actions = $this->buildActionView($board);
|
||||
$properties = $this->buildPropertyView($board);
|
||||
|
||||
$properties->setActionList($actions);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/");
|
||||
$crumbs->addTextCrumb(pht('Manage'));
|
||||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
->addPropertyList($properties);
|
||||
$crumbs->setBorder(true);
|
||||
|
||||
$nav = $this->getProfileMenu();
|
||||
$columns_list = $this->buildColumnsList($board, $columns);
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setFooter($columns_list);
|
||||
|
||||
$title = array(
|
||||
pht('Manage Workboard'),
|
||||
$board->getDisplayName(),
|
||||
);
|
||||
|
||||
$columns_list = $this->buildColumnsList($board, $columns);
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle($title)
|
||||
->setNavigation($nav)
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild(
|
||||
array(
|
||||
$box,
|
||||
$columns_list,
|
||||
));
|
||||
->appendChild($view);
|
||||
}
|
||||
|
||||
private function buildHeaderView(PhabricatorProject $board) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$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);
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$board,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
|
||||
$reorder_uri = $this->getApplicationURI("board/{$id}/reorder/");
|
||||
|
||||
$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));
|
||||
|
||||
$id = $board->getID();
|
||||
$disable_uri = $this->getApplicationURI("board/{$id}/disable/");
|
||||
|
||||
$actions->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setIcon('fa-ban')
|
||||
->setName(pht('Disable Board'))
|
||||
->setHref($disable_uri)
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(true));
|
||||
$button = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setIcon('fa-ban')
|
||||
->setText(pht('Disable Board'))
|
||||
->setHref($disable_uri)
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(true);
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
private function buildPropertyView(
|
||||
PhabricatorProject $board) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$properties = id(new PHUIPropertyListView())
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('Workboard: %s', $board->getDisplayName()))
|
||||
->setUser($viewer)
|
||||
->setObject($board);
|
||||
->setPolicyObject($board)
|
||||
->setProfileHeader(true)
|
||||
->addActionLink($button);
|
||||
|
||||
$background = $board->getDisplayWorkboardBackgroundColor();
|
||||
if ($background !== null) {
|
||||
$map = PhabricatorProjectWorkboardBackgroundColor::getOptions();
|
||||
$map = ipull($map, 'name');
|
||||
|
||||
$name = idx($map, $background, $background);
|
||||
$properties->addProperty(pht('Background Color'), $name);
|
||||
}
|
||||
|
||||
return $properties;
|
||||
return $header;
|
||||
}
|
||||
|
||||
private function buildColumnsList(
|
||||
|
@ -165,6 +111,11 @@ final class PhabricatorProjectBoardManageController
|
|||
|
||||
if ($column->isHidden()) {
|
||||
$item->setDisabled(true);
|
||||
$item->addAttribute(pht('Hidden'));
|
||||
$item->setImageIcon('fa-columns grey');
|
||||
} else {
|
||||
$item->addAttribute(pht('Visible'));
|
||||
$item->setImageIcon('fa-columns');
|
||||
}
|
||||
|
||||
$view->addItem($item);
|
||||
|
|
|
@ -23,13 +23,13 @@ final class PhabricatorProjectBoardReorderController
|
|||
$this->setProject($project);
|
||||
$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/");
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
// User clicked "Done", make sure the page reloads to show the new
|
||||
// column order.
|
||||
return id(new AphrontRedirectResponse())->setURI($manage_uri);
|
||||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
||||
}
|
||||
|
||||
$columns = id(new PhabricatorProjectColumnQuery())
|
||||
|
|
|
@ -705,10 +705,21 @@ final class PhabricatorProjectBoardViewController
|
|||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(true);
|
||||
|
||||
$reorder_uri = $this->getApplicationURI("board/{$id}/reorder/");
|
||||
$manage_items[] = id(new PhabricatorActionView())
|
||||
->setIcon('fa-pencil')
|
||||
->setName(pht('Manage Board'))
|
||||
->setHref($manage_uri);
|
||||
->setIcon('fa-exchange')
|
||||
->setName(pht('Reorder Columns'))
|
||||
->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) {
|
||||
$hidden_uri = $this->getURIWithState()
|
||||
|
@ -727,6 +738,12 @@ final class PhabricatorProjectBoardViewController
|
|||
->setName($hidden_text)
|
||||
->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->setQueryParam('batch', self::BATCH_EDIT_ALL);
|
||||
$can_batch_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
|
@ -734,12 +751,6 @@ final class PhabricatorProjectBoardViewController
|
|||
PhabricatorApplication::getByClass('PhabricatorManiphestApplication'),
|
||||
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())
|
||||
->setUser($viewer);
|
||||
foreach ($manage_items as $item) {
|
||||
|
|
Loading…
Reference in a new issue