1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00
phorge-phorge/src/applications/search/controller/PhabricatorSearchHovercardController.php
Chad Little 57ad790de3 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-06 21:16:55 -07:00

65 lines
1.5 KiB
PHP

<?php
/**
* @group search
*/
final class PhabricatorSearchHovercardController
extends PhabricatorSearchBaseController {
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$phids = $request->getArr('phids');
$handle_data = new PhabricatorObjectHandleData($phids);
$handle_data->setViewer($user);
$handles = $handle_data->loadHandles();
$objects = $handle_data->loadObjects();
$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(
'class' => 'ml',
),
$hovercard);
}
return $this->buildApplicationPage(
$cards,
array(
'dust' => true,
));
} else {
return id(new AphrontAjaxResponse())->setContent(
array(
'cards' => $cards,
));
}
}
}