Page MenuHomePhabricator

D9726.id23357.diff
No OneTemporary

D9726.id23357.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -411,7 +411,7 @@
'rsrc/js/application/policy/behavior-policy-control.js' => 'f3fef818',
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '92918fcb',
'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-create.js' => '065227cc',
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
@@ -553,7 +553,7 @@
'javelin-behavior-audio-source' => '59b251eb',
'javelin-behavior-audit-preview' => 'd835b03a',
'javelin-behavior-balanced-payment-form' => '3b3e1664',
- 'javelin-behavior-boards-filter' => '8be7c2f0',
+ 'javelin-behavior-boards-dropdown' => '0ec56e1d',
'javelin-behavior-config-reorder-fields' => '14a827de',
'javelin-behavior-conpherence-menu' => 'f0a41b9f',
'javelin-behavior-conpherence-pontificate' => '85ab3c8e',
@@ -918,6 +918,13 @@
3 => 'javelin-util',
4 => 'phabricator-notification-css',
),
+ '0ec56e1d' =>
+ array(
+ 0 => 'javelin-behavior',
+ 1 => 'javelin-dom',
+ 2 => 'javelin-stratcom',
+ 3 => 'phuix-dropdown-menu',
+ ),
'0f764c35' =>
array(
0 => 'javelin-install',
@@ -1515,13 +1522,6 @@
0 => 'javelin-magical-init',
1 => 'javelin-util',
),
- '8be7c2f0' =>
- array(
- 0 => 'javelin-behavior',
- 1 => 'javelin-dom',
- 2 => 'javelin-stratcom',
- 3 => 'phuix-dropdown-menu',
- ),
'8d199d97' =>
array(
0 => 'javelin-behavior',
diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
@@ -217,26 +217,54 @@
$board->addPanel($panel);
}
- $can_edit = PhabricatorPolicyFilter::hasCapability(
+ Javelin::initBehavior(
+ 'boards-dropdown',
+ array());
+
+ $filter_menu = $this->buildFilterMenu(
$viewer,
- $project,
- PhabricatorPolicyCapability::CAN_EDIT);
+ $custom_query,
+ $engine,
+ $query_key);
- $add_icon = id(new PHUIIconView())
- ->setIconFont('fa-plus bluegrey');
+ $manage_menu = $this->buildManageMenu($project, $show_hidden);
- $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);
+ $header_link = phutil_tag(
+ 'a',
+ array(
+ 'href' => $this->getApplicationURI('view/'.$project->getID().'/')
+ ),
+ $project->getName());
- Javelin::initBehavior(
- 'boards-filter',
+ $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())
->setIconFont('fa-search-plus bluegrey');
@@ -300,62 +328,73 @@
->setIcon($filter_icon)
->setTag('a')
->setHref('#')
- ->addSigil('boards-filter-menu')
+ ->addSigil('boards-dropdown-menu')
->setMetadata(
array(
'items' => hsprintf('%s', $filter_menu),
));
- $header_link = phutil_tag(
- 'a',
- array(
- 'href' => $this->getApplicationURI('view/'.$project->getID().'/')
- ),
- $project->getName());
+ return $filter_button;
+ }
+
+ private function buildManageMenu(
+ PhabricatorProject $project,
+ $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) {
$hidden_uri = $request->getRequestURI()
->setQueryParam('hidden', null);
- $hidden_icon = id(new PHUIIconView())
- ->setIconFont('fa-eye-slash bluegrey');
+ $hidden_icon = 'fa-eye-slash';
$hidden_text = pht('Hide Hidden Columns');
} else {
$hidden_uri = $request->getRequestURI()
->setQueryParam('hidden', 'true');
- $hidden_icon = id(new PHUIIconView())
- ->setIconFont('fa-eye bluegrey');
+ $hidden_icon = 'fa-eye';
$hidden_text = pht('Show Hidden Columns');
}
- $hidden_button = id(new PHUIButtonView())
- ->setText($hidden_text)
+ $manage_items[] = id(new PhabricatorActionView())
->setIcon($hidden_icon)
- ->setTag('a')
+ ->setName($hidden_text)
->setHref($hidden_uri);
- $header = id(new PHUIHeaderView())
- ->setHeader($header_link)
- ->setUser($viewer)
- ->setNoBackground(true)
- ->setImage($project->getProfileImageURI())
- ->setImageURL($this->getApplicationURI('view/'.$project->getID().'/'))
- ->addActionLink($hidden_button)
- ->addActionLink($filter_button)
- ->addActionLink($add_button)
- ->setPolicyObject($project);
+ $manage_menu = id(new PhabricatorActionListView())
+ ->setUser($viewer);
+ foreach ($manage_items as $item) {
+ $manage_menu->addAction($item);
+ }
- $board_box = id(new PHUIBoxView())
- ->appendChild($board)
- ->addClass('project-board-wrapper');
+ $manage_button = id(new PHUIButtonView())
+ ->setText(pht('Manage Board'))
+ ->setIcon($manage_icon)
+ ->setTag('a')
+ ->setHref('#')
+ ->addSigil('boards-dropdown-menu')
+ ->setMetadata(
+ array(
+ 'items' => hsprintf('%s', $manage_menu),
+ ));
- return $this->buildApplicationPage(
- array(
- $header,
- $board_box,
- ),
- array(
- 'title' => pht('%s Board', $project->getName()),
- ));
+ return $manage_button;
}
+
}
diff --git a/webroot/rsrc/js/application/projects/behavior-boards-filter.js b/webroot/rsrc/js/application/projects/behavior-boards-dropdown.js
rename from webroot/rsrc/js/application/projects/behavior-boards-filter.js
rename to webroot/rsrc/js/application/projects/behavior-boards-dropdown.js
--- a/webroot/rsrc/js/application/projects/behavior-boards-filter.js
+++ b/webroot/rsrc/js/application/projects/behavior-boards-dropdown.js
@@ -1,15 +1,15 @@
/**
- * @provides javelin-behavior-boards-filter
+ * @provides javelin-behavior-boards-dropdown
* @requires javelin-behavior
* javelin-dom
* javelin-stratcom
* phuix-dropdown-menu
*/
-JX.behavior('boards-filter', function() {
+JX.behavior('boards-dropdown', function() {
- JX.Stratcom.listen('click', 'boards-filter-menu', function(e) {
- var data = e.getNodeData('boards-filter-menu');
+ JX.Stratcom.listen('click', 'boards-dropdown-menu', function(e) {
+ var data = e.getNodeData('boards-dropdown-menu');
if (data.menu) {
return;
}
@@ -18,7 +18,7 @@
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.setContent(list);
data.menu.open();

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 27, 12:11 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7626352
Default Alt Text
D9726.id23357.diff (8 KB)

Event Timeline