1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-22 18:28:47 +02:00
phorge-phorge/src/applications/project/controller/PhabricatorProjectHistoryController.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

57 lines
1.3 KiB
PHP

<?php
final class PhabricatorProjectHistoryController
extends PhabricatorProjectController {
private $id;
public function shouldAllowPublic() {
return true;
}
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$id = $this->id;
$project = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$project) {
return new Aphront404Response();
}
$xactions = id(new PhabricatorProjectTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($project->getPHID()))
->execute();
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($project->getPHID())
->setTransactions($xactions);
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(
$project->getName(),
$this->getApplicationURI("view/{$id}/"))
->addTextCrumb(pht('History'));
return $this->buildApplicationPage(
array(
$crumbs,
$timeline,
),
array(
'title' => $project->getName(),
'device' => true,
));
}
}