2012-08-10 10:44:04 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class PonderController extends PhabricatorController {
|
|
|
|
|
|
|
|
public function buildStandardPageResponse($view, array $data) {
|
|
|
|
|
|
|
|
$page = $this->buildStandardPageView();
|
2013-04-10 13:08:36 -07:00
|
|
|
$page->setApplicationName(pht('Ponder!'));
|
2012-08-10 10:44:04 -07:00
|
|
|
$page->setBaseURI('/ponder/');
|
|
|
|
$page->setTitle(idx($data, 'title'));
|
|
|
|
$page->setGlyph("\xE2\x97\xB3");
|
|
|
|
$page->appendChild($view);
|
|
|
|
$page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_QUESTIONS);
|
|
|
|
|
|
|
|
$response = new AphrontWebpageResponse();
|
|
|
|
return $response->setContent($page->render());
|
|
|
|
}
|
|
|
|
|
2012-09-30 20:08:22 -07:00
|
|
|
protected function buildSideNavView(PonderQuestion $question = null) {
|
|
|
|
$side_nav = new AphrontSideNavFilterView();
|
|
|
|
$side_nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
|
2013-04-10 13:08:36 -07:00
|
|
|
$side_nav->addLabel(pht('Questions'));
|
|
|
|
$side_nav->addFilter('feed', pht('All Questions'));
|
|
|
|
$side_nav->addFilter('questions', pht('Your Questions'));
|
|
|
|
$side_nav->addFilter('answers', pht('Your Answers'));
|
2012-09-30 20:12:18 -07:00
|
|
|
|
2013-04-10 13:08:36 -07:00
|
|
|
return $side_nav;
|
|
|
|
}
|
2012-09-30 20:08:22 -07:00
|
|
|
|
2013-04-10 13:08:36 -07:00
|
|
|
public function buildApplicationCrumbs() {
|
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$crumbs
|
|
|
|
->addAction(
|
|
|
|
id(new PhabricatorMenuItemView())
|
|
|
|
->setName(pht('New Question'))
|
2013-04-17 15:02:32 -07:00
|
|
|
->setHref('/ponder/question/ask')
|
2013-04-10 13:08:36 -07:00
|
|
|
->setIcon('create'));
|
2012-09-30 20:08:22 -07:00
|
|
|
|
2013-04-10 13:08:36 -07:00
|
|
|
return $crumbs;
|
2012-09-30 20:08:22 -07:00
|
|
|
}
|
|
|
|
|
2012-08-10 10:44:04 -07:00
|
|
|
}
|