mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-28 15:38:19 +01:00
3da38c74da
Summary: Clean up the error view styling. Test Plan: Tested as many as I could find, built additional tests in UIExamples {F280452} {F280453} Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: hach-que, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11605
67 lines
1.6 KiB
PHP
67 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class PhabricatorUIExampleRenderController extends PhabricatorController {
|
|
|
|
private $class;
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->class = idx($data, 'class');
|
|
}
|
|
|
|
public function processRequest() {
|
|
|
|
$classes = id(new PhutilSymbolLoader())
|
|
->setAncestorClass('PhabricatorUIExample')
|
|
->loadObjects();
|
|
$classes = msort($classes, 'getName');
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
|
|
|
|
foreach ($classes as $class => $obj) {
|
|
$name = $obj->getName();
|
|
$nav->addFilter($class, $name);
|
|
}
|
|
|
|
$selected = $nav->selectFilter($this->class, head_key($classes));
|
|
|
|
$example = $classes[$selected];
|
|
$example->setRequest($this->getRequest());
|
|
|
|
$result = $example->renderExample();
|
|
if ($result instanceof AphrontResponse) {
|
|
// This allows examples to generate dialogs, etc., for demonstration.
|
|
return $result;
|
|
}
|
|
|
|
require_celerity_resource('phabricator-ui-example-css');
|
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
$crumbs->setBorder(true);
|
|
$crumbs->addTextCrumb($example->getName());
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
->setHeader(pht('%s (%s)', $example->getName(), get_class($example)))
|
|
->setSubheader($example->getDescription())
|
|
->setNoBackground(true);
|
|
|
|
$nav->appendChild(
|
|
array(
|
|
$crumbs,
|
|
$header,
|
|
phutil_tag('br'),
|
|
$result,
|
|
));
|
|
|
|
return $this->buildApplicationPage(
|
|
$nav,
|
|
array(
|
|
'title' => $example->getName(),
|
|
));
|
|
}
|
|
|
|
}
|