Summary: This diff covers a bit of ground. - PHUIDocumentExample has been added - PHUIDocument has been extended with new features - PhabricatorMenuView is now PHUIListView - PhabricatorMenuItemView is now PHUIItemListView Overall - I think I've gotten all the edges covered here. There is some derpi-ness that we can talk about, comments in the code. Responsive design is missing from the new features on PHUIDocument, will follow up later. Test Plan: Tested mobile and desktop menus, old phriction layout, new document views, new lists, and object lists. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D6130
52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
abstract class PhabricatorPasteController extends PhabricatorController {
|
|
|
|
public function buildSideNavView($for_app = false) {
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
if ($for_app) {
|
|
$nav->addFilter('create', pht('Create Paste'));
|
|
}
|
|
|
|
id(new PhabricatorPasteSearchEngine())
|
|
->setViewer($user)
|
|
->addNavigationItems($nav->getMenu());
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
return $nav;
|
|
}
|
|
|
|
public function buildApplicationMenu() {
|
|
return $this->buildSideNavView(true)->getMenu();
|
|
}
|
|
|
|
public function buildApplicationCrumbs() {
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$crumbs->addAction(
|
|
id(new PHUIListItemView())
|
|
->setName(pht('Create Paste'))
|
|
->setHref($this->getApplicationURI('create/'))
|
|
->setIcon('create'));
|
|
|
|
return $crumbs;
|
|
}
|
|
|
|
public function buildSourceCodeView(
|
|
PhabricatorPaste $paste,
|
|
$max_lines = null) {
|
|
|
|
$lines = phutil_split_lines($paste->getContent());
|
|
|
|
return id(new PhabricatorSourceCodeView())
|
|
->setLimit($max_lines)
|
|
->setLines($lines);
|
|
}
|
|
|
|
}
|