mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
b73622b866
Summary: My claims that this worked on D4183 were incorrect: - Make it work. - Then use it. - Also make cancel URI not cancel to the same page. Test Plan: Clicked "Create Document", got a workflow on-page dialog instead of a page transition. Reviewers: codeblock Reviewed By: codeblock CC: aran Differential Revision: https://secure.phabricator.com/D4403
72 lines
1.7 KiB
PHP
72 lines
1.7 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCrumbsView extends AphrontView {
|
|
|
|
private $crumbs = array();
|
|
private $actions = array();
|
|
|
|
protected function canAppendChild() {
|
|
return false;
|
|
}
|
|
|
|
public function addCrumb(PhabricatorCrumbView $crumb) {
|
|
$this->crumbs[] = $crumb;
|
|
return $this;
|
|
}
|
|
|
|
|
|
public function addAction(PhabricatorMenuItemView $action) {
|
|
$this->actions[] = $action;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function render() {
|
|
require_celerity_resource('phabricator-crumbs-view-css');
|
|
|
|
$action_view = null;
|
|
if ($this->actions) {
|
|
$actions = array();
|
|
foreach ($this->actions as $action) {
|
|
$icon = null;
|
|
if ($action->getIcon()) {
|
|
$icon = phutil_render_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'sprite-icon action-'.$action->getIcon(),
|
|
),
|
|
'');
|
|
}
|
|
$actions[] = javelin_render_tag(
|
|
'a',
|
|
array(
|
|
'href' => $action->getHref(),
|
|
'class' => 'phabricator-crumbs-action',
|
|
'sigil' => $action->getWorkflow() ? 'workflow' : null,
|
|
),
|
|
$icon.phutil_escape_html($action->getName()));
|
|
}
|
|
|
|
$action_view = phutil_render_tag(
|
|
'div',
|
|
array(
|
|
'class' => 'phabricator-crumbs-actions',
|
|
),
|
|
self::renderSingleView($actions));
|
|
}
|
|
|
|
if ($this->crumbs) {
|
|
last($this->crumbs)->setIsLastCrumb(true);
|
|
}
|
|
|
|
return phutil_render_tag(
|
|
'div',
|
|
array(
|
|
'class' => 'phabricator-crumbs-view '.
|
|
'sprite-gradient gradient-breadcrumbs',
|
|
),
|
|
$action_view.
|
|
self::renderSingleView($this->crumbs));
|
|
}
|
|
|
|
}
|