Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15484761
D14756.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D14756.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3341,6 +3341,7 @@
'PhameCreatePostConduitAPIMethod' => 'applications/phame/conduit/PhameCreatePostConduitAPIMethod.php',
'PhameDAO' => 'applications/phame/storage/PhameDAO.php',
'PhameDescriptionView' => 'applications/phame/view/PhameDescriptionView.php',
+ 'PhameDraftListView' => 'applications/phame/view/PhameDraftListView.php',
'PhameHomeController' => 'applications/phame/controller/PhameHomeController.php',
'PhameLiveController' => 'applications/phame/controller/PhameLiveController.php',
'PhamePost' => 'applications/phame/storage/PhamePost.php',
@@ -7691,6 +7692,7 @@
'PhameCreatePostConduitAPIMethod' => 'PhameConduitAPIMethod',
'PhameDAO' => 'PhabricatorLiskDAO',
'PhameDescriptionView' => 'AphrontTagView',
+ 'PhameDraftListView' => 'AphrontTagView',
'PhameHomeController' => 'PhamePostController',
'PhameLiveController' => 'PhameController',
'PhamePost' => array(
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
@@ -57,15 +57,34 @@
->setHeader($header)
->appendChild($post_list);
- $sidebar = id(new PhameBlogListView())
+ $blog_list = id(new PhameBlogListView())
->setBlogs($blogs)
->setViewer($viewer);
+ $draft_list = null;
+ if ($viewer->isLoggedIn()) {
+ $drafts = id(new PhamePostQuery())
+ ->setViewer($viewer)
+ ->withBloggerPHIDs(array($viewer->getPHID()))
+ ->withBlogPHIDs(mpull($blogs, 'getPHID'))
+ ->withVisibility(PhameConstants::VISIBILITY_DRAFT)
+ ->setLimit(5)
+ ->execute();
+
+ $draft_list = id(new PhameDraftListView())
+ ->setPosts($drafts)
+ ->setBlogs($blogs)
+ ->setViewer($viewer);
+ }
+
$phame_view = id(new PHUITwoColumnView())
->setMainColumn(array(
$page,
))
- ->setSideColumn($sidebar)
+ ->setSideColumn(array(
+ $blog_list,
+ $draft_list,
+ ))
->setDisplay(PHUITwoColumnView::DISPLAY_LEFT)
->addClass('phame-home-view');
diff --git a/src/applications/phame/query/PhamePostQuery.php b/src/applications/phame/query/PhamePostQuery.php
--- a/src/applications/phame/query/PhamePostQuery.php
+++ b/src/applications/phame/query/PhamePostQuery.php
@@ -68,6 +68,7 @@
$blog_phids = mpull($posts, 'getBlogPHID');
$blogs = id(new PhameBlogQuery())
->setViewer($this->getViewer())
+ ->needProfileImage(true)
->withPHIDs($blog_phids)
->execute();
$blogs = mpull($blogs, null, 'getPHID');
diff --git a/src/applications/phame/view/PhameBlogListView.php b/src/applications/phame/view/PhameBlogListView.php
--- a/src/applications/phame/view/PhameBlogListView.php
+++ b/src/applications/phame/view/PhameBlogListView.php
@@ -24,7 +24,6 @@
protected function getTagContent() {
require_celerity_resource('phame-css');
- Javelin::initBehavior('phabricator-tooltips');
$list = array();
foreach ($this->blogs as $blog) {
@@ -54,8 +53,6 @@
array(
'href' => '/phame/post/edit/?blog='.$blog->getID(),
'class' => 'phame-blog-list-new-post',
- 'sigil' => 'has-tooltip',
- 'meta' => array('tip' => pht('New Post')),
),
$icon);
diff --git a/src/applications/phame/view/PhameBlogListView.php b/src/applications/phame/view/PhameDraftListView.php
copy from src/applications/phame/view/PhameBlogListView.php
copy to src/applications/phame/view/PhameDraftListView.php
--- a/src/applications/phame/view/PhameBlogListView.php
+++ b/src/applications/phame/view/PhameDraftListView.php
@@ -1,10 +1,17 @@
<?php
-final class PhameBlogListView extends AphrontTagView {
+final class PhameDraftListView extends AphrontTagView {
+ private $posts;
private $blogs;
private $viewer;
+ public function setPosts($posts) {
+ assert_instances_of($posts, 'PhamePost');
+ $this->posts = $posts;
+ return $this;
+ }
+
public function setBlogs($blogs) {
assert_instances_of($blogs, 'PhameBlog');
$this->blogs = $blogs;
@@ -24,10 +31,10 @@
protected function getTagContent() {
require_celerity_resource('phame-css');
- Javelin::initBehavior('phabricator-tooltips');
$list = array();
- foreach ($this->blogs as $blog) {
+ foreach ($this->posts as $post) {
+ $blog = $post->getBlog();
$image_uri = $blog->getProfileImageURI();
$image = phutil_tag(
'a',
@@ -41,21 +48,19 @@
'a',
array(
'class' => 'phame-blog-list-title',
- 'href' => $blog->getViewURI(),
+ 'href' => $post->getViewURI(),
),
- $blog->getName());
+ $post->getTitle());
$icon = id(new PHUIIconView())
- ->setIconFont('fa-plus-square')
+ ->setIconFont('fa-pencil-square-o')
->addClass('phame-blog-list-icon');
- $add_new = phutil_tag(
+ $edit = phutil_tag(
'a',
array(
- 'href' => '/phame/post/edit/?blog='.$blog->getID(),
+ 'href' => '/phame/post/edit/'.$post->getID().'/',
'class' => 'phame-blog-list-new-post',
- 'sigil' => 'has-tooltip',
- 'meta' => array('tip' => pht('New Post')),
),
$icon);
@@ -67,17 +72,12 @@
array(
$image,
$title,
- $add_new,
+ $edit,
));
}
if (empty($list)) {
- $list = phutil_tag(
- 'a',
- array(
- 'href' => '/phame/blog/new/',
- ),
- pht('Create a Blog'));
+ $list = pht('You have no draft posts.');
}
$header = phutil_tag(
@@ -88,9 +88,9 @@
phutil_tag(
'a',
array(
- 'href' => '/phame/blog/',
+ 'href' => '/phame/post/query/draft/',
),
- pht('Blogs')));
+ pht('Drafts')));
return array($header, $list);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 10, 7:59 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7577574
Default Alt Text
D14756.diff (6 KB)
Attached To
Mode
D14756: Add Drafts to PhameHome
Attached
Detach File
Event Timeline
Log In to Comment