1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 23:40:57 +01:00

Minor consistency/order updates for menu items which reference other objects

Summary:
See T11957#208140.

  - Let Applications have a custom name, like other object items (for example, so you can call Maniphest "Tasks" if you prefer).
  - Put the optional name field after the required typeahead field for these items.
    - (I left "Link" in "Name, URI" order since both are required, but there's maybe an argument for swapping them?)

Test Plan:
  - Created each type of item, saw "thing, name" order.
  - Created an application with a cusotm name, saw custom name.
  - Removed custom name, saw original name.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D17236
This commit is contained in:
epriestley 2017-01-20 11:42:29 -08:00
parent 8113b76910
commit d24739ee3c
4 changed files with 32 additions and 19 deletions

View file

@ -21,13 +21,17 @@ final class PhabricatorApplicationProfileMenuItem
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$app = $this->getApplication($config);
if ($app) {
return $app->getName();
} else {
return pht('(Uninstalled Application)');
$application = $this->getApplication($config);
if (!$application) {
return pht('(Restricted/Invalid Application)');
}
return $app->getName();
$name = $this->getName($config);
if (strlen($name)) {
return $name;
}
return $application->getName();
}
public function buildEditEngineFields(
@ -40,9 +44,18 @@ final class PhabricatorApplicationProfileMenuItem
->setDatasource(new PhabricatorApplicationDatasource())
->setIsRequired(true)
->setSingleValue($config->getMenuItemProperty('application')),
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setValue($this->getName($config)),
);
}
private function getName(
PhabricatorProfileMenuItemConfiguration $config) {
return $config->getMenuItemProperty('name');
}
private function getApplication(
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
@ -73,7 +86,7 @@ final class PhabricatorApplicationProfileMenuItem
$item = $this->newItem()
->setHref($app->getApplicationURI())
->setName($app->getName())
->setName($this->getDisplayName($config))
->setIcon($app->getIcon());
return array(

View file

@ -72,16 +72,16 @@ final class PhabricatorDashboardProfileMenuItem
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setValue($this->getName($config)),
id(new PhabricatorDatasourceEditField())
->setKey(self::FIELD_DASHBOARD)
->setLabel(pht('Dashboard'))
->setIsRequired(true)
->setDatasource(new PhabricatorDashboardDatasource())
->setSingleValue($config->getMenuItemProperty('dashboardPHID')),
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setValue($this->getName($config)),
);
}

View file

@ -81,16 +81,16 @@ final class PhabricatorEditEngineProfileMenuItem
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setValue($this->getName($config)),
id(new PhabricatorDatasourceEditField())
->setKey(self::FIELD_FORM)
->setLabel(pht('Form'))
->setIsRequired(true)
->setDatasource(new PhabricatorEditEngineDatasource())
->setSingleValue($config->getMenuItemProperty('formKey')),
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setValue($this->getName($config)),
);
}

View file

@ -72,16 +72,16 @@ final class PhabricatorProjectProfileMenuItem
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setValue($this->getName($config)),
id(new PhabricatorDatasourceEditField())
->setKey(self::FIELD_PROJECT)
->setLabel(pht('Project'))
->setIsRequired(true)
->setDatasource(new PhabricatorProjectDatasource())
->setSingleValue($config->getMenuItemProperty('project')),
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setValue($this->getName($config)),
);
}