From 6482876cf302de7380d872f13a93c725f04fb6cc Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 7 Dec 2012 13:29:44 -0800 Subject: [PATCH] Remove the application menu Summary: Toss this completely as per discussion elsewhere. Basically it doesn't feel as useful as we imagined it would, and breadcrumbs from T1960 will replace the primary useful part (navigating up). There's some more cleanup to do but I'll hit that in the next few diffs. Closes T1828 as wontfix. Test Plan: Viewed app + local, app-without-local interfaces. Saw no app menus. Reviewers: chad Reviewed By: chad CC: aran, vrana Maniphest Tasks: T1828, T1960 Differential Revision: https://secure.phabricator.com/D4033 --- .../base/controller/PhabricatorController.php | 5 - src/view/layout/AphrontSideNavFilterView.php | 16 --- src/view/layout/AphrontSideNavView.php | 120 ------------------ .../rsrc/css/aphront/phabricator-nav-view.css | 87 +------------ .../core/behavior-phabricator-nav.js | 28 ++-- 5 files changed, 13 insertions(+), 243 deletions(-) diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index e015f3a67f..7616344273 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -159,13 +159,8 @@ abstract class PhabricatorController extends AphrontController { $view = $nav; } - if ($application) { - $view->setCurrentApplication($application); - } - $view->setUser($this->getRequest()->getUser()); $view->setFlexNav(true); - $view->setShowApplicationMenu(true); $page->appendChild($view); diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php index b7bb3066b2..ad5b72f2b0 100644 --- a/src/view/layout/AphrontSideNavFilterView.php +++ b/src/view/layout/AphrontSideNavFilterView.php @@ -26,9 +26,7 @@ final class AphrontSideNavFilterView extends AphrontView { private $selectedFilter = false; private $flexNav; private $flexible; - private $showApplicationMenu; private $user; - private $currentApplication; private $active; public function setActive($active) { @@ -36,21 +34,11 @@ final class AphrontSideNavFilterView extends AphrontView { return $this; } - public function setCurrentApplication(PhabricatorApplication $current) { - $this->currentApplication = $current; - return $this; - } - public function setUser(PhabricatorUser $user) { $this->user = $user; return $this; } - public function setShowApplicationMenu($show_application_menu) { - $this->showApplicationMenu = $show_application_menu; - return $this; - } - public function setFlexNav($flex_nav) { $this->flexNav = $flex_nav; return $this; @@ -144,14 +132,10 @@ final class AphrontSideNavFilterView extends AphrontView { $view = new AphrontSideNavView(); $view->setFlexNav($this->flexNav); $view->setFlexible($this->flexible); - $view->setShowApplicationMenu($this->showApplicationMenu); $view->setActive($this->active); if ($this->user) { $view->setUser($this->user); } - if ($this->currentApplication) { - $view->setCurrentApplication($this->currentApplication); - } foreach ($this->items as $item) { list($type, $key, $name) = $item; switch ($type) { diff --git a/src/view/layout/AphrontSideNavView.php b/src/view/layout/AphrontSideNavView.php index b734a0ab00..54a1a3bf71 100644 --- a/src/view/layout/AphrontSideNavView.php +++ b/src/view/layout/AphrontSideNavView.php @@ -5,9 +5,7 @@ final class AphrontSideNavView extends AphrontView { private $items = array(); private $flexNav; private $isFlexible; - private $showApplicationMenu; private $user; - private $currentApplication; private $active; public function setUser(PhabricatorUser $user) { @@ -15,16 +13,6 @@ final class AphrontSideNavView extends AphrontView { return $this; } - public function setShowApplicationMenu($show_application_menu) { - $this->showApplicationMenu = $show_application_menu; - return $this; - } - - public function setCurrentApplication(PhabricatorApplication $current) { - $this->currentApplication = $current; - return $this; - } - public function addNavItem($item) { $this->items[] = $item; return $this; @@ -57,7 +45,6 @@ final class AphrontSideNavView extends AphrontView { $nav_classes = array(); $nav_classes[] = 'phabricator-nav'; - $app_id = celerity_generate_unique_node_id(); $nav_id = null; $drag_id = null; $content_id = celerity_generate_unique_node_id(); @@ -65,16 +52,6 @@ final class AphrontSideNavView extends AphrontView { $local_menu = null; $main_id = celerity_generate_unique_node_id(); - $apps = $this->renderApplications(); - - $app_menu = phutil_render_tag( - 'div', - array( - 'class' => 'phabricator-nav-col phabricator-nav-app', - 'id' => $app_id, - ), - $apps->render()); - if ($this->isFlexible) { $drag_id = celerity_generate_unique_node_id(); $flex_bar = phutil_render_tag( @@ -105,7 +82,6 @@ final class AphrontSideNavView extends AphrontView { 'phabricator-nav', array( 'mainID' => $main_id, - 'appID' => $app_id, 'localID' => $local_id, 'dragID' => $drag_id, 'contentID' => $content_id, @@ -127,14 +103,6 @@ final class AphrontSideNavView extends AphrontView { ''. ''. - '
'. - ''. - ''. - ''. - '
'. ''; return $header_part.phutil_render_tag( @@ -143,7 +111,6 @@ final class AphrontSideNavView extends AphrontView { 'class' => implode(' ', $nav_classes), 'id' => $main_id, ), - $app_menu. $local_menu. $flex_bar. phutil_render_tag( @@ -171,91 +138,4 @@ final class AphrontSideNavView extends AphrontView { } } - private function renderApplications() { - $core = array(); - $current = $this->currentApplication; - - $meta = null; - - $group_core = PhabricatorApplication::GROUP_CORE; - - $applications = PhabricatorApplication::getAllInstalledApplications(); - foreach ($applications as $application) { - if ($application instanceof PhabricatorApplicationApplications) { - $meta = $application; - continue; - } - if ($application->getApplicationGroup() != $group_core) { - continue; - } - if ($application->getApplicationOrder() !== null) { - $core[] = $application; - } - } - - $core = msort($core, 'getApplicationOrder'); - if ($meta) { - $core[] = $meta; - } - $core = mpull($core, null, 'getPHID'); - - if ($current && empty($core[$current->getPHID()])) { - array_unshift($core, $current); - } - - Javelin::initBehavior('phabricator-tooltips', array()); - require_celerity_resource('aphront-tooltip-css'); - - $apps = array(); - foreach ($core as $phid => $application) { - $classes = array(); - $classes[] = 'phabricator-nav-app-item'; - - if ($current && $phid == $current->getPHID()) { - $selected = true; - } else { - $selected = false; - } - - $iclasses = array(); - $iclasses[] = 'phabricator-nav-app-item-icon'; - $style = null; - if ($application->getIconURI()) { - $style = 'background-image: url('.$application->getIconURI().'); '. - 'background-size: 30px auto;'; - } else { - $iclasses[] = 'autosprite'; - $sprite = $application->getAutospriteName(); - if ($selected) { - $sprite .= '-selected'; - } - $iclasses[] = 'app-'.$sprite; - } - - $icon = phutil_render_tag( - 'span', - array( - 'class' => implode(' ', $iclasses), - 'style' => $style, - ), - ''); - - $apps[] = javelin_render_tag( - 'a', - array( - 'class' => implode(' ', $classes), - 'href' => $application->getBaseURI(), - 'sigil' => 'has-tooltip', - 'meta' => array( - 'tip' => $application->getName(), - 'align' => 'E', - ), - ), - $icon. - phutil_escape_html($application->getName())); - } - - return id(new AphrontNullView())->appendChild($apps); - } - } diff --git a/webroot/rsrc/css/aphront/phabricator-nav-view.css b/webroot/rsrc/css/aphront/phabricator-nav-view.css index 79178ea962..ffda6019f4 100644 --- a/webroot/rsrc/css/aphront/phabricator-nav-view.css +++ b/webroot/rsrc/css/aphront/phabricator-nav-view.css @@ -19,13 +19,6 @@ z-index: 3; } -.phabricator-nav-app { - width: 149px; - background: #262b2e; - border-right: 1px solid #222222; - box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.25); -} - .phabricator-nav-local { width: 179px; background: #ececec; @@ -43,7 +36,7 @@ .phabricator-nav-drag { position: fixed; top: 0; - left: 217px; + left: 179px; width: 7px; bottom: 0; z-index: 4; @@ -71,28 +64,12 @@ display: block; } -.phabricator-nav-local { - left: 150px; -} - -.device-desktop .phabricator-nav-local { - left: 38px; -} - -.phabricator-nav-content { - margin-left: 150px; -} - .has-local-nav .phabricator-nav-content { - margin-left: 330px; -} - -.device-desktop .phabricator-nav-content { - margin-left: 38px; + margin-left: 180px; } .device-desktop .has-local-nav .phabricator-nav-content { - margin-left: 216px; + margin-left: 178px; } .device-desktop .local-nav-collapsed .phabricator-nav-local { @@ -124,45 +101,6 @@ background-color: #a1bbe5; } -a.phabricator-nav-app-item { - color: #e9e9e9; - font-weight: normal; - padding: 4px; - padding-left: 40px; - vertical-align: middle; - line-height: 30px; - height: 30px; - - position: relative; -} - -/** - * On the desktop, constrain the size of the so that the tooltip is - * positioned correctly. Without this rule, it ends up too far to the right. - */ -.device-desktop a.phabricator-nav-app-item { - padding-left: 38px; - padding-right: 0px; -} - -span.phabricator-nav-app-item-icon { - position: absolute; - display: block; - - left: 5px; - top: 6px; - background-repeat: no-repeat; - - width: 30px; - height: 30px; - padding: 0; - margin: 0; -} - -.device-desktop .phabricator-nav-app { - width: 37px; -} - .device-desktop .phabricator-nav-head { display: none; } @@ -173,24 +111,11 @@ span.phabricator-nav-app-item-icon { top: 0px; } -.device-tablet .phabricator-nav-app, -.device-phone .phabricator-nav-app { - left: -450px; -} - .device-tablet .phabricator-nav-local, .device-phone .phabricator-nav-local { left: -300px; } -.device-phone .phabricator-nav-head-tablet { - display: none; -} - -.device-tablet .phabricator-nav-head-phone { - display: none; -} - .device-tablet .phabricator-nav, .device-phone .phabricator-nav { overflow-x: hidden; @@ -248,12 +173,6 @@ span.phabricator-nav-app-item-icon { border-radius: 0 6px 6px 0; } -.nav-button-apps { - background-image: url(/rsrc/image/button_apps.png); - background-size: 24px auto; - background-position: center; -} - .nav-button-menu { background-image: url(/rsrc/image/button_menu.png); background-size: 24px auto; diff --git a/webroot/rsrc/js/application/core/behavior-phabricator-nav.js b/webroot/rsrc/js/application/core/behavior-phabricator-nav.js index d61ecf0f41..4a6279e71e 100644 --- a/webroot/rsrc/js/application/core/behavior-phabricator-nav.js +++ b/webroot/rsrc/js/application/core/behavior-phabricator-nav.js @@ -13,7 +13,6 @@ JX.behavior('phabricator-nav', function(config) { - var app = JX.$(config.appID); var content = JX.$(config.contentID); var local = config.localID ? JX.$(config.localID) : null; var main = JX.$(config.mainID); @@ -23,22 +22,20 @@ JX.behavior('phabricator-nav', function(config) { var animations = []; function slide_menu(position) { - var app_width = 150; var local_width = local ? 300 : 0; var shifts = { 0: 0, - 1: app_width - 10, - 2: app_width + local_width + 1: -10, + 2: local_width }; var shift = shifts[position]; while (animations.length) { animations.pop().stop(); } - animations.push(build_animation(app, -shift)); - local && animations.push(build_animation(local, -shift + app_width)); - animations.push(build_animation(content, -shift + app_width + local_width)); + local && animations.push(build_animation(local, -shift)); + animations.push(build_animation(content, -shift + local_width)); select_button(position); } @@ -53,9 +50,9 @@ JX.behavior('phabricator-nav', function(config) { // - Sliding Menu Buttons ------------------------------------------------------ var button_positions = { - 0: [JX.$('phone-menu1'), JX.$('tablet-menu1')], - 1: [JX.$('phone-menu2')], - 2: [JX.$('phone-menu3'), JX.$('tablet-menu2')] + 0: [JX.$('tablet-menu1')], + 1: [], + 2: [JX.$('tablet-menu2')] }; for (var k in button_positions) { @@ -178,8 +175,8 @@ JX.behavior('phabricator-nav', function(config) { // - Scroll -------------------------------------------------------------------- - // When the user scrolls down on the desktop, we move the application and - // local navs up until they hit the top of the page. + // When the user scrolls down on the desktop, we move the local nav up until + // it hits the top of the page. JX.Stratcom.listen(['scroll', 'resize'], null, function(e) { if (JX.Device.getDevice() != 'desktop') { @@ -187,18 +184,13 @@ JX.behavior('phabricator-nav', function(config) { } var y = Math.max(0, 44 - JX.Vector.getScroll().y); - app.style.top = y + 'px'; - if (local) { - local.style.top = y + 'px'; - } + local.style.top = y + 'px'; }); // - Navigation Reset ---------------------------------------------------------- JX.Stratcom.listen('phabricator-device-change', null, function(event) { - app.style.left = ''; - app.style.top = ''; if (local) { local.style.left = ''; local.style.width = '';