1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +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:
epriestley 2014-03-10 17:59:13 -07:00
parent 8e41315238
commit a0f534b87c
3 changed files with 22 additions and 3 deletions

View file

@ -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,6 +65,9 @@ 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);
$section->addContent($this->renderAtomList($atoms));

View file

@ -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(

View file

@ -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() {