mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 03:12:41 +01:00
f1bf27959f
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
70 lines
1.7 KiB
PHP
70 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group slowvote
|
|
*/
|
|
abstract class PhabricatorSlowvoteController extends PhabricatorController {
|
|
|
|
const VIEW_ALL = 'all';
|
|
const VIEW_CREATED = 'created';
|
|
const VIEW_VOTED = 'voted';
|
|
|
|
public function buildStandardPageResponse($view, array $data) {
|
|
$page = $this->buildStandardPageView();
|
|
|
|
$page->setApplicationName(pht('Slowvote'));
|
|
$page->setBaseURI('/vote/');
|
|
$page->setTitle(idx($data, 'title'));
|
|
$page->setGlyph("\xE2\x9C\x94");
|
|
|
|
$page->appendChild($view);
|
|
|
|
$response = new AphrontWebpageResponse();
|
|
return $response->setContent($page->render());
|
|
}
|
|
|
|
public function buildSideNavView($filter = null, $for_app = false) {
|
|
|
|
$views = $this->getViews();
|
|
$side_nav = new AphrontSideNavFilterView();
|
|
$side_nav->setBaseURI(new PhutilURI('/vote/view/'));
|
|
foreach ($views as $key => $name) {
|
|
$side_nav->addFilter($key, $name);
|
|
}
|
|
if ($filter) {
|
|
$side_nav->selectFilter($filter, null);
|
|
}
|
|
|
|
if ($for_app) {
|
|
$side_nav->addFilter('', pht('Create Question'),
|
|
$this->getApplicationURI('create/'));
|
|
}
|
|
|
|
return $side_nav;
|
|
}
|
|
|
|
public function buildApplicationMenu() {
|
|
return $this->buildSideNavView(null, true)->getMenu();
|
|
}
|
|
|
|
public function buildApplicationCrumbs() {
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$crumbs->addAction(
|
|
id(new PHUIListItemView())
|
|
->setName(pht('Create Question'))
|
|
->setHref($this->getApplicationURI('create/'))
|
|
->setIcon('create'));
|
|
|
|
return $crumbs;
|
|
}
|
|
|
|
public function getViews() {
|
|
return array(
|
|
self::VIEW_ALL => pht('All Slowvotes'),
|
|
self::VIEW_CREATED => pht('Created'),
|
|
self::VIEW_VOTED => pht('Voted In'),
|
|
);
|
|
}
|
|
|
|
}
|