Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892050
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/phame/query/PhameBlogSearchEngine.php b/src/applications/phame/query/PhameBlogSearchEngine.php
index 58dba3b810..d006745780 100644
--- a/src/applications/phame/query/PhameBlogSearchEngine.php
+++ b/src/applications/phame/query/PhameBlogSearchEngine.php
@@ -1,107 +1,114 @@
<?php
final class PhameBlogSearchEngine
extends PhabricatorApplicationSearchEngine {
public function getResultTypeDescription() {
return pht('Phame Blogs');
}
public function getApplicationClassName() {
return 'PhabricatorPhameApplication';
}
public function newQuery() {
- return new PhameBlogQuery();
+ return id(new PhameBlogQuery())
+ ->needProfileImage(true);
}
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
if ($map['statuses']) {
$query->withStatuses(array($map['statuses']));
}
return $query;
}
protected function buildCustomSearchFields() {
return array(
id(new PhabricatorSearchSelectField())
->setKey('statuses')
->setLabel(pht('Status'))
->setOptions(array(
'' => pht('All'),
PhameBlog::STATUS_ACTIVE => pht('Active'),
PhameBlog::STATUS_ARCHIVED => pht('Archived'),
)),
);
}
protected function getURI($path) {
return '/phame/blog/'.$path;
}
protected function getBuiltinQueryNames() {
$names = array(
'active' => pht('Active Blogs'),
'archived' => pht('Archived Blogs'),
'all' => pht('All Blogs'),
);
return $names;
}
public function buildSavedQueryFromBuiltin($query_key) {
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
switch ($query_key) {
case 'all':
return $query;
case 'active':
return $query->setParameter(
'statuses', PhameBlog::STATUS_ACTIVE);
case 'archived':
return $query->setParameter(
'statuses', PhameBlog::STATUS_ARCHIVED);
}
return parent::buildSavedQueryFromBuiltin($query_key);
}
protected function renderResultList(
array $blogs,
PhabricatorSavedQuery $query,
array $handles) {
assert_instances_of($blogs, 'PhameBlog');
$viewer = $this->requireViewer();
$list = new PHUIObjectItemListView();
$list->setUser($viewer);
foreach ($blogs as $blog) {
- $archived = false;
- $icon = 'fa-star';
- if ($blog->isArchived()) {
- $archived = true;
- $icon = 'fa-ban';
- }
$id = $blog->getID();
+ if ($blog->getDomain()) {
+ $domain = $blog->getDomain();
+ } else {
+ $domain = pht('Local Blog');
+ }
$item = id(new PHUIObjectItemView())
->setUser($viewer)
->setObject($blog)
->setHeader($blog->getName())
- ->setStatusIcon($icon)
- ->setDisabled($archived)
+ ->setImageURI($blog->getProfileImageURI())
+ ->setDisabled($blog->isArchived())
->setHref($this->getApplicationURI("/blog/view/{$id}/"))
- ->addAttribute($blog->getSkin())
- ->addAttribute($blog->getDomain());
+ ->addAttribute($domain);
+ 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);
}
$result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No blogs found.'));
return $result;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 16:10 (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1126337
Default Alt Text
(3 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment