Page MenuHomePhabricator

D8480.id20108.diff
No OneTemporary

D8480.id20108.diff

diff --git a/src/applications/diviner/controller/DivinerBookController.php b/src/applications/diviner/controller/DivinerBookController.php
--- a/src/applications/diviner/controller/DivinerBookController.php
+++ b/src/applications/diviner/controller/DivinerBookController.php
@@ -46,6 +46,7 @@
->setViewer($viewer)
->withBookPHIDs(array($book->getPHID()))
->execute();
+
$atoms = msort($atoms, 'getSortKey');
$group_spec = $book->getConfig('groups');
@@ -64,8 +65,11 @@
$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;
}
diff --git a/src/applications/diviner/controller/DivinerController.php b/src/applications/diviner/controller/DivinerController.php
--- a/src/applications/diviner/controller/DivinerController.php
+++ b/src/applications/diviner/controller/DivinerController.php
@@ -29,8 +29,18 @@
$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(
diff --git a/src/applications/diviner/storage/DivinerLiveSymbol.php b/src/applications/diviner/storage/DivinerLiveSymbol.php
--- a/src/applications/diviner/storage/DivinerLiveSymbol.php
+++ b/src/applications/diviner/storage/DivinerLiveSymbol.php
@@ -74,7 +74,12 @@
}
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() {

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 19, 2:59 PM (6 h, 26 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7002849
Default Alt Text
D8480.id20108.diff (2 KB)

Event Timeline