protected function buildCrumbs($sprite, $uri) { $crumbs = array(); $crumbs[] = id(new PHUICrumbView())->setHref($uri)->setAural($sprite)->setIcon($sprite); $view = new PHUICrumbsView(); foreach ($crumbs as $crumb) { $view->addCrumb($crumb); } return $view; }
protected function buildApplicationCrumbs() { $crumbs = array(); $application = $this->getCurrentApplication(); if ($application) { $icon = $application->getFontIcon(); if (!$icon) { $icon = 'fa-puzzle'; } $crumbs[] = id(new PHUICrumbView())->setHref($this->getApplicationURI())->setName($application->getName())->setIcon($icon); } $view = new PHUICrumbsView(); foreach ($crumbs as $crumb) { $view->addCrumb($crumb); } return $view; }
public final function addActionToCrumbs(PHUICrumbsView $crumbs) { $viewer = $this->getViewer(); $can_create = $this->hasCreateCapability(); if ($can_create) { $configs = $this->loadUsableConfigurationsForCreate(); } else { $configs = array(); } $dropdown = null; $disabled = false; $workflow = false; $menu_icon = 'fa-plus-square'; if (!$configs) { if ($viewer->isLoggedIn()) { $disabled = true; } else { // If the viewer isn't logged in, assume they'll get hit with a login // dialog and are likely able to create objects after they log in. $disabled = false; } $workflow = true; if ($can_create) { $create_uri = $this->getEditURI(null, 'nodefault/'); } else { $create_uri = $this->getEditURI(null, 'nocreate/'); } } else { $config = head($configs); $form_key = $config->getIdentifier(); $create_uri = $this->getEditURI(null, "form/{$form_key}/"); if (count($configs) > 1) { $menu_icon = 'fa-caret-square-o-down'; $dropdown = id(new PhabricatorActionListView())->setUser($viewer); foreach ($configs as $config) { $form_key = $config->getIdentifier(); $config_uri = $this->getEditURI(null, "form/{$form_key}/"); $item_icon = 'fa-plus'; $dropdown->addAction(id(new PhabricatorActionView())->setName($config->getDisplayName())->setIcon($item_icon)->setHref($config_uri)); } } } $action = id(new PHUIListItemView())->setName($this->getObjectCreateShortText())->setHref($create_uri)->setIcon($menu_icon)->setWorkflow($workflow)->setDisabled($disabled); if ($dropdown) { $action->setDropdownMenu($dropdown); } $crumbs->addAction($action); }
protected function buildApplicationCrumbs() { $blog = $this->getBlog(); $post = $this->getPost(); $is_live = $this->getIsLive(); $is_external = $this->getIsExternal(); // If this is an external view, don't put the "Phame" crumb or the // "Blogs" crumb into the crumbs list. if ($is_external) { $crumbs = new PHUICrumbsView(); // Link back to parent site if ($blog->getParentSite() && $blog->getParentDomain()) { $crumbs->addTextCrumb($blog->getParentSite(), $blog->getExternalParentURI()); } } else { $crumbs = parent::buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Blogs'), $this->getApplicationURI('blog/')); } $crumbs->setBorder(true); if ($blog) { if ($post) { if ($is_live) { if ($is_external) { $blog_uri = $blog->getExternalLiveURI(); } else { $blog_uri = $blog->getInternalLiveURI(); } } else { $blog_uri = $blog->getViewURI(); } } else { $blog_uri = null; } $crumbs->addTextCrumb($blog->getName(), $blog_uri); } if ($post) { if (!$is_external) { $crumbs->addTextCrumb('J' . $post->getID()); } } return $crumbs; }
protected function addApplicationCrumb(PHUICrumbsView $crumbs, PhabricatorApplication $application) { $crumbs->addTextCrumb($application->getName(), '/applications/view/' . get_class($application) . '/'); }
protected function addBuildableCrumb(PHUICrumbsView $crumbs, HarbormasterBuildable $buildable) { $monogram = $buildable->getMonogram(); $uri = '/' . $monogram; $crumbs->addTextCrumb($monogram, $uri); }
public final function addActionToCrumbs(PHUICrumbsView $crumbs, array $parameters = array()) { $viewer = $this->getViewer(); $specs = $this->newCreateActionSpecifications($parameters); $head = head($specs); $menu_uri = $head['uri']; $dropdown = null; if (count($specs) > 1) { $menu_icon = 'fa-caret-square-o-down'; $menu_name = $this->getObjectCreateShortText(); $workflow = false; $disabled = false; $dropdown = id(new PhabricatorActionListView())->setUser($viewer); foreach ($specs as $spec) { $dropdown->addAction(id(new PhabricatorActionView())->setName($spec['name'])->setIcon($spec['icon'])->setHref($spec['uri'])->setDisabled($head['disabled'])->setWorkflow($head['workflow'])); } } else { $menu_icon = $head['icon']; $menu_name = $head['name']; $workflow = $head['workflow']; $disabled = $head['disabled']; } $action = id(new PHUIListItemView())->setName($menu_name)->setHref($menu_uri)->setIcon($menu_icon)->setWorkflow($workflow)->setDisabled($disabled); if ($dropdown) { $action->setDropdownMenu($dropdown); } $crumbs->addAction($action); }