1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Convert workboard column options into a dropdown menu

Summary:
Ref T5024, T4427, T5474, T5523. Instead of separate icons in the column header for "Create Task" and "Edit Column Settings", use a dropdown menu.

  - T5024 will likely add a "View Standalone" option.
  - T4427 needs header space to show a count.
  - T5474 likely needs "Edit Triggers..." (this seems reasonable to separate from editing the name, etc.)
  - T5523 likely adds "Move all tasks..." eventually.

Test Plan: {F187414}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5523, T5474, T5024, T4427

Differential Revision: https://secure.phabricator.com/D10190
This commit is contained in:
epriestley 2014-08-08 10:35:51 -07:00
parent 417b6bbe41
commit abfff87f26
5 changed files with 80 additions and 43 deletions

View file

@ -415,7 +415,7 @@ return array(
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => 'fe9a552f',
'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b',
'rsrc/js/application/projects/behavior-boards-dropdown.js' => '0ec56e1d',
'rsrc/js/application/projects/behavior-project-boards.js' => 'f47fa23b',
'rsrc/js/application/projects/behavior-project-boards.js' => 'd4bf1f3c',
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
'rsrc/js/application/projects/behavior-reorder-columns.js' => '09eee344',
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
@ -639,7 +639,7 @@ return array(
'javelin-behavior-policy-control' => 'f3fef818',
'javelin-behavior-policy-rule-editor' => 'fe9a552f',
'javelin-behavior-ponder-votebox' => '4e9b766b',
'javelin-behavior-project-boards' => 'f47fa23b',
'javelin-behavior-project-boards' => 'd4bf1f3c',
'javelin-behavior-project-create' => '065227cc',
'javelin-behavior-refresh-csrf' => '7814b593',
'javelin-behavior-releeph-preview-branch' => 'b2b4fbaf',
@ -1700,6 +1700,14 @@ return array(
'javelin-dom',
'javelin-view',
),
'd4bf1f3c' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'phabricator-draggable-list',
),
'd4eecc63' => array(
'javelin-behavior',
'javelin-dom',
@ -1844,14 +1852,6 @@ return array(
'phuix-action-view',
'javelin-workflow',
),
'f47fa23b' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'phabricator-draggable-list',
),
'f51afce0' => array(
'javelin-behavior',
'javelin-request',

View file

@ -223,14 +223,8 @@ final class PhabricatorProjectBoardViewController
->setHeader($column->getDisplayName())
->setHeaderColor($column->getHeaderColor());
$panel->setEditURI($board_uri.'column/'.$column->getID().'/');
$panel->setHeaderAction(id(new PHUIIconView())
->setIconFont('fa-plus')
->setHref('/maniphest/task/create/')
->addSigil('column-add-task')
->setMetadata(
array('columnPHID' => $column->getPHID())));
$column_menu = $this->buildColumnMenu($project, $column);
$panel->addHeaderAction($column_menu);
$cards = id(new PHUIObjectItemListView())
->setUser($viewer)
@ -511,6 +505,59 @@ final class PhabricatorProjectBoardViewController
return $manage_button;
}
private function buildColumnMenu(
PhabricatorProject $project,
PhabricatorProjectColumn $column) {
$request = $this->getRequest();
$viewer = $request->getUser();
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$project,
PhabricatorPolicyCapability::CAN_EDIT);
$column_items = array();
$column_items[] = id(new PhabricatorActionView())
->setIcon('fa-plus')
->setName(pht('Create Task...'))
->setHref('/maniphest/task/create/')
->addSigil('column-add-task')
->setMetadata(
array(
'columnPHID' => $column->getPHID(),
))
->setDisabled(!$can_edit);
$edit_uri = $this->getApplicationURI(
'board/'.$this->id.'/column/'.$column->getID().'/');
$column_items[] = id(new PhabricatorActionView())
->setIcon('fa-pencil')
->setName(pht('Edit Column'))
->setHref($edit_uri)
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit);
$column_menu = id(new PhabricatorActionListView())
->setUser($viewer);
foreach ($column_items as $item) {
$column_menu->addAction($item);
}
$column_button = id(new PHUIIconView())
->setIconFont('fa-caret-down')
->setHref('#')
->addSigil('boards-dropdown-menu')
->setMetadata(
array(
'items' => hsprintf('%s', $column_menu),
));
return $column_button;
}
private function initializeWorkboardDialog(PhabricatorProject $project) {
$instructions = pht('This workboard has not been setup yet.');

View file

@ -255,7 +255,7 @@ final class PHUITimelineEventView extends AphrontView {
if ($items || $has_menu) {
$icon = id(new PHUIIconView())
->setIconFont('fa-cog');
->setIconFont('fa-caret-down');
$aural = javelin_tag(
'span',
array(

View file

@ -4,15 +4,9 @@ final class PHUIWorkpanelView extends AphrontTagView {
private $cards = array();
private $header;
private $editURI;
private $headerAction;
private $footerAction;
private $headerColor = PHUIActionHeaderView::HEADER_GREY;
public function setHeaderAction(PHUIIconView $header_action) {
$this->headerAction = $header_action;
return $this;
}
private $headerActions = array();
public function setCards(PHUIObjectItemListView $cards) {
$this->cards[] = $cards;
@ -24,11 +18,6 @@ final class PHUIWorkpanelView extends AphrontTagView {
return $this;
}
public function setEditURI($edit_uri) {
$this->editURI = $edit_uri;
return $this;
}
public function setFooterAction(PHUIListItemView $footer_action) {
$this->footerAction = $footer_action;
return $this;
@ -39,6 +28,11 @@ final class PHUIWorkpanelView extends AphrontTagView {
return $this;
}
public function addHeaderAction(PHUIIconView $action) {
$this->headerActions[] = $action;
return $this;
}
public function getTagAttributes() {
return array(
'class' => 'phui-workpanel-view',
@ -61,20 +55,12 @@ final class PHUIWorkpanelView extends AphrontTagView {
$footer_tag);
}
$header_edit = null;
if ($this->editURI) {
$header_edit = id(new PHUIIconView())
->setIconFont('fa-pencil')
->setHref($this->editURI);
}
$header = id(new PHUIActionHeaderView())
->setHeaderTitle($this->header)
->setHeaderColor($this->headerColor);
if ($header_edit) {
$header->addAction($header_edit);
}
if ($this->headerAction) {
$header->addAction($this->headerAction);
foreach ($this->headerActions as $action) {
$header->addAction($action);
}
$classes[] = 'phui-workpanel-'.$this->headerColor;

View file

@ -163,7 +163,11 @@ JX.behavior('project-boards', function(config) {
'click',
['column-add-task'],
function (e) {
e.kill();
// We want the 'boards-dropdown-menu' behavior to see this event and
// close the dropdown, but don't want to follow the link.
e.prevent();
var column_phid = e.getNodeData('column-add-task').columnPHID;
var request_data = {
responseType: 'card',