1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +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:
epriestley 2013-09-08 09:11:59 -07:00
parent 4cc40933c4
commit 2367b64229
3 changed files with 38 additions and 12 deletions

View file

@ -1149,7 +1149,7 @@ celerity_register_resource_map(array(
),
'diviner-shared-css' =>
array(
'uri' => '/res/cf15b860/rsrc/css/diviner/diviner-shared.css',
'uri' => '/res/1f75ab71/rsrc/css/diviner/diviner-shared.css',
'type' => 'css',
'requires' =>
array(

View file

@ -71,13 +71,12 @@ final class DivinerAtomController extends DivinerController {
->setName($atom_short_title));
$header = id(new PhabricatorHeaderView())
->setHeader($symbol->getTitle())
->setHeader($this->renderFullSignature($symbol))
->addTag(
id(new PhabricatorTagView())
->setType(PhabricatorTagView::TYPE_STATE)
->setBackgroundColor(PhabricatorTagView::COLOR_BLUE)
->setName(DivinerAtom::getAtomTypeNameString($atom->getType())))
->setSubheader($this->renderFullSignature($symbol));
->setName(DivinerAtom::getAtomTypeNameString($atom->getType())));
$properties = id(new PhabricatorPropertyListView());
@ -180,8 +179,7 @@ final class DivinerAtomController extends DivinerController {
foreach ($methods as $spec) {
$matom = last($spec['atoms']);
$method_header = id(new PhabricatorHeaderView())
->setNoBackground(true)
->setHeader($matom->getName());
->setNoBackground(true);
$inherited = $spec['inherited'];
if ($inherited) {
@ -192,8 +190,7 @@ final class DivinerAtomController extends DivinerController {
->setName(pht('Inherited')));
}
$method_header->setSubheader(
$this->renderFullSignature($matom));
$method_header->setHeader($this->renderFullSignature($matom));
$section->addContent(
array(
@ -460,9 +457,25 @@ final class DivinerAtomController extends DivinerController {
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');
if ($parameters !== null) {
@ -470,10 +483,15 @@ final class DivinerAtomController extends DivinerController {
foreach ($parameters as $parameter) {
$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) {

View file

@ -73,3 +73,11 @@
.diviner-method-implementation-header {
color: {$lightgreytext};
}
.diviner-atom-signature {
font-weight: normal;
}
.diviner-atom-signature-name {
font-weight: bold;
}