public function render()
 {
     $name = $this->getName();
     $href = $this->getHref();
     $classes = $this->classes;
     $classes[] = 'phabricator-main-menu-icon';
     $label = javelin_render_tag('a', array('href' => $href, 'class' => 'phabricator-main-menu-icon-label'), phutil_escape_html($name));
     $item = javelin_render_tag('a', array('href' => $href, 'class' => implode(' ', $classes), 'style' => $this->style, 'sigil' => $this->workflow ? 'workflow' : null), '');
     $group = new PhabricatorMainMenuGroupView();
     $group->appendChild($item);
     $group->appendChild($label);
     return $group->render();
 }
 public function render()
 {
     $user = $this->user;
     $target_id = celerity_generate_unique_node_id();
     $search_id = $this->getID();
     $input = phutil_render_tag('input', array('type' => 'text', 'name' => 'query', 'id' => $search_id, 'autocomplete' => 'off'));
     $scope = $this->scope;
     $target = javelin_render_tag('div', array('id' => $target_id, 'class' => 'phabricator-main-menu-search-target'), '');
     Javelin::initBehavior('phabricator-search-typeahead', array('id' => $target_id, 'input' => $search_id, 'src' => '/typeahead/common/mainsearch/', 'limit' => 10, 'placeholder' => PhabricatorSearchScope::getScopePlaceholder($scope)));
     $scope_input = phutil_render_tag('input', array('type' => 'hidden', 'name' => 'scope', 'value' => $scope));
     $form = phabricator_render_form($user, array('action' => '/search/', 'method' => 'POST'), '<div class="phabricator-main-menu-search-container">' . $input . '<button>Search</button>' . $scope_input . $target . '</div>');
     $group = new PhabricatorMainMenuGroupView();
     $group->addClass('phabricator-main-menu-search');
     $group->appendChild($form);
     return $group->render();
 }
Ejemplo n.º 3
0
 public function render()
 {
     $user = $this->user;
     require_celerity_resource('phabricator-main-menu-view');
     $header_id = celerity_generate_unique_node_id();
     $extra = '';
     $group = new PhabricatorMainMenuGroupView();
     $group->addClass('phabricator-main-menu-group-logo');
     $group->setCollapsible(false);
     $group->appendChild(phutil_render_tag('a', array('class' => 'phabricator-main-menu-logo', 'href' => '/'), '<span>Phabricator</span>'));
     if (PhabricatorEnv::getEnvConfig('notification.enabled') && $user->isLoggedIn()) {
         list($menu, $dropdown) = $this->renderNotificationMenu();
         $group->appendChild($menu);
         $extra .= $dropdown;
     }
     $group->appendChild(javelin_render_tag('a', array('class' => 'phabricator-main-menu-expand-button', 'sigil' => 'jx-toggle-class', 'meta' => array('map' => array($header_id => 'phabricator-main-menu-reveal'))), '<span>Expand</span>'));
     $logo = $group->render();
     return phutil_render_tag('div', array('class' => 'phabricator-main-menu', 'id' => $header_id), $logo . $this->renderChildren()) . $extra;
 }