mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 21:40:55 +01:00
Panels list: fix missing welcome page
Summary: The method getNewUserBody() was never designed for a list controller. The method was just orphan. Now, instead, it's non-orphan, and it works as expected. This bug was highlighted by Andre Klapper, since their linter was screaming about inconsistences in the current nonsense usage of getNewUserBody(): D25649 The code was just moved from the list controller, to the search engine. - PhabricatorDashboardPanelListController (from) - PhabricatorDashboardPanelSearchEngine (to) Bonus point: Adjusted the icon and the title to talk about "Panels" and not "Dashboards". Added also some inline documentation with an hint about `?nux=1`. So now we can easily remember how to test this kind of things. Closes T15844 Test Plan: In both these pages, you finally see a welcome message, not just in Maniphest: - http://phorge.localhost/dashboard/panel/?nux=1 - http://phorge.localhost/maniphest/?nux=1 In both these pages, if you have no elements, you finally see a welcome message, and not just in Maniphest: - http://phorge.localhost/dashboard/panel/ - http://phorge.localhost/maniphest/ Check that the welcome message helps you in creating a new Panel, and that talks about Panels, and that have the lovely icon of a Panel. Reviewers: aklapper, O1 Blessed Committers Reviewed By: aklapper, O1 Blessed Committers Subscribers: tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15844 Differential Revision: https://we.phorge.it/D25674
This commit is contained in:
parent
40720ab83d
commit
89dcbe125c
3 changed files with 30 additions and 19 deletions
|
@ -48,23 +48,4 @@ final class PhabricatorDashboardPanelListController
|
|||
return $crumbs;
|
||||
}
|
||||
|
||||
protected function getNewUserBody() {
|
||||
$create_button = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setText(pht('Create a Panel'))
|
||||
->setHref('/dashboard/panel/edit/')
|
||||
->setColor(PHUIButtonView::GREEN);
|
||||
|
||||
$icon = $this->getApplication()->getIcon();
|
||||
$app_name = $this->getApplication()->getName();
|
||||
$view = id(new PHUIBigInfoView())
|
||||
->setIcon($icon)
|
||||
->setTitle(pht('Welcome to %s', $app_name))
|
||||
->setDescription(
|
||||
pht('Build individual panels to display on your homepage dashboard.'))
|
||||
->addAction($create_button);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,4 +147,22 @@ final class PhabricatorDashboardPanelSearchEngine
|
|||
return $result;
|
||||
}
|
||||
|
||||
protected function getNewUserBody() {
|
||||
$create_button = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setText(pht('Create a Panel'))
|
||||
->setHref('/dashboard/panel/edit/')
|
||||
->setColor(PHUIButtonView::GREEN);
|
||||
|
||||
$app_name = pht('Panels');
|
||||
$view = id(new PHUIBigInfoView())
|
||||
->setIcon('fa-line-chart')
|
||||
->setTitle(pht('Welcome to %s', $app_name))
|
||||
->setDescription(
|
||||
pht('Build individual panels to display on your homepage dashboard.'))
|
||||
->addAction($create_button);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1454,6 +1454,12 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
|
|||
return $attachments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a content body (if available) to onboard new users.
|
||||
* This body is usually visible when you have no elements in a list,
|
||||
* or when you force the rendering on a list with the `?nux=1` URL.
|
||||
* @return wild|PhutilSafeHTML|null
|
||||
*/
|
||||
final public function renderNewUserView() {
|
||||
$body = $this->getNewUserBody();
|
||||
|
||||
|
@ -1464,6 +1470,12 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
|
|||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a content body to onboard new users.
|
||||
* Traditionally this content is shown from an empty list, to explain
|
||||
* what a certain entity does, and how to create a new one.
|
||||
* @return wild|PhutilSafeHTML|null
|
||||
*/
|
||||
protected function getNewUserHeader() {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue