1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 03:12:41 +01:00
phorge-phorge/src/applications/herald/controller/HeraldTranscriptListController.php
epriestley a5dc9067af Provide convenience method addTextCrumb() to PhabricatorCrumbsView
Summary: We currently have a lot of calls to `addCrumb(id(new PhabricatorCrumbView())->...)` which can be expressed much more simply with a convenience method. Nearly all crumbs are only textual.

Test Plan:
  - This was mostly automated, then I cleaned up a few unusual sites manually.
  - Bunch of grep / randomly clicking around.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: hach-que, aran

Differential Revision: https://secure.phabricator.com/D7787
2013-12-18 17:47:34 -08:00

86 lines
2.1 KiB
PHP

<?php
final class HeraldTranscriptListController extends HeraldController {
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$pager = new AphrontCursorPagerView();
$pager->readFromRequest($request);
$transcripts = id(new HeraldTranscriptQuery())
->setViewer($user)
->needPartialRecords(true)
->executeWithCursorPager($pager);
// Render the table.
$handles = array();
if ($transcripts) {
$phids = mpull($transcripts, 'getObjectPHID', 'getObjectPHID');
$handles = $this->loadViewerHandles($phids);
}
$rows = array();
foreach ($transcripts as $xscript) {
$rows[] = array(
phabricator_date($xscript->getTime(), $user),
phabricator_time($xscript->getTime(), $user),
$handles[$xscript->getObjectPHID()]->renderLink(),
$xscript->getDryRun() ? pht('Yes') : '',
number_format((int)(1000 * $xscript->getDuration())).' ms',
phutil_tag(
'a',
array(
'href' => '/herald/transcript/'.$xscript->getID().'/',
'class' => 'button small grey',
),
pht('View Transcript')),
);
}
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
pht('Date'),
pht('Time'),
pht('Object'),
pht('Dry Run'),
pht('Duration'),
pht('View'),
));
$table->setColumnClasses(
array(
'',
'right',
'wide wrap',
'',
'',
'action',
));
// Render the whole page.
$panel = new AphrontPanelView();
$panel->setHeader(pht('Herald Transcripts'));
$panel->appendChild($table);
$panel->appendChild($pager);
$panel->setNoBackground();
$nav = $this->buildSideNavView();
$nav->selectFilter('transcript');
$nav->appendChild($panel);
$crumbs = id($this->buildApplicationCrumbs())
->addTextCrumb(pht('Transcripts'));
$nav->setCrumbs($crumbs);
return $this->buildApplicationPage(
$nav,
array(
'title' => pht('Herald Transcripts'),
'device' => true,
));
}
}