Page MenuHomePhabricator

D14756.id35682.diff
No OneTemporary

D14756.id35682.diff

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,7 +57,19 @@
->setHeader($header)
->appendChild($post_list);
- $sidebar = id(new PhameBlogListView())
+ $drafts = id(new PhamePostQuery())
+ ->setViewer($viewer)
+ ->withVisibility(PhameConstants::VISIBILITY_DRAFT)
+ ->setLimit(5)
+ ->execute();
+
+ $sidebar = array();
+ $sidebar[] = id(new PhameBlogListView())
+ ->setBlogs($blogs)
+ ->setViewer($viewer);
+
+ $sidebar[] = id(new PhameDraftListView())
+ ->setPosts($drafts)
->setBlogs($blogs)
->setViewer($viewer);
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

Mime Type
text/plain
Expires
Mar 15 2025, 4:59 PM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7698573
Default Alt Text
D14756.id35682.diff (5 KB)

Event Timeline