1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +01:00

Always show a menu on durable column

Summary: If you don't have any rooms, we currently show no menu and users have no logical means of closing the column. This lets "Hide Column" at least still appear. Fixes T9195

Test Plan: Fresh install, hit {key \}, see menu. Close Column.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9195

Differential Revision: https://secure.phabricator.com/D16516
This commit is contained in:
Chad Little 2016-09-07 14:23:07 -07:00
parent 138efb2b10
commit 5a33a6743e
3 changed files with 90 additions and 87 deletions

View file

@ -7,7 +7,7 @@
*/
return array(
'names' => array(
'core.pkg.css' => 'f03b9892',
'core.pkg.css' => '85a1b79a',
'core.pkg.js' => '1d376fa9',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '3fb7f532',
@ -32,7 +32,7 @@ return array(
'rsrc/css/aphront/typeahead.css' => 'd4f16145',
'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af',
'rsrc/css/application/auth/auth.css' => '0877ed6e',
'rsrc/css/application/base/main-menu-view.css' => 'e862571a',
'rsrc/css/application/base/main-menu-view.css' => 'f03e17be',
'rsrc/css/application/base/notification-menu.css' => 'b3ab500d',
'rsrc/css/application/base/phabricator-application-launch-view.css' => '95351601',
'rsrc/css/application/base/phui-theme.css' => '027ba77e',
@ -784,7 +784,7 @@ return array(
'phabricator-flag-css' => '5337623f',
'phabricator-keyboard-shortcut' => '1ae869f2',
'phabricator-keyboard-shortcut-manager' => '4a021c10',
'phabricator-main-menu-view' => 'e862571a',
'phabricator-main-menu-view' => 'f03e17be',
'phabricator-nav-view-css' => 'b29426e9',
'phabricator-notification' => 'ccf1cbf8',
'phabricator-notification-css' => '3f6c89c9',
@ -2094,9 +2094,6 @@ return array(
'e6e25838' => array(
'javelin-install',
),
'e862571a' => array(
'phui-theme-css',
),
'e9581f08' => array(
'javelin-behavior',
'javelin-stratcom',
@ -2132,6 +2129,9 @@ return array(
'javelin-workflow',
'javelin-json',
),
'f03e17be' => array(
'phui-theme-css',
),
'f411b6ae' => array(
'javelin-behavior',
'javelin-stratcom',

View file

@ -141,12 +141,16 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
'class' => implode(' ', $classes),
),
$this->buildHeader());
$icon_bar = phutil_tag(
'div',
array(
'class' => 'conpherence-durable-column-icon-bar',
),
$this->buildIconBar());
$icon_bar = null;
if ($this->conpherences) {
$icon_bar = phutil_tag(
'div',
array(
'class' => 'conpherence-durable-column-icon-bar',
),
$this->buildIconBar());
}
$transactions = $this->buildTransactions();
@ -283,66 +287,60 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
private function buildHeader() {
$conpherence = $this->getSelectedConpherence();
if (!$conpherence) {
$bubble_id = celerity_generate_unique_node_id();
$dropdown_id = celerity_generate_unique_node_id();
$header = null;
$settings_button = null;
$settings_menu = null;
$settings_list = new PHUIListView();
$header_actions = $this->getHeaderActionsConfig($conpherence);
foreach ($header_actions as $action) {
$settings_list->addMenuItem(
id(new PHUIListItemView())
->setHref($action['href'])
->setName($action['name'])
->setIcon($action['icon'])
->setDisabled($action['disabled'])
->addSigil('conpherence-durable-column-header-action')
->setMetadata(array(
'action' => $action['key'],
)));
}
} else {
$settings_menu = phutil_tag(
'div',
array(
'id' => $dropdown_id,
'class' => 'phabricator-main-menu-dropdown phui-list-sidenav '.
'conpherence-settings-dropdown',
'sigil' => 'phabricator-notification-menu',
'style' => 'display: none',
),
$settings_list);
$bubble_id = celerity_generate_unique_node_id();
$dropdown_id = celerity_generate_unique_node_id();
Javelin::initBehavior(
'aphlict-dropdown',
array(
'bubbleID' => $bubble_id,
'dropdownID' => $dropdown_id,
'local' => true,
'containerDivID' => 'conpherence-durable-column',
));
$settings_list = new PHUIListView();
$header_actions = $this->getHeaderActionsConfig($conpherence);
foreach ($header_actions as $action) {
$settings_list->addMenuItem(
id(new PHUIListItemView())
->setHref($action['href'])
->setName($action['name'])
->setIcon($action['icon'])
->setDisabled($action['disabled'])
->addSigil('conpherence-durable-column-header-action')
->setMetadata(array(
'action' => $action['key'],
)));
}
$settings_menu = phutil_tag(
'div',
array(
'id' => $dropdown_id,
'class' => 'phabricator-main-menu-dropdown phui-list-sidenav '.
'conpherence-settings-dropdown',
'sigil' => 'phabricator-notification-menu',
'style' => 'display: none',
),
$settings_list);
Javelin::initBehavior(
'aphlict-dropdown',
array(
'bubbleID' => $bubble_id,
'dropdownID' => $dropdown_id,
'local' => true,
'containerDivID' => 'conpherence-durable-column',
));
$item = id(new PHUIListItemView())
->setName(pht('Room Actions'))
->setIcon('fa-bars')
->addClass('core-menu-item')
->addSigil('conpherence-settings-menu')
->setID($bubble_id)
->setHref('#')
->setAural(pht('Room Actions'))
->setOrder(300);
$settings_button = id(new PHUIListView())
->addMenuItem($item)
->addClass('phabricator-dark-menu')
->addClass('phabricator-application-menu');
$item = id(new PHUIListItemView())
->setName(pht('Room Actions'))
->setIcon('fa-bars')
->addClass('core-menu-item')
->addSigil('conpherence-settings-menu')
->setID($bubble_id)
->setHref('#')
->setAural(pht('Room Actions'))
->setOrder(300);
$settings_button = id(new PHUIListView())
->addMenuItem($item)
->addClass('phabricator-dark-menu')
->addClass('phabricator-application-menu');
$header = null;
if ($conpherence) {
$data = $conpherence->getDisplayData($this->getUser());
$header = phutil_tag(
'span',
@ -351,7 +349,7 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
$this->getPolicyIcon($conpherence, $this->getPolicyObjects()),
$data['title'],
));
}
}
return
phutil_tag(
@ -372,42 +370,46 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
));
}
private function getHeaderActionsConfig(ConpherenceThread $conpherence) {
$can_edit = PhabricatorPolicyFilter::hasCapability(
$this->getUser(),
$conpherence,
PhabricatorPolicyCapability::CAN_EDIT);
private function getHeaderActionsConfig($conpherence) {
return array(
array(
$actions = array();
if ($conpherence) {
$can_edit = PhabricatorPolicyFilter::hasCapability(
$this->getUser(),
$conpherence,
PhabricatorPolicyCapability::CAN_EDIT);
$actions[] = array(
'name' => pht('Add Participants'),
'disabled' => !$can_edit,
'href' => '/conpherence/update/'.$conpherence->getID().'/',
'icon' => 'fa-plus',
'key' => ConpherenceUpdateActions::ADD_PERSON,
),
array(
);
$actions[] = array(
'name' => pht('Edit Room'),
'disabled' => !$can_edit,
'href' => '/conpherence/update/'.$conpherence->getID().'/?nopic',
'icon' => 'fa-pencil',
'key' => ConpherenceUpdateActions::METADATA,
),
array(
);
$actions[] = array(
'name' => pht('View in Conpherence'),
'disabled' => false,
'href' => '/'.$conpherence->getMonogram(),
'icon' => 'fa-comments',
'key' => 'go_conpherence',
),
array(
'name' => pht('Hide Column'),
'disabled' => false,
'href' => '#',
'icon' => 'fa-times',
'key' => 'hide_column',
),
);
}
$actions[] = array(
'name' => pht('Hide Column'),
'disabled' => false,
'href' => '#',
'icon' => 'fa-times',
'key' => 'hide_column',
);
return $actions;
}
private function buildTransactions() {

View file

@ -598,6 +598,7 @@ button.phabricator-main-menu-search-dropdown .caret:before {
.phabricator-main-menu-dropdown.phui-list-sidenav .phui-list-item-has-icon
.phui-list-item-href {
padding: 4px 40px 4px 12px;
white-space: nowrap;
}
.phabricator-main-menu-dropdown.phui-list-sidenav .phui-list-item-type-label