1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 18:32:41 +01:00
phorge-phorge/src/applications/config/controller/PhabricatorConfigIssueViewController.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

71 lines
1.8 KiB
PHP

<?php
final class PhabricatorConfigIssueViewController
extends PhabricatorConfigController {
private $issueKey;
public function willProcessRequest(array $data) {
$this->issueKey = $data['key'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$issues = PhabricatorSetupCheck::runAllChecks();
PhabricatorSetupCheck::setOpenSetupIssueCount(
PhabricatorSetupCheck::countUnignoredIssues($issues));
if (empty($issues[$this->issueKey])) {
$content = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle(pht('Issue Resolved'))
->appendChild(pht('This setup issue has been resolved. '))
->appendChild(
phutil_tag(
'a',
array(
'href' => $this->getApplicationURI('issue/'),
),
pht('Return to Open Issue List')));
$title = pht('Resolved Issue');
} else {
$issue = $issues[$this->issueKey];
$content = $this->renderIssue($issue);
$title = $issue->getShortName();
}
$crumbs = $this
->buildApplicationCrumbs()
->addTextCrumb(pht('Setup Issues'), $this->getApplicationURI('issue/'))
->addTextCrumb($title, $request->getRequestURI());
return $this->buildApplicationPage(
array(
$crumbs,
$content,
),
array(
'title' => $title,
'device' => true,
));
}
private function renderIssue(PhabricatorSetupIssue $issue) {
require_celerity_resource('setup-issue-css');
$view = new PhabricatorSetupIssueView();
$view->setIssue($issue);
$container = phutil_tag(
'div',
array(
'class' => 'setup-issue-background',
),
$view->render());
return $container;
}
}