1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-31 08:58:20 +01:00

Add some more consistant NUX to Phame

Summary: Adds a no visible blogs and no posts nux state using new UI. Ref T10032

Test Plan: Archived all my blogs, got no posts fallback. Test a New Blog, got create a post, logged out, saw no create button.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T10032

Differential Revision: https://secure.phabricator.com/D14848
This commit is contained in:
Chad Little 2015-12-21 14:12:36 -08:00
parent 426d648681
commit 5c8025c41d
2 changed files with 58 additions and 20 deletions

View file

@ -15,16 +15,37 @@ final class PhameHomeController extends PhamePostController {
->needProfileImage(true) ->needProfileImage(true)
->execute(); ->execute();
$blog_phids = mpull($blogs, 'getPHID'); $post_list = null;
if ($blogs) {
$blog_phids = mpull($blogs, 'getPHID');
$pager = id(new AphrontCursorPagerView()) $pager = id(new AphrontCursorPagerView())
->readFromRequest($request); ->readFromRequest($request);
$posts = id(new PhamePostQuery()) $posts = id(new PhamePostQuery())
->setViewer($viewer) ->setViewer($viewer)
->withBlogPHIDs($blog_phids) ->withBlogPHIDs($blog_phids)
->withVisibility(PhameConstants::VISIBILITY_PUBLISHED) ->withVisibility(PhameConstants::VISIBILITY_PUBLISHED)
->executeWithCursorPager($pager); ->executeWithCursorPager($pager);
$post_list = id(new PhamePostListView())
->setPosts($posts)
->setViewer($viewer)
->showBlog(true);
} else {
$create_button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('Create a Blog'))
->setHref('/phame/blog/new/')
->setColor(PHUIButtonView::GREEN);
$post_list = id(new PHUIBigInfoView())
->setIcon('fa-star')
->setTitle('Welcome to Phame')
->setDescription(
pht('There aren\'t any visible Blog Posts.'))
->addAction($create_button);
}
$actions = $this->renderActions($viewer); $actions = $this->renderActions($viewer);
$action_button = id(new PHUIButtonView()) $action_button = id(new PHUIButtonView())
@ -41,12 +62,6 @@ final class PhameHomeController extends PhamePostController {
->setHeader($title) ->setHeader($title)
->addActionLink($action_button); ->addActionLink($action_button);
$post_list = id(new PhamePostListView())
->setPosts($posts)
->setViewer($viewer)
->showBlog(true)
->setNodata(pht('No Recent Visible Posts.'));
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true); $crumbs->setBorder(true);
$crumbs->addTextCrumb( $crumbs->addTextCrumb(

View file

@ -57,12 +57,35 @@ final class PhameBlogViewController extends PhameLiveController {
$header->setPolicyObject($blog); $header->setPolicyObject($blog);
} }
$post_list = id(new PhamePostListView()) if ($posts) {
->setPosts($posts) $post_list = id(new PhamePostListView())
->setViewer($viewer) ->setPosts($posts)
->setIsExternal($is_external) ->setViewer($viewer)
->setIsLive($is_live) ->setIsExternal($is_external)
->setNodata(pht('This blog has no visible posts.')); ->setIsLive($is_live)
->setNodata(pht('This blog has no visible posts.'));
} else {
$create_button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('Write a Post'))
->setHref($this->getApplicationURI('post/edit/?blog='.$blog->getID()))
->setColor(PHUIButtonView::GREEN);
$post_list = id(new PHUIBigInfoView())
->setIcon('fa-star')
->setTitle($blog->getName())
->setDescription(
pht('No one has written any blog posts yet.'));
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$blog,
PhabricatorPolicyCapability::CAN_EDIT);
if ($can_edit) {
$post_list->addAction($create_button);
}
}
$page = id(new PHUIDocumentViewPro()) $page = id(new PHUIDocumentViewPro())
->setHeader($header) ->setHeader($header)