2013-03-22 00:04:29 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorTokenLeaderController
|
2014-04-22 00:33:07 +02:00
|
|
|
extends PhabricatorTokenController {
|
|
|
|
|
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
2013-03-22 00:04:29 +01:00
|
|
|
|
2015-07-22 22:30:13 +02:00
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$viewer = $request->getViewer();
|
2013-04-01 17:15:23 +02:00
|
|
|
|
2015-06-02 23:34:04 +02:00
|
|
|
$pager = new PHUIPagerView();
|
2013-04-01 17:15:23 +02:00
|
|
|
$pager->setURI($request->getRequestURI(), 'page');
|
|
|
|
$pager->setOffset($request->getInt('page'));
|
2013-03-22 00:04:29 +01:00
|
|
|
|
|
|
|
$query = id(new PhabricatorTokenReceiverQuery());
|
2015-07-22 22:30:13 +02:00
|
|
|
$objects = $query->setViewer($viewer)->executeWithOffsetPager($pager);
|
2013-03-22 00:04:29 +01:00
|
|
|
$counts = $query->getTokenCounts();
|
|
|
|
|
|
|
|
$handles = array();
|
2013-05-23 20:58:23 +02:00
|
|
|
$phids = array();
|
2013-03-22 00:04:29 +01:00
|
|
|
if ($counts) {
|
|
|
|
$phids = mpull($objects, 'getPHID');
|
2013-09-11 21:27:28 +02:00
|
|
|
$handles = id(new PhabricatorHandleQuery())
|
2015-07-22 22:30:13 +02:00
|
|
|
->setViewer($viewer)
|
2013-09-11 21:27:28 +02:00
|
|
|
->withPHIDs($phids)
|
|
|
|
->execute();
|
2013-03-22 00:04:29 +01:00
|
|
|
}
|
|
|
|
|
2013-09-09 23:14:34 +02:00
|
|
|
$list = new PHUIObjectItemListView();
|
2013-03-22 00:04:29 +01:00
|
|
|
foreach ($phids as $object) {
|
|
|
|
$count = idx($counts, $object, 0);
|
2013-09-09 23:14:34 +02:00
|
|
|
$item = id(new PHUIObjectItemView());
|
2013-03-22 00:04:29 +01:00
|
|
|
$handle = $handles[$object];
|
|
|
|
|
|
|
|
$item->setHeader($handle->getFullName());
|
|
|
|
$item->setHref($handle->getURI());
|
|
|
|
$item->addAttribute(pht('Tokens: %s', $count));
|
|
|
|
$list->addItem($item);
|
|
|
|
}
|
|
|
|
|
|
|
|
$title = pht('Token Leader Board');
|
|
|
|
|
2015-01-28 18:33:49 +01:00
|
|
|
$box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeaderText($title)
|
[Redesign] New PHUIObjectItemListView
Summary:
New, cleaner, ObjectItemLists. Lots of minor style tweaks, basic overview:
- Remove FootIcons
- Remove Stackable
- Remove Plain List
- Add StatusIcon
- Add setting ObjectList to an ObjectBox
- Minor retouches to Headers
Mostly, this should give us an idea of life with the new Object Lists. I'll take another application by application pass down the road. This mostly looks at implementation in Maniphest, Differential, Audit, Workboards. Checked a few other areas and dialogs while testing, and everything looks square.
Test Plan: Maniphest, Differential, Homepage, Audit, People, and other applications. Drag reorder, etc.
Reviewers: btrahan, epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D12865
2015-05-15 22:28:59 +02:00
|
|
|
->setObjectList($list);
|
2015-01-28 18:33:49 +01:00
|
|
|
|
2013-03-22 00:04:29 +01:00
|
|
|
$nav = $this->buildSideNav();
|
|
|
|
$nav->setCrumbs(
|
|
|
|
$this->buildApplicationCrumbs()
|
2013-12-19 02:47:34 +01:00
|
|
|
->addTextCrumb($title));
|
2013-03-22 00:04:29 +01:00
|
|
|
$nav->selectFilter('leaders/');
|
|
|
|
|
2015-01-28 18:33:49 +01:00
|
|
|
$nav->appendChild($box);
|
2013-03-22 00:04:29 +01:00
|
|
|
$nav->appendChild($pager);
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
$nav,
|
|
|
|
array(
|
|
|
|
'title' => $title,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|