@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+30 -19
-19
src/applications/dashboard/controller/panel/PhabricatorDashboardPanelListController.php
··· 48 48 return $crumbs; 49 49 } 50 50 51 - protected function getNewUserBody() { 52 - $create_button = id(new PHUIButtonView()) 53 - ->setTag('a') 54 - ->setText(pht('Create a Panel')) 55 - ->setHref('/dashboard/panel/edit/') 56 - ->setColor(PHUIButtonView::GREEN); 57 - 58 - $icon = $this->getApplication()->getIcon(); 59 - $app_name = $this->getApplication()->getName(); 60 - $view = id(new PHUIBigInfoView()) 61 - ->setIcon($icon) 62 - ->setTitle(pht('Welcome to %s', $app_name)) 63 - ->setDescription( 64 - pht('Build individual panels to display on your homepage dashboard.')) 65 - ->addAction($create_button); 66 - 67 - return $view; 68 - } 69 - 70 51 }
+18
src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php
··· 147 147 return $result; 148 148 } 149 149 150 + protected function getNewUserBody() { 151 + $create_button = id(new PHUIButtonView()) 152 + ->setTag('a') 153 + ->setText(pht('Create a Panel')) 154 + ->setHref('/dashboard/panel/edit/') 155 + ->setColor(PHUIButtonView::GREEN); 156 + 157 + $app_name = pht('Panels'); 158 + $view = id(new PHUIBigInfoView()) 159 + ->setIcon('fa-line-chart') 160 + ->setTitle(pht('Welcome to %s', $app_name)) 161 + ->setDescription( 162 + pht('Build individual panels to display on your homepage dashboard.')) 163 + ->addAction($create_button); 164 + 165 + return $view; 166 + } 167 + 150 168 }
+12
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 1454 1454 return $attachments; 1455 1455 } 1456 1456 1457 + /** 1458 + * Render a content body (if available) to onboard new users. 1459 + * This body is usually visible when you have no elements in a list, 1460 + * or when you force the rendering on a list with the `?nux=1` URL. 1461 + * @return wild|PhutilSafeHTML|null 1462 + */ 1457 1463 final public function renderNewUserView() { 1458 1464 $body = $this->getNewUserBody(); 1459 1465 ··· 1464 1470 return $body; 1465 1471 } 1466 1472 1473 + /** 1474 + * Get a content body to onboard new users. 1475 + * Traditionally this content is shown from an empty list, to explain 1476 + * what a certain entity does, and how to create a new one. 1477 + * @return wild|PhutilSafeHTML|null 1478 + */ 1467 1479 protected function getNewUserHeader() { 1468 1480 return null; 1469 1481 }