mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 13:00:56 +01:00
Don't show Conpherence controls if not in a Conpherence
Summary: We currently try to build crumbs out even if the user has no membership in any. This removes these useless controls. Test Plan: Leave all Rooms, see NUX state with no "Edit Room", blank title, or "Collapse Column" controls. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D16546
This commit is contained in:
parent
2588b4fac0
commit
5d8b5c0ee3
1 changed files with 40 additions and 38 deletions
|
@ -59,47 +59,49 @@ abstract class ConpherenceController extends PhabricatorController {
|
|||
$viewer = $this->getViewer();
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$data = $conpherence->getDisplayData($this->getViewer());
|
||||
$crumbs->addCrumb(
|
||||
id(new PHUICrumbView())
|
||||
->setName($data['title'])
|
||||
->setHref('/'.$conpherence->getMonogram()));
|
||||
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$conpherence,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
if ($conpherence->getID()) {
|
||||
$data = $conpherence->getDisplayData($this->getViewer());
|
||||
$crumbs->addCrumb(
|
||||
id(new PHUICrumbView())
|
||||
->setName($data['title'])
|
||||
->setHref('/'.$conpherence->getMonogram()));
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$conpherence,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
|
||||
$crumbs
|
||||
->addAction(
|
||||
$crumbs
|
||||
->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setName(pht('Edit Room'))
|
||||
->setHref(
|
||||
$this->getApplicationURI('update/'.$conpherence->getID()).'/')
|
||||
->setIcon('fa-pencil')
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(true));
|
||||
|
||||
$widget_key = PhabricatorConpherenceWidgetVisibleSetting::SETTINGKEY;
|
||||
$widget_view = (bool)$viewer->getUserSetting($widget_key, false);
|
||||
|
||||
$divider = id(new PHUIListItemView())
|
||||
->setType(PHUIListItemView::TYPE_DIVIDER)
|
||||
->addClass('conpherence-header-desktop-item');
|
||||
$crumbs->addAction($divider);
|
||||
|
||||
Javelin::initBehavior(
|
||||
'toggle-widget',
|
||||
array(
|
||||
'show' => (int)$widget_view,
|
||||
'settingsURI' => '/settings/adjust/?key='.$widget_key,
|
||||
));
|
||||
|
||||
$crumbs->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setName(pht('Edit Room'))
|
||||
->setHref(
|
||||
$this->getApplicationURI('update/'.$conpherence->getID()).'/')
|
||||
->setIcon('fa-pencil')
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(true));
|
||||
|
||||
$widget_key = PhabricatorConpherenceWidgetVisibleSetting::SETTINGKEY;
|
||||
$widget_view = (bool)$viewer->getUserSetting($widget_key, false);
|
||||
|
||||
$divider = id(new PHUIListItemView())
|
||||
->setType(PHUIListItemView::TYPE_DIVIDER)
|
||||
->addClass('conpherence-header-desktop-item');
|
||||
$crumbs->addAction($divider);
|
||||
|
||||
Javelin::initBehavior(
|
||||
'toggle-widget',
|
||||
array(
|
||||
'show' => (int)$widget_view,
|
||||
'settingsURI' => '/settings/adjust/?key='.$widget_key,
|
||||
));
|
||||
|
||||
$crumbs->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->addSigil('conpherence-widget-toggle')
|
||||
->setIcon('fa-columns')
|
||||
->addClass('conpherence-header-desktop-item'));
|
||||
->addSigil('conpherence-widget-toggle')
|
||||
->setIcon('fa-columns')
|
||||
->addClass('conpherence-header-desktop-item'));
|
||||
}
|
||||
|
||||
return hsprintf(
|
||||
'%s',
|
||||
|
|
Loading…
Reference in a new issue