mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-31 06:28:13 +02:00
Summary: Ref T10054. - Just let users delete non-builtin items. - Let users choose a default item explicitly. - Do a better job of cleaning up items which no longer exist or belong to uninstalled applications. (NOTE) This has one user-facing change: workboards are no longer the default on projects with workboards. I think this is probably OK since we're giving users a ton of new toys at the same time, but I'll write some docs at least. Test Plan: - Deleted custom items. - Disabled/enabled builtin items. - Made various things defaults. - Uninstalled Maniphest, saw Workboards tab disappear entirely. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10054 Differential Revision: https://secure.phabricator.com/D15089
79 lines
1.8 KiB
PHP
79 lines
1.8 KiB
PHP
<?php
|
|
|
|
final class PhabricatorProjectWorkboardProfilePanel
|
|
extends PhabricatorProfilePanel {
|
|
|
|
const PANELKEY = 'project.workboard';
|
|
|
|
public function getPanelTypeName() {
|
|
return pht('Project Workboard');
|
|
}
|
|
|
|
private function getDefaultName() {
|
|
return pht('Workboard');
|
|
}
|
|
|
|
public function canMakeDefault(
|
|
PhabricatorProfilePanelConfiguration $config) {
|
|
return true;
|
|
}
|
|
|
|
public function getDisplayName(
|
|
PhabricatorProfilePanelConfiguration $config) {
|
|
$name = $config->getPanelProperty('name');
|
|
|
|
if (strlen($name)) {
|
|
return $name;
|
|
}
|
|
|
|
return $this->getDefaultName();
|
|
}
|
|
|
|
public function buildEditEngineFields(
|
|
PhabricatorProfilePanelConfiguration $config) {
|
|
return array(
|
|
id(new PhabricatorTextEditField())
|
|
->setKey('name')
|
|
->setLabel(pht('Name'))
|
|
->setPlaceholder($this->getDefaultName())
|
|
->setValue($config->getPanelProperty('name')),
|
|
);
|
|
}
|
|
|
|
protected function newNavigationMenuItems(
|
|
PhabricatorProfilePanelConfiguration $config) {
|
|
$viewer = $this->getViewer();
|
|
|
|
// Workboards are only available if Maniphest is installed.
|
|
$class = 'PhabricatorManiphestApplication';
|
|
if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
|
|
return array();
|
|
}
|
|
|
|
$project = $config->getProfileObject();
|
|
|
|
$columns = id(new PhabricatorProjectColumnQuery())
|
|
->setViewer($viewer)
|
|
->withProjectPHIDs(array($project->getPHID()))
|
|
->execute();
|
|
if ($columns) {
|
|
$icon = 'fa-columns';
|
|
} else {
|
|
$icon = 'fa-columns grey';
|
|
}
|
|
|
|
$id = $project->getID();
|
|
$href = "/project/board/{$id}/";
|
|
$name = $this->getDisplayName($config);
|
|
|
|
$item = $this->newItem()
|
|
->setHref($href)
|
|
->setName($name)
|
|
->setIcon($icon);
|
|
|
|
return array(
|
|
$item,
|
|
);
|
|
}
|
|
|
|
}
|