1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 19:02:41 +01:00
phorge-phorge/src/applications/feed/controller/PhabricatorFeedMainController.php
Chad Little 6229b7bd88 Refresh Feed Design
Summary: Refreshes feed's design a bit, adds app icons, works nicer on mobile.

Test Plan: Tested many feed stories, not sure I got them all, but seems fine.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5673
2013-04-13 09:09:42 -07:00

85 lines
2 KiB
PHP

<?php
final class PhabricatorFeedMainController extends PhabricatorFeedController {
private $filter;
public function willProcessRequest(array $data) {
$this->filter = idx($data, 'filter');
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$nav = $this->buildSideNavView();
$filter = $nav->selectFilter($this->filter, 'all');
$pager = new AphrontCursorPagerView();
$pager->readFromRequest($request);
$pager->setPageSize(200);
$query = id(new PhabricatorFeedQuery())
->setViewer($user);
$nodata = null;
switch ($filter) {
case 'all':
$title = pht('Feed');
break;
case 'projects':
$projects = id(new PhabricatorProjectQuery())
->setViewer($user)
->withMemberPHIDs(array($user->getPHID()))
->execute();
if (!$projects) {
$nodata = pht('You have not joined any projects.');
} else {
$query->setFilterPHIDs(mpull($projects, 'getPHID'));
}
$title = pht('Feed: My Projects');
break;
}
if ($nodata) {
$feed_view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NODATA)
->setTitle(pht('No Stories'))
->appendChild($nodata);
} else {
$feed = $query->executeWithCursorPager($pager);
$builder = new PhabricatorFeedBuilder($feed);
$builder->setUser($user);
$feed_view = $builder->buildView();
}
$crumbs = $this
->buildApplicationCrumbs($nav)
->addCrumb(
id(new PhabricatorCrumbView())
->setName($title)
->setHref($this->getApplicationURI('filter/'.$filter.'/')));
$nav->setCrumbs($crumbs);
$nav->appendChild(
array(
$feed_view,
$pager,
));
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
'device' => true,
'dust' => true,
));
}
}