Files
phabricator/src/applications/diviner/controller/DivinerLegacyController.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

66 lines
1.7 KiB
PHP

<?php
final class DivinerLegacyController extends DivinerController {
public function processRequest() {
// TODO: Temporary implementation until Diviner is up and running inside
// Phabricator.
$links = array(
'http://www.phabricator.com/docs/phabricator/' => array(
'name' => 'Phabricator Ducks',
'flavor' => 'Oops, that should say "Docs".',
),
'http://www.phabricator.com/docs/arcanist/' => array(
'name' => 'Arcanist Docs',
'flavor' => 'Words have never been so finely crafted.',
),
'http://www.phabricator.com/docs/libphutil/' => array(
'name' => 'libphutil Docs',
'flavor' => 'Soothing prose; seductive poetry.',
),
'http://www.phabricator.com/docs/javelin/' => array(
'name' => 'Javelin Docs',
'flavor' => 'O, what noble scribe hath penned these words?',
),
);
$request = $this->getRequest();
$viewer = $request->getUser();
$list = id(new PHUIObjectItemListView())
->setUser($viewer)
->setPlain(true);
foreach ($links as $href => $link) {
$item = id(new PHUIObjectItemView())
->setHref($href)
->setHeader($link['name'])
->addAttribute($link['flavor']);
$list->addItem($item);
}
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Documentation'));
$header = id(new PHUIHeaderView())
->setHeader(pht('Documentation'));
$document = new PHUIDocumentView();
$document->setHeader($header);
$document->appendChild($list);
return $this->buildApplicationPage(
array(
$crumbs,
$document,
),
array(
'title' => pht('Documentation'),
'device' => true,
));
}
}