1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Make Maniphest use FilterNavView instead of NavView

Summary: Share more code; reduce the number of ad-hoc versions of this rendering
loop.

Test Plan: Clicked all the filters.

Reviewers: btrahan, jungejason

Reviewed By: jungejason

CC: aran, jungejason

Differential Revision: 1247
This commit is contained in:
epriestley 2011-12-20 14:36:54 -08:00
parent d5dedda843
commit 540400a806
2 changed files with 15 additions and 41 deletions

View file

@ -33,7 +33,6 @@ class ManiphestTaskListController extends ManiphestController {
$request = $this->getRequest();
$user = $request->getUser();
$uri = $request->getRequestURI();
if ($request->isFormPost()) {
// Redirect to GET so URIs can be copy/pasted.
@ -55,23 +54,21 @@ class ManiphestTaskListController extends ManiphestController {
return id(new AphrontRedirectResponse())->setURI($uri);
}
$views = array(
'User Tasks',
'action' => 'Assigned',
'created' => 'Created',
'subscribed' => 'Subscribed',
'triage' => 'Need Triage',
'<hr />',
'All Tasks',
'alltriage' => 'Need Triage',
'all' => 'All Tasks',
'<hr />',
'custom' => 'Custom',
);
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/maniphest/view/'));
$nav->addLabel('User Tasks');
$nav->addFilter('action', 'Assigned');
$nav->addFilter('created', 'Created');
$nav->addFilter('subscribed', 'Subscribed');
$nav->addFilter('triage', 'Need Triage');
$nav->addSpacer();
$nav->addLabel('All Tasks');
$nav->addFilter('alltriage', 'Need Triage');
$nav->addFilter('all', 'All Tasks');
$nav->addSpacer();
$nav->addFilter('custom', 'Custom');
if (empty($views[$this->view])) {
$this->view = 'action';
}
$this->view = $nav->selectFilter($this->view, 'action');
$has_filter = array(
'action' => true,
@ -80,29 +77,6 @@ class ManiphestTaskListController extends ManiphestController {
'triage' => true,
);
$nav = new AphrontSideNavView();
foreach ($views as $view => $name) {
if (is_integer($view)) {
$nav->addNavItem(
phutil_render_tag(
'span',
array(),
$name));
} else {
$uri->setPath('/maniphest/view/'.$view.'/');
$nav->addNavItem(
phutil_render_tag(
'a',
array(
'href' => $uri->alter('page', null),
'class' => ($this->view == $view)
? 'aphront-side-nav-selected'
: null,
),
phutil_escape_html($name)));
}
}
list($status_map, $status_links) = $this->renderStatusLinks();
list($grouping, $group_links) = $this->renderGroupLinks();
list($order, $order_links) = $this->renderOrderLinks();

View file

@ -21,7 +21,7 @@ phutil_require_module('phabricator', 'view/form/control/text');
phutil_require_module('phabricator', 'view/form/control/togglebuttons');
phutil_require_module('phabricator', 'view/form/control/tokenizer');
phutil_require_module('phabricator', 'view/layout/listfilter');
phutil_require_module('phabricator', 'view/layout/sidenav');
phutil_require_module('phabricator', 'view/layout/sidenavfilter');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'parser/uri');