Move a bunch more rendering into SearchEngine

Summary: Ref T4986. These are mostly mechanical now, I skipped a couple of slightly tricky ones. Still a bunch to go.

Test Plan:
For each engine:

  - Viewed the application;
  - created a panel to issue the query.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4986

Differential Revision: https://secure.phabricator.com/D9017
This commit is contained in:
epriestley
2014-05-08 10:08:37 -07:00
parent c6a68aadc0
commit 78b89711cb
25 changed files with 561 additions and 556 deletions

View File

@@ -1,7 +1,6 @@
<?php
final class DiffusionRepositoryListController extends DiffusionController
implements PhabricatorApplicationSearchResultsControllerInterface {
final class DiffusionRepositoryListController extends DiffusionController {
private $queryKey;
@@ -23,83 +22,6 @@ final class DiffusionRepositoryListController extends DiffusionController
return $this->delegateToController($controller);
}
public function renderResultsList(
array $repositories,
PhabricatorSavedQuery $query) {
assert_instances_of($repositories, 'PhabricatorRepository');
$viewer = $this->getRequest()->getUser();
$project_phids = array_fuse(
array_mergev(
mpull($repositories, 'getProjectPHIDs')));
$project_handles = $this->loadViewerHandles($project_phids);
$list = new PHUIObjectItemListView();
$list->setCards(true);
foreach ($repositories as $repository) {
$id = $repository->getID();
$item = id(new PHUIObjectItemView())
->setUser($viewer)
->setHeader($repository->getName())
->setObjectName('r'.$repository->getCallsign())
->setHref($this->getApplicationURI($repository->getCallsign().'/'));
$commit = $repository->getMostRecentCommit();
if ($commit) {
$commit_link = DiffusionView::linkCommit(
$repository,
$commit->getCommitIdentifier(),
$commit->getSummary());
$item->setSubhead($commit_link);
$item->setEpoch($commit->getEpoch());
}
$item->addIcon(
'none',
PhabricatorRepositoryType::getNameForRepositoryType(
$repository->getVersionControlSystem()));
$size = $repository->getCommitCount();
if ($size) {
$history_uri = DiffusionRequest::generateDiffusionURI(
array(
'callsign' => $repository->getCallsign(),
'action' => 'history',
));
$item->addAttribute(
phutil_tag(
'a',
array(
'href' => $history_uri,
),
pht('%s Commit(s)', new PhutilNumber($size))));
} else {
$item->addAttribute(pht('No Commits'));
}
$handles = array_select_keys(
$project_handles,
$repository->getProjectPHIDs());
if ($handles) {
$item->addAttribute(
id(new ManiphestTaskProjectsView())
->setHandles($handles));
}
if (!$repository->isTracked()) {
$item->setDisabled(true);
$item->addIcon('disable-grey', pht('Inactive'));
}
$list->addItem($item);
}
return $list;
}
public function buildSideNavView($for_app = false) {
$viewer = $this->getRequest()->getUser();