Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14037326
D14848.id35884.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14848.id35884.diff
View Options
diff --git a/src/applications/phame/controller/PhameHomeController.php b/src/applications/phame/controller/PhameHomeController.php
--- a/src/applications/phame/controller/PhameHomeController.php
+++ b/src/applications/phame/controller/PhameHomeController.php
@@ -15,16 +15,37 @@
->needProfileImage(true)
->execute();
- $blog_phids = mpull($blogs, 'getPHID');
+ $post_list = null;
+ if ($blogs) {
+ $blog_phids = mpull($blogs, 'getPHID');
- $pager = id(new AphrontCursorPagerView())
- ->readFromRequest($request);
+ $pager = id(new AphrontCursorPagerView())
+ ->readFromRequest($request);
- $posts = id(new PhamePostQuery())
- ->setViewer($viewer)
- ->withBlogPHIDs($blog_phids)
- ->withVisibility(PhameConstants::VISIBILITY_PUBLISHED)
- ->executeWithCursorPager($pager);
+ $posts = id(new PhamePostQuery())
+ ->setViewer($viewer)
+ ->withBlogPHIDs($blog_phids)
+ ->withVisibility(PhameConstants::VISIBILITY_PUBLISHED)
+ ->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);
$action_button = id(new PHUIButtonView())
@@ -41,12 +62,6 @@
->setHeader($title)
->addActionLink($action_button);
- $post_list = id(new PhamePostListView())
- ->setPosts($posts)
- ->setViewer($viewer)
- ->showBlog(true)
- ->setNodata(pht('No Recent Visible Posts.'));
-
$crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true);
$crumbs->addTextCrumb(
diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php
--- a/src/applications/phame/controller/blog/PhameBlogViewController.php
+++ b/src/applications/phame/controller/blog/PhameBlogViewController.php
@@ -57,12 +57,35 @@
$header->setPolicyObject($blog);
}
- $post_list = id(new PhamePostListView())
- ->setPosts($posts)
- ->setViewer($viewer)
- ->setIsExternal($is_external)
- ->setIsLive($is_live)
- ->setNodata(pht('This blog has no visible posts.'));
+ if ($posts) {
+ $post_list = id(new PhamePostListView())
+ ->setPosts($posts)
+ ->setViewer($viewer)
+ ->setIsExternal($is_external)
+ ->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())
->setHeader($header)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 11, 3:12 PM (1 w, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6740598
Default Alt Text
D14848.id35884.diff (3 KB)
Attached To
Mode
D14848: Add some more consistant NUX to Phame
Attached
Detach File
Event Timeline
Log In to Comment