Changeset View
Changeset View
Standalone View
Standalone View
src/view/page/menu/PhabricatorMainMenuView.php
| Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | if ($search) { | ||||
| $view->addMenuItem($search); | $view->addMenuItem($search); | ||||
| } | } | ||||
| return $view; | return $view; | ||||
| } | } | ||||
| private function renderPhabricatorLogo() { | private function renderPhabricatorLogo() { | ||||
| $style_logo = null; | $style_logo = null; | ||||
| $logo = null; | |||||
| $custom_header = PhabricatorEnv::getEnvConfig('ui.custom-header'); | $custom_header = PhabricatorEnv::getEnvConfig('ui.custom-header'); | ||||
| $custom_wordmark = PhabricatorEnv::getEnvConfig('ui.custom-wordmark'); | |||||
| if ($custom_header) { | if ($custom_header) { | ||||
| $cache = PhabricatorCaches::getImmutableCache(); | $cache = PhabricatorCaches::getImmutableCache(); | ||||
| $cache_key_logo = 'ui.custom-header.logo-phid.v1.'.$custom_header; | $cache_key_logo = 'ui.custom-header.logo-phid.v1.'.$custom_header; | ||||
| $logo_uri = $cache->getKey($cache_key_logo); | $logo_uri = $cache->getKey($cache_key_logo); | ||||
| if (!$logo_uri) { | if (!$logo_uri) { | ||||
| $file = id(new PhabricatorFileQuery()) | $file = id(new PhabricatorFileQuery()) | ||||
| ->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
| ->withPHIDs(array($custom_header)) | ->withPHIDs(array($custom_header)) | ||||
| ->executeOne(); | ->executeOne(); | ||||
| if ($file) { | if ($file) { | ||||
| $logo_uri = $file->getViewURI(); | $logo_uri = $file->getViewURI(); | ||||
| $cache->setKey($cache_key_logo, $logo_uri); | $cache->setKey($cache_key_logo, $logo_uri); | ||||
| } | } | ||||
| } | } | ||||
| if ($logo_uri) { | if ($logo_uri) { | ||||
| $style_logo = | $style_logo = | ||||
| 'background-size: 96px 40px; '. | 'background-size: 40px 40px; '. | ||||
| 'background-position: 0px 0px; '. | 'background-position: 0px 0px; '. | ||||
| 'background-image: url('.$logo_uri.');'; | 'background-image: url('.$logo_uri.');'; | ||||
| } | } | ||||
| $logo = phutil_tag( | |||||
| 'span', | |||||
| array( | |||||
| 'class' => 'sprite-menu phabricator-main-menu-logo', | |||||
| 'style' => $style_logo, | |||||
| ), | |||||
| ''); | |||||
| } | } | ||||
| $color = PhabricatorEnv::getEnvConfig('ui.header-color'); | if (!$logo) { | ||||
| if ($color == 'light') { | $logo = phutil_tag( | ||||
| $color = 'dark'; | 'span', | ||||
| } else { | array( | ||||
| $color = 'light'; | 'class' => 'phabricator-wordmark', | ||||
| ), | |||||
| (($custom_wordmark) ? $custom_wordmark : pht('Phabricator'))); | |||||
| } | } | ||||
| return phutil_tag( | return phutil_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'class' => 'phabricator-main-menu-brand', | 'class' => 'phabricator-main-menu-brand', | ||||
| 'href' => '/', | 'href' => '/', | ||||
| ), | ), | ||||
| array( | array( | ||||
| javelin_tag( | javelin_tag( | ||||
| 'span', | 'span', | ||||
| array( | array( | ||||
| 'aural' => true, | 'aural' => true, | ||||
| ), | ), | ||||
| pht('Home')), | pht('Home')), | ||||
| phutil_tag( | phutil_tag( | ||||
| 'span', | 'span', | ||||
| array( | array( | ||||
| 'class' => 'sprite-menu phabricator-main-menu-eye '.$color.'-eye', | 'class' => 'sprite-menu phabricator-main-menu-eye light-eye', | ||||
| ), | |||||
| ''), | |||||
| phutil_tag( | |||||
| 'span', | |||||
| array( | |||||
| 'class' => 'sprite-menu phabricator-main-menu-logo '.$color.'-logo', | |||||
| 'style' => $style_logo, | |||||
| ), | ), | ||||
| ''), | ''), | ||||
| $logo, | |||||
| )); | )); | ||||
| } | } | ||||
| private function renderNotificationMenu() { | private function renderNotificationMenu() { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| require_celerity_resource('phabricator-notification-css'); | require_celerity_resource('phabricator-notification-css'); | ||||
| require_celerity_resource('phabricator-notification-menu-css'); | require_celerity_resource('phabricator-notification-menu-css'); | ||||
| ▲ Show 20 Lines • Show All 183 Lines • Show Last 20 Lines | |||||