1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Minor updates to PhameBlogSearch

Summary: Use Profile Image, remove skin, show domain info better, add New Post button. Ref T9897

Test Plan: Test new buttons, see new images.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9897

Differential Revision: https://secure.phabricator.com/D14671
This commit is contained in:
Chad Little 2015-12-04 13:05:29 -08:00
parent ef820ed1ee
commit cf6c3fb41a

View file

@ -12,7 +12,8 @@ final class PhameBlogSearchEngine
} }
public function newQuery() { public function newQuery() {
return new PhameBlogQuery(); return id(new PhameBlogQuery())
->needProfileImage(true);
} }
protected function buildQueryFromParameters(array $map) { protected function buildQueryFromParameters(array $map) {
@ -78,22 +79,28 @@ final class PhameBlogSearchEngine
$list->setUser($viewer); $list->setUser($viewer);
foreach ($blogs as $blog) { foreach ($blogs as $blog) {
$archived = false;
$icon = 'fa-star';
if ($blog->isArchived()) {
$archived = true;
$icon = 'fa-ban';
}
$id = $blog->getID(); $id = $blog->getID();
if ($blog->getDomain()) {
$domain = $blog->getDomain();
} else {
$domain = pht('Local Blog');
}
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
->setUser($viewer) ->setUser($viewer)
->setObject($blog) ->setObject($blog)
->setHeader($blog->getName()) ->setHeader($blog->getName())
->setStatusIcon($icon) ->setImageURI($blog->getProfileImageURI())
->setDisabled($archived) ->setDisabled($blog->isArchived())
->setHref($this->getApplicationURI("/blog/view/{$id}/")) ->setHref($this->getApplicationURI("/blog/view/{$id}/"))
->addAttribute($blog->getSkin()) ->addAttribute($domain);
->addAttribute($blog->getDomain()); if (!$blog->isArchived()) {
$button = id(new PHUIButtonView())
->setTag('a')
->setText('New Post')
->setHref($this->getApplicationURI('/post/edit/?blog='.$id));
$item->setLaunchButton($button);
}
$list->addItem($item); $list->addItem($item);
} }