mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Fix AphrontCrumbView (phutil_tag)
Summary: Proper fix is to do some layout work in Diffusion. Short of that, make this escape properly. Test Plan: Viewed various crumbs, no more overescaping for non-diffusion crumbs. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4641
This commit is contained in:
parent
b9f394164f
commit
a1ff679f41
2 changed files with 15 additions and 25 deletions
|
@ -246,9 +246,9 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
break;
|
break;
|
||||||
case 'change':
|
case 'change':
|
||||||
$view_name = 'Change';
|
$view_name = 'Change';
|
||||||
$crumb_list[] = $crumb->setRawName(
|
$crumb_list[] = $crumb->setName(
|
||||||
phutil_escape_html($path).' ('.$commit_link.')'
|
phutil_safe_html(
|
||||||
);
|
phutil_escape_html($path).' ('.$commit_link.')'));
|
||||||
return $crumb_list;
|
return $crumb_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
$path_sections = '/'.implode('/', $path_sections);
|
$path_sections = '/'.implode('/', $path_sections);
|
||||||
|
|
||||||
$crumb_list[] = id(new PhabricatorCrumbView())
|
$crumb_list[] = id(new PhabricatorCrumbView())
|
||||||
->setRawName($path_sections);
|
->setName(phutil_safe_html($path_sections));
|
||||||
}
|
}
|
||||||
|
|
||||||
$last_crumb = array_pop($crumb_list);
|
$last_crumb = array_pop($crumb_list);
|
||||||
|
@ -308,13 +308,14 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
) + $uri_params),
|
) + $uri_params),
|
||||||
),
|
),
|
||||||
'Jump to HEAD');
|
'Jump to HEAD');
|
||||||
$last_crumb->setRawName(
|
|
||||||
$last_crumb->getNameForRender() . " @ {$commit_link} ({$jump_link})"
|
$name = $last_crumb->getName();
|
||||||
);
|
$name = phutil_safe_html($name." @ {$commit_link} ({$jump_link})");
|
||||||
|
$last_crumb->setName($name);
|
||||||
} else if ($spec['view'] != 'lint') {
|
} else if ($spec['view'] != 'lint') {
|
||||||
$last_crumb->setRawName(
|
$name = $last_crumb->getName();
|
||||||
$last_crumb->getNameForRender() . " @ HEAD"
|
$name = phutil_safe_html($name.' @ HEAD');
|
||||||
);
|
$last_crumb->setName($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$crumb_list[] = $last_crumb;
|
$crumb_list[] = $last_crumb;
|
||||||
|
|
|
@ -6,25 +6,14 @@ final class PhabricatorCrumbView extends AphrontView {
|
||||||
private $href;
|
private $href;
|
||||||
private $icon;
|
private $icon;
|
||||||
private $isLastCrumb;
|
private $isLastCrumb;
|
||||||
private $rawName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows for custom HTML inside the name field.
|
|
||||||
*
|
|
||||||
* NOTE: you must handle escaping user text if you use this method.
|
|
||||||
*/
|
|
||||||
public function setRawName($raw_name) {
|
|
||||||
$this->rawName = $raw_name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNameForRender() {
|
public function getName() {
|
||||||
return nonempty($this->rawName, phutil_escape_html($this->name));
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setHref($href) {
|
public function setHref($href) {
|
||||||
|
@ -63,12 +52,12 @@ final class PhabricatorCrumbView extends AphrontView {
|
||||||
'');
|
'');
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = phutil_render_tag(
|
$name = phutil_tag(
|
||||||
'span',
|
'span',
|
||||||
array(
|
array(
|
||||||
'class' => 'phabricator-crumb-name',
|
'class' => 'phabricator-crumb-name',
|
||||||
),
|
),
|
||||||
$this->getNameForRender());
|
$this->name);
|
||||||
|
|
||||||
$divider = null;
|
$divider = null;
|
||||||
if (!$this->isLastCrumb) {
|
if (!$this->isLastCrumb) {
|
||||||
|
|
Loading…
Reference in a new issue