mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 13:22:42 +01:00
Minor improvements to Diviner layout
Summary: - Render functions as `func()` for consistency/clarity. - Sort articles first. - Sort case insensitively. - Label the "no group" symbols. Test Plan: Regenerated and examined docs. Reviewers: btrahan, chad Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D8480
This commit is contained in:
parent
8e41315238
commit
a0f534b87c
3 changed files with 22 additions and 3 deletions
|
@ -46,6 +46,7 @@ final class DivinerBookController extends DivinerController {
|
|||
->setViewer($viewer)
|
||||
->withBookPHIDs(array($book->getPHID()))
|
||||
->execute();
|
||||
|
||||
$atoms = msort($atoms, 'getSortKey');
|
||||
|
||||
$group_spec = $book->getConfig('groups');
|
||||
|
@ -64,8 +65,11 @@ final class DivinerBookController extends DivinerController {
|
|||
$out = array();
|
||||
foreach ($groups as $group => $atoms) {
|
||||
$group_name = $book->getGroupName($group);
|
||||
if (!strlen($group_name)) {
|
||||
$group_name = pht('Free Radicals');
|
||||
}
|
||||
$section = id(new DivinerSectionView())
|
||||
->setHeader($group_name);
|
||||
->setHeader($group_name);
|
||||
$section->addContent($this->renderAtomList($atoms));
|
||||
$out[] = $section;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,18 @@ abstract class DivinerController extends PhabricatorController {
|
|||
|
||||
$list = array();
|
||||
foreach ($symbols as $symbol) {
|
||||
|
||||
switch ($symbol->getType()) {
|
||||
case DivinerAtom::TYPE_FUNCTION:
|
||||
$title = $symbol->getTitle().'()';
|
||||
break;
|
||||
default:
|
||||
$title = $symbol->getTitle();
|
||||
break;
|
||||
}
|
||||
|
||||
$item = id(new DivinerBookItemView())
|
||||
->setTitle($symbol->getTitle())
|
||||
->setTitle($title)
|
||||
->setHref($symbol->getURI())
|
||||
->setSubtitle($symbol->getSummary())
|
||||
->setType(DivinerAtom::getAtomTypeNameString(
|
||||
|
|
|
@ -74,7 +74,12 @@ final class DivinerLiveSymbol extends DivinerDAO
|
|||
}
|
||||
|
||||
public function getSortKey() {
|
||||
return $this->getTitle();
|
||||
// Sort articles before other types of content. Then, sort atoms in a
|
||||
// case-insensitive way.
|
||||
return sprintf(
|
||||
'%c:%s',
|
||||
($this->getType() == DivinerAtom::TYPE_ARTICLE ? '0' : '1'),
|
||||
phutil_utf8_strtolower($this->getTitle()));
|
||||
}
|
||||
|
||||
public function save() {
|
||||
|
|
Loading…
Reference in a new issue