mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-15 09:11:07 +01:00
Render Diviner atom signatures on one line
Summary: Ref T988. Instead of rendering this: ClassName final class ClassName methodName final public function methodName(...) ...just render this: final class ClassName final public function methodName(...) Also link and anchor the method names. Test Plan: Before: {F57536} {F57537} After: {F57538} {F57539} Reviewers: chad Reviewed By: chad CC: aran Maniphest Tasks: T988 Differential Revision: https://secure.phabricator.com/D6908
This commit is contained in:
parent
4cc40933c4
commit
2367b64229
3 changed files with 38 additions and 12 deletions
|
@ -1149,7 +1149,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'diviner-shared-css' =>
|
'diviner-shared-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/cf15b860/rsrc/css/diviner/diviner-shared.css',
|
'uri' => '/res/1f75ab71/rsrc/css/diviner/diviner-shared.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -71,13 +71,12 @@ final class DivinerAtomController extends DivinerController {
|
||||||
->setName($atom_short_title));
|
->setName($atom_short_title));
|
||||||
|
|
||||||
$header = id(new PhabricatorHeaderView())
|
$header = id(new PhabricatorHeaderView())
|
||||||
->setHeader($symbol->getTitle())
|
->setHeader($this->renderFullSignature($symbol))
|
||||||
->addTag(
|
->addTag(
|
||||||
id(new PhabricatorTagView())
|
id(new PhabricatorTagView())
|
||||||
->setType(PhabricatorTagView::TYPE_STATE)
|
->setType(PhabricatorTagView::TYPE_STATE)
|
||||||
->setBackgroundColor(PhabricatorTagView::COLOR_BLUE)
|
->setBackgroundColor(PhabricatorTagView::COLOR_BLUE)
|
||||||
->setName(DivinerAtom::getAtomTypeNameString($atom->getType())))
|
->setName(DivinerAtom::getAtomTypeNameString($atom->getType())));
|
||||||
->setSubheader($this->renderFullSignature($symbol));
|
|
||||||
|
|
||||||
$properties = id(new PhabricatorPropertyListView());
|
$properties = id(new PhabricatorPropertyListView());
|
||||||
|
|
||||||
|
@ -180,8 +179,7 @@ final class DivinerAtomController extends DivinerController {
|
||||||
foreach ($methods as $spec) {
|
foreach ($methods as $spec) {
|
||||||
$matom = last($spec['atoms']);
|
$matom = last($spec['atoms']);
|
||||||
$method_header = id(new PhabricatorHeaderView())
|
$method_header = id(new PhabricatorHeaderView())
|
||||||
->setNoBackground(true)
|
->setNoBackground(true);
|
||||||
->setHeader($matom->getName());
|
|
||||||
|
|
||||||
$inherited = $spec['inherited'];
|
$inherited = $spec['inherited'];
|
||||||
if ($inherited) {
|
if ($inherited) {
|
||||||
|
@ -192,8 +190,7 @@ final class DivinerAtomController extends DivinerController {
|
||||||
->setName(pht('Inherited')));
|
->setName(pht('Inherited')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$method_header->setSubheader(
|
$method_header->setHeader($this->renderFullSignature($matom));
|
||||||
$this->renderFullSignature($matom));
|
|
||||||
|
|
||||||
$section->addContent(
|
$section->addContent(
|
||||||
array(
|
array(
|
||||||
|
@ -460,9 +457,25 @@ final class DivinerAtomController extends DivinerController {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out[] = $symbol->getName();
|
$anchor = null;
|
||||||
|
switch ($symbol->getType()) {
|
||||||
|
case DivinerAtom::TYPE_METHOD:
|
||||||
|
$anchor = $symbol->getType().'/'.$symbol->getName();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$out = implode(' ', $out);
|
$out[] = phutil_tag(
|
||||||
|
$anchor ? 'a' : 'span',
|
||||||
|
array(
|
||||||
|
'class' => 'diviner-atom-signature-name',
|
||||||
|
'href' => $anchor ? '#'.$anchor : null,
|
||||||
|
'name' => $anchor,
|
||||||
|
),
|
||||||
|
$symbol->getName());
|
||||||
|
|
||||||
|
$out = phutil_implode_html(' ', $out);
|
||||||
|
|
||||||
$parameters = $atom->getProperty('parameters');
|
$parameters = $atom->getProperty('parameters');
|
||||||
if ($parameters !== null) {
|
if ($parameters !== null) {
|
||||||
|
@ -470,10 +483,15 @@ final class DivinerAtomController extends DivinerController {
|
||||||
foreach ($parameters as $parameter) {
|
foreach ($parameters as $parameter) {
|
||||||
$pout[] = $parameter['name'];
|
$pout[] = $parameter['name'];
|
||||||
}
|
}
|
||||||
$out .= '('.implode(', ', $pout).')';
|
$out = array($out, '('.implode(', ', $pout).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return phutil_tag(
|
||||||
|
'span',
|
||||||
|
array(
|
||||||
|
'class' => 'diviner-atom-signature',
|
||||||
|
),
|
||||||
|
$out);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildParametersAndReturn(array $symbols) {
|
private function buildParametersAndReturn(array $symbols) {
|
||||||
|
|
|
@ -73,3 +73,11 @@
|
||||||
.diviner-method-implementation-header {
|
.diviner-method-implementation-header {
|
||||||
color: {$lightgreytext};
|
color: {$lightgreytext};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.diviner-atom-signature {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diviner-atom-signature-name {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue