mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Add a noDataString function to FeedBuilder
Summary: Feed currently returns nothing is there are no stories, we can present a better view here by allowing a base and customizable set of errors. Fixes T7383 Test Plan: Test a Project feed with no noDataSting and People with a noDataSting {F321700} {F321701} Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7383 Differential Revision: https://secure.phabricator.com/D11897
This commit is contained in:
parent
e27c1a4868
commit
36b049c7cc
4 changed files with 28 additions and 2 deletions
|
@ -94,7 +94,7 @@ return array(
|
|||
'rsrc/css/application/ponder/feed.css' => 'e62615b6',
|
||||
'rsrc/css/application/ponder/post.css' => 'ebab8a70',
|
||||
'rsrc/css/application/ponder/vote.css' => '8ed6ed8b',
|
||||
'rsrc/css/application/profile/profile-view.css' => 'b4896815',
|
||||
'rsrc/css/application/profile/profile-view.css' => 'd8cb982b',
|
||||
'rsrc/css/application/projects/project-icon.css' => 'c2ecb7f1',
|
||||
'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733',
|
||||
'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5',
|
||||
|
@ -737,7 +737,7 @@ return array(
|
|||
'phabricator-object-selector-css' => '029a133d',
|
||||
'phabricator-phtize' => 'd254d646',
|
||||
'phabricator-prefab' => '72da38cc',
|
||||
'phabricator-profile-css' => 'b4896815',
|
||||
'phabricator-profile-css' => 'd8cb982b',
|
||||
'phabricator-remarkup-css' => 'e8e5a324',
|
||||
'phabricator-search-results-css' => 'f240504c',
|
||||
'phabricator-shaped-request' => '7cbe244b',
|
||||
|
|
|
@ -5,6 +5,7 @@ final class PhabricatorFeedBuilder {
|
|||
private $stories;
|
||||
private $framed;
|
||||
private $hovercards = false;
|
||||
private $noDataString;
|
||||
|
||||
public function __construct(array $stories) {
|
||||
assert_instances_of($stories, 'PhabricatorFeedStory');
|
||||
|
@ -26,6 +27,11 @@ final class PhabricatorFeedBuilder {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setNoDataString($string) {
|
||||
$this->noDataString = $string;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function buildView() {
|
||||
if (!$this->user) {
|
||||
throw new Exception('Call setUser() before buildView()!');
|
||||
|
@ -76,6 +82,20 @@ final class PhabricatorFeedBuilder {
|
|||
$null_view->appendChild($view);
|
||||
}
|
||||
|
||||
if (empty($stories)) {
|
||||
$nodatastring = pht('No Stories.');
|
||||
if ($this->noDataString) {
|
||||
$nodatastring = $this->noDataString;
|
||||
}
|
||||
|
||||
$view = id(new PHUIErrorView())
|
||||
->setSeverity(PHUIErrorView::SEVERITY_NODATA)
|
||||
->appendChild($nodatastring);
|
||||
$null_view->appendChild($view);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return id(new AphrontNullView())
|
||||
->appendChild($null_view->render());
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ final class PhabricatorPeopleFeedController
|
|||
$builder = new PhabricatorFeedBuilder($stories);
|
||||
$builder->setUser($viewer);
|
||||
$builder->setShowHovercards(true);
|
||||
$builder->setNoDataString(pht('To begin on such a grand journey, '.
|
||||
'requires but just a single step.'));
|
||||
$view = $builder->buildView();
|
||||
|
||||
$feed = phutil_tag_div(
|
||||
|
|
|
@ -48,6 +48,10 @@
|
|||
max-width: 640px;
|
||||
}
|
||||
|
||||
.phabricator-project-feed .phui-error-view {
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.device-phone .phabricator-project-feed {
|
||||
padding: 0 12px;
|
||||
width: auto;
|
||||
|
|
Loading…
Reference in a new issue