2013-04-03 17:31:27 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorSearchHovercardController
|
|
|
|
extends PhabricatorSearchBaseController {
|
|
|
|
|
2014-10-17 02:40:12 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-04-03 17:31:27 +02:00
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
$phids = $request->getArr('phids');
|
|
|
|
|
2013-09-11 21:27:28 +02:00
|
|
|
$handles = id(new PhabricatorHandleQuery())
|
|
|
|
->setViewer($user)
|
|
|
|
->withPHIDs($phids)
|
|
|
|
->execute();
|
|
|
|
$objects = id(new PhabricatorObjectQuery())
|
|
|
|
->setViewer($user)
|
|
|
|
->withPHIDs($phids)
|
|
|
|
->execute();
|
2013-04-03 17:31:27 +02:00
|
|
|
|
|
|
|
$cards = array();
|
|
|
|
|
|
|
|
foreach ($phids as $phid) {
|
|
|
|
$handle = $handles[$phid];
|
|
|
|
|
|
|
|
$hovercard = new PhabricatorHovercardView();
|
|
|
|
$hovercard->setObjectHandle($handle);
|
|
|
|
|
|
|
|
// Send it to the other side of the world, thanks to PhutilEventEngine
|
|
|
|
$event = new PhabricatorEvent(
|
|
|
|
PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD,
|
|
|
|
array(
|
|
|
|
'hovercard' => $hovercard,
|
|
|
|
'handle' => $handle,
|
|
|
|
'object' => idx($objects, $phid),
|
|
|
|
));
|
|
|
|
$event->setUser($user);
|
|
|
|
PhutilEventEngine::dispatchEvent($event);
|
|
|
|
|
|
|
|
$cards[$phid] = $hovercard;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Browser-friendly for non-Ajax requests
|
|
|
|
if (!$request->isAjax()) {
|
|
|
|
foreach ($cards as $key => $hovercard) {
|
|
|
|
$cards[$key] = phutil_tag('div',
|
|
|
|
array(
|
Hovercard tweaks
Summary: Tightens up spacing, remove some of the borders, add alpha channel, make them all blue (sorry, red green and yellow are for 'status'). If we want to do more colors just for hovercards, I have a brown and a black in the mock, but would like to try just blue for now.
Test Plan: UIExamples, Tasks, People, Diffs, and Pastes.
Reviewers: epriestley, AnhNhan, btrahan
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D5609
2013-04-07 06:13:11 +02:00
|
|
|
'class' => 'ml',
|
2013-04-03 17:31:27 +02:00
|
|
|
),
|
|
|
|
$hovercard);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
$cards,
|
|
|
|
array(
|
2014-06-24 00:15:11 +02:00
|
|
|
'device' => false,
|
2013-04-03 17:31:27 +02:00
|
|
|
));
|
2013-04-03 23:20:39 +02:00
|
|
|
} else {
|
|
|
|
return id(new AphrontAjaxResponse())->setContent(
|
|
|
|
array(
|
|
|
|
'cards' => $cards,
|
|
|
|
));
|
2013-04-03 17:31:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|