Replace all instances of AphrontSideNavView with AphrontSideNavFilterView

Summary:
AphrontSideNavView is an old class which required you to do a lot of work; it was obsoleted by AphrontSideNavFilterView. Remove all direct callsites so I can clean it up.

This is a precursor to letting me render a filter menu as a dropdown menu for T1960.

Test Plan:
Examined each interface for correct filter construction and selection:

  - Browsed Diffusion
  - Browsed Differential
  - Browsed Files
  - Browsed Slowvote
  - Browsed Phriction
  - Browsed repo edit interface

Grepped for `AphrontSideNavView`. The only remaining instances are in `AphrontSideNavView` itself and `AphrontSideNavFilterView` (which currently uses it).

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T1960

Differential Revision: https://secure.phabricator.com/D4034
This commit is contained in:
epriestley
2012-12-07 13:30:31 -08:00
parent 6482876cf3
commit 20ee3003b5
7 changed files with 40 additions and 110 deletions

View File

@@ -42,7 +42,8 @@ abstract class DiffusionController extends PhabricatorController {
}
final protected function buildSideNav($selected, $has_change_view) {
$nav = new AphrontSideNavView();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI(''));
$navs = array(
'history' => 'History View',
@@ -61,36 +62,27 @@ abstract class DiffusionController extends PhabricatorController {
$navs['lint'] = 'Lint View';
}
$selected_href = null;
foreach ($navs as $action => $name) {
$href = $drequest->generateURI(
array(
'action' => $action,
));
if ($action == $selected) {
$selected_href = $href;
}
$nav->addNavItem(
phutil_render_tag(
'a',
array(
'href' => $href,
'class' =>
($action == $selected
? 'aphront-side-nav-selected'
: null),
),
$name));
$nav->addFilter($href, $name);
}
$nav->selectFilter($selected_href, null);
// TODO: URI encoding might need to be sorted out for this link.
$nav->addNavItem(
phutil_render_tag(
'a',
array(
'href' => '/owners/view/search/'.
'?repository='.phutil_escape_uri($drequest->getCallsign()).
'&path='.phutil_escape_uri('/'.$drequest->getPath()),
),
"Search Owners \xE2\x86\x97"));
$nav->addFilter(
'/owners/view/search/'.
'?repository='.phutil_escape_uri($drequest->getCallsign()).
'&path='.phutil_escape_uri('/'.$drequest->getPath()),
"Search Owners \xE2\x86\x97");
return $nav;
}