mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Move general workboard actions to "Manage Board" dropdown
Summary: See D9719. Test Plan: - Used hide/show columns. - Used "add column". - Filtered board. {F170133} Reviewers: chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D9726
This commit is contained in:
parent
f1c638d231
commit
60157ed40d
3 changed files with 105 additions and 66 deletions
|
@ -411,7 +411,7 @@ return array(
|
||||||
'rsrc/js/application/policy/behavior-policy-control.js' => 'f3fef818',
|
'rsrc/js/application/policy/behavior-policy-control.js' => 'f3fef818',
|
||||||
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '92918fcb',
|
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '92918fcb',
|
||||||
'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b',
|
'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b',
|
||||||
'rsrc/js/application/projects/behavior-boards-filter.js' => '8be7c2f0',
|
'rsrc/js/application/projects/behavior-boards-dropdown.js' => '0ec56e1d',
|
||||||
'rsrc/js/application/projects/behavior-project-boards.js' => '1cb113dc',
|
'rsrc/js/application/projects/behavior-project-boards.js' => '1cb113dc',
|
||||||
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
|
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
|
||||||
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
|
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
|
||||||
|
@ -553,7 +553,7 @@ return array(
|
||||||
'javelin-behavior-audio-source' => '59b251eb',
|
'javelin-behavior-audio-source' => '59b251eb',
|
||||||
'javelin-behavior-audit-preview' => 'd835b03a',
|
'javelin-behavior-audit-preview' => 'd835b03a',
|
||||||
'javelin-behavior-balanced-payment-form' => '3b3e1664',
|
'javelin-behavior-balanced-payment-form' => '3b3e1664',
|
||||||
'javelin-behavior-boards-filter' => '8be7c2f0',
|
'javelin-behavior-boards-dropdown' => '0ec56e1d',
|
||||||
'javelin-behavior-config-reorder-fields' => '14a827de',
|
'javelin-behavior-config-reorder-fields' => '14a827de',
|
||||||
'javelin-behavior-conpherence-menu' => 'f0a41b9f',
|
'javelin-behavior-conpherence-menu' => 'f0a41b9f',
|
||||||
'javelin-behavior-conpherence-pontificate' => '85ab3c8e',
|
'javelin-behavior-conpherence-pontificate' => '85ab3c8e',
|
||||||
|
@ -918,6 +918,13 @@ return array(
|
||||||
3 => 'javelin-util',
|
3 => 'javelin-util',
|
||||||
4 => 'phabricator-notification-css',
|
4 => 'phabricator-notification-css',
|
||||||
),
|
),
|
||||||
|
'0ec56e1d' =>
|
||||||
|
array(
|
||||||
|
0 => 'javelin-behavior',
|
||||||
|
1 => 'javelin-dom',
|
||||||
|
2 => 'javelin-stratcom',
|
||||||
|
3 => 'phuix-dropdown-menu',
|
||||||
|
),
|
||||||
'0f764c35' =>
|
'0f764c35' =>
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-install',
|
0 => 'javelin-install',
|
||||||
|
@ -1515,13 +1522,6 @@ return array(
|
||||||
0 => 'javelin-magical-init',
|
0 => 'javelin-magical-init',
|
||||||
1 => 'javelin-util',
|
1 => 'javelin-util',
|
||||||
),
|
),
|
||||||
'8be7c2f0' =>
|
|
||||||
array(
|
|
||||||
0 => 'javelin-behavior',
|
|
||||||
1 => 'javelin-dom',
|
|
||||||
2 => 'javelin-stratcom',
|
|
||||||
3 => 'phuix-dropdown-menu',
|
|
||||||
),
|
|
||||||
'8d199d97' =>
|
'8d199d97' =>
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-behavior',
|
0 => 'javelin-behavior',
|
||||||
|
|
|
@ -217,26 +217,54 @@ final class PhabricatorProjectBoardViewController
|
||||||
$board->addPanel($panel);
|
$board->addPanel($panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
||||||
$viewer,
|
|
||||||
$project,
|
|
||||||
PhabricatorPolicyCapability::CAN_EDIT);
|
|
||||||
|
|
||||||
$add_icon = id(new PHUIIconView())
|
|
||||||
->setIconFont('fa-plus bluegrey');
|
|
||||||
|
|
||||||
$add_button = id(new PHUIButtonView())
|
|
||||||
->setText(pht('Add Column'))
|
|
||||||
->setIcon($add_icon)
|
|
||||||
->setTag('a')
|
|
||||||
->setHref($this->getApplicationURI('board/'.$this->id.'/edit/'))
|
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(!$can_edit);
|
|
||||||
|
|
||||||
Javelin::initBehavior(
|
Javelin::initBehavior(
|
||||||
'boards-filter',
|
'boards-dropdown',
|
||||||
|
array());
|
||||||
|
|
||||||
|
$filter_menu = $this->buildFilterMenu(
|
||||||
|
$viewer,
|
||||||
|
$custom_query,
|
||||||
|
$engine,
|
||||||
|
$query_key);
|
||||||
|
|
||||||
|
$manage_menu = $this->buildManageMenu($project, $show_hidden);
|
||||||
|
|
||||||
|
$header_link = phutil_tag(
|
||||||
|
'a',
|
||||||
array(
|
array(
|
||||||
|
'href' => $this->getApplicationURI('view/'.$project->getID().'/')
|
||||||
|
),
|
||||||
|
$project->getName());
|
||||||
|
|
||||||
|
$header = id(new PHUIHeaderView())
|
||||||
|
->setHeader($header_link)
|
||||||
|
->setUser($viewer)
|
||||||
|
->setNoBackground(true)
|
||||||
|
->setImage($project->getProfileImageURI())
|
||||||
|
->setImageURL($this->getApplicationURI('view/'.$project->getID().'/'))
|
||||||
|
->addActionLink($filter_menu)
|
||||||
|
->addActionLink($manage_menu)
|
||||||
|
->setPolicyObject($project);
|
||||||
|
|
||||||
|
$board_box = id(new PHUIBoxView())
|
||||||
|
->appendChild($board)
|
||||||
|
->addClass('project-board-wrapper');
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
|
array(
|
||||||
|
$header,
|
||||||
|
$board_box,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'title' => pht('%s Board', $project->getName()),
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildFilterMenu(
|
||||||
|
PhabricatorUser $viewer,
|
||||||
|
$custom_query,
|
||||||
|
PhabricatorApplicationSearchEngine $engine,
|
||||||
|
$query_key) {
|
||||||
|
|
||||||
$filter_icon = id(new PHUIIconView())
|
$filter_icon = id(new PHUIIconView())
|
||||||
->setIconFont('fa-search-plus bluegrey');
|
->setIconFont('fa-search-plus bluegrey');
|
||||||
|
@ -300,62 +328,73 @@ final class PhabricatorProjectBoardViewController
|
||||||
->setIcon($filter_icon)
|
->setIcon($filter_icon)
|
||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setHref('#')
|
->setHref('#')
|
||||||
->addSigil('boards-filter-menu')
|
->addSigil('boards-dropdown-menu')
|
||||||
->setMetadata(
|
->setMetadata(
|
||||||
array(
|
array(
|
||||||
'items' => hsprintf('%s', $filter_menu),
|
'items' => hsprintf('%s', $filter_menu),
|
||||||
));
|
));
|
||||||
|
|
||||||
$header_link = phutil_tag(
|
return $filter_button;
|
||||||
'a',
|
}
|
||||||
array(
|
|
||||||
'href' => $this->getApplicationURI('view/'.$project->getID().'/')
|
private function buildManageMenu(
|
||||||
),
|
PhabricatorProject $project,
|
||||||
$project->getName());
|
$show_hidden) {
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$viewer = $request->getUser();
|
||||||
|
|
||||||
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$viewer,
|
||||||
|
$project,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
|
$manage_icon = id(new PHUIIconView())
|
||||||
|
->setIconFont('fa-cog bluegrey');
|
||||||
|
|
||||||
|
$manage_items = array();
|
||||||
|
|
||||||
|
$manage_items[] = id(new PhabricatorActionView())
|
||||||
|
->setIcon('fa-plus')
|
||||||
|
->setName(pht('Add Column'))
|
||||||
|
->setHref($this->getApplicationURI('board/'.$this->id.'/edit/'));
|
||||||
|
|
||||||
if ($show_hidden) {
|
if ($show_hidden) {
|
||||||
$hidden_uri = $request->getRequestURI()
|
$hidden_uri = $request->getRequestURI()
|
||||||
->setQueryParam('hidden', null);
|
->setQueryParam('hidden', null);
|
||||||
$hidden_icon = id(new PHUIIconView())
|
$hidden_icon = 'fa-eye-slash';
|
||||||
->setIconFont('fa-eye-slash bluegrey');
|
|
||||||
$hidden_text = pht('Hide Hidden Columns');
|
$hidden_text = pht('Hide Hidden Columns');
|
||||||
} else {
|
} else {
|
||||||
$hidden_uri = $request->getRequestURI()
|
$hidden_uri = $request->getRequestURI()
|
||||||
->setQueryParam('hidden', 'true');
|
->setQueryParam('hidden', 'true');
|
||||||
$hidden_icon = id(new PHUIIconView())
|
$hidden_icon = 'fa-eye';
|
||||||
->setIconFont('fa-eye bluegrey');
|
|
||||||
$hidden_text = pht('Show Hidden Columns');
|
$hidden_text = pht('Show Hidden Columns');
|
||||||
}
|
}
|
||||||
|
|
||||||
$hidden_button = id(new PHUIButtonView())
|
$manage_items[] = id(new PhabricatorActionView())
|
||||||
->setText($hidden_text)
|
|
||||||
->setIcon($hidden_icon)
|
->setIcon($hidden_icon)
|
||||||
->setTag('a')
|
->setName($hidden_text)
|
||||||
->setHref($hidden_uri);
|
->setHref($hidden_uri);
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$manage_menu = id(new PhabricatorActionListView())
|
||||||
->setHeader($header_link)
|
->setUser($viewer);
|
||||||
->setUser($viewer)
|
foreach ($manage_items as $item) {
|
||||||
->setNoBackground(true)
|
$manage_menu->addAction($item);
|
||||||
->setImage($project->getProfileImageURI())
|
}
|
||||||
->setImageURL($this->getApplicationURI('view/'.$project->getID().'/'))
|
|
||||||
->addActionLink($hidden_button)
|
|
||||||
->addActionLink($filter_button)
|
|
||||||
->addActionLink($add_button)
|
|
||||||
->setPolicyObject($project);
|
|
||||||
|
|
||||||
$board_box = id(new PHUIBoxView())
|
$manage_button = id(new PHUIButtonView())
|
||||||
->appendChild($board)
|
->setText(pht('Manage Board'))
|
||||||
->addClass('project-board-wrapper');
|
->setIcon($manage_icon)
|
||||||
|
->setTag('a')
|
||||||
|
->setHref('#')
|
||||||
|
->addSigil('boards-dropdown-menu')
|
||||||
|
->setMetadata(
|
||||||
|
array(
|
||||||
|
'items' => hsprintf('%s', $manage_menu),
|
||||||
|
));
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
return $manage_button;
|
||||||
array(
|
|
||||||
$header,
|
|
||||||
$board_box,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'title' => pht('%s Board', $project->getName()),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
/**
|
/**
|
||||||
* @provides javelin-behavior-boards-filter
|
* @provides javelin-behavior-boards-dropdown
|
||||||
* @requires javelin-behavior
|
* @requires javelin-behavior
|
||||||
* javelin-dom
|
* javelin-dom
|
||||||
* javelin-stratcom
|
* javelin-stratcom
|
||||||
* phuix-dropdown-menu
|
* phuix-dropdown-menu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JX.behavior('boards-filter', function() {
|
JX.behavior('boards-dropdown', function() {
|
||||||
|
|
||||||
JX.Stratcom.listen('click', 'boards-filter-menu', function(e) {
|
JX.Stratcom.listen('click', 'boards-dropdown-menu', function(e) {
|
||||||
var data = e.getNodeData('boards-filter-menu');
|
var data = e.getNodeData('boards-dropdown-menu');
|
||||||
if (data.menu) {
|
if (data.menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ JX.behavior('boards-filter', function() {
|
||||||
|
|
||||||
var list = JX.$H(data.items).getFragment().firstChild;
|
var list = JX.$H(data.items).getFragment().firstChild;
|
||||||
|
|
||||||
var button = e.getNode('boards-filter-menu');
|
var button = e.getNode('boards-dropdown-menu');
|
||||||
data.menu = new JX.PHUIXDropdownMenu(button);
|
data.menu = new JX.PHUIXDropdownMenu(button);
|
||||||
data.menu.setContent(list);
|
data.menu.setContent(list);
|
||||||
data.menu.open();
|
data.menu.open();
|
Loading…
Reference in a new issue