From 93f735ed2f58ebfa7c047b2fb4c01c044ecc231d Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 10 Sep 2013 09:39:50 -0700 Subject: [PATCH] Diviner Book Index styles Summary: Slightly more readable, less space than current index. LMK if you hate it though. Test Plan: Look at user and dev book indexes. Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Differential Revision: https://secure.phabricator.com/D6932 --- src/__celerity_resource_map__.php | 2 +- src/__phutil_library_map__.php | 2 + .../diviner/controller/DivinerController.php | 18 ++--- .../diviner/view/DivinerBookItemView.php | 68 +++++++++++++++++++ webroot/rsrc/css/diviner/diviner-shared.css | 34 ++++++++++ 5 files changed, 111 insertions(+), 13 deletions(-) create mode 100644 src/applications/diviner/view/DivinerBookItemView.php diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 14517c1bbd..e123786339 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -1149,7 +1149,7 @@ celerity_register_resource_map(array( ), 'diviner-shared-css' => array( - 'uri' => '/res/7c3cca5f/rsrc/css/diviner/diviner-shared.css', + 'uri' => '/res/bee7ddb9/rsrc/css/diviner/diviner-shared.css', 'type' => 'css', 'requires' => array( diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 65eb7e9464..9dc8368449 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -521,6 +521,7 @@ phutil_register_library_map(array( 'DivinerAtomizeWorkflow' => 'applications/diviner/workflow/DivinerAtomizeWorkflow.php', 'DivinerAtomizer' => 'applications/diviner/atomizer/DivinerAtomizer.php', 'DivinerBookController' => 'applications/diviner/controller/DivinerBookController.php', + 'DivinerBookItemView' => 'applications/diviner/view/DivinerBookItemView.php', 'DivinerBookQuery' => 'applications/diviner/query/DivinerBookQuery.php', 'DivinerController' => 'applications/diviner/controller/DivinerController.php', 'DivinerDAO' => 'applications/diviner/storage/DivinerDAO.php', @@ -2560,6 +2561,7 @@ phutil_register_library_map(array( 'DivinerAtomSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DivinerAtomizeWorkflow' => 'DivinerWorkflow', 'DivinerBookController' => 'DivinerController', + 'DivinerBookItemView' => 'AphrontTagView', 'DivinerBookQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DivinerController' => 'PhabricatorController', 'DivinerDAO' => 'PhabricatorLiskDAO', diff --git a/src/applications/diviner/controller/DivinerController.php b/src/applications/diviner/controller/DivinerController.php index cbe6ee48ec..d501e2e950 100644 --- a/src/applications/diviner/controller/DivinerController.php +++ b/src/applications/diviner/controller/DivinerController.php @@ -27,22 +27,16 @@ abstract class DivinerController extends PhabricatorController { $request = $this->getRequest(); $user = $request->getUser(); - $list = id(new PHUIObjectItemListView()) - ->setUser($user) - ->setPlain(true) - ->setFlush(true); - + $list = array(); foreach ($symbols as $symbol) { - $item = id(new PHUIObjectItemView()) - ->setHeader($symbol->getTitle()) + $item = id(new DivinerBookItemView()) + ->setTitle($symbol->getTitle()) ->setHref($symbol->getURI()) - ->addIcon('none', - DivinerAtom::getAtomTypeNameString( + ->setSubtitle($symbol->getSummary()) + ->setType(DivinerAtom::getAtomTypeNameString( $symbol->getType())); - $item->addAttribute($symbol->getSummary()); - - $list->addItem($item); + $list[] = $item; } return $list; diff --git a/src/applications/diviner/view/DivinerBookItemView.php b/src/applications/diviner/view/DivinerBookItemView.php new file mode 100644 index 0000000000..c90c067dce --- /dev/null +++ b/src/applications/diviner/view/DivinerBookItemView.php @@ -0,0 +1,68 @@ +title = $title; + return $this; + } + + public function setSubtitle($subtitle) { + $this->subtitle = $subtitle; + return $this; + } + + public function setType($type) { + $this->type = $type; + return $this; + } + + public function setHref($href) { + $this->href = $href; + return $this; + } + + public function getTagName() { + return 'a'; + } + + public function getTagAttributes() { + return array( + 'class' => 'diviner-book-item', + 'href' => $this->href, + ); + } + + public function getTagContent() { + require_celerity_resource('diviner-shared-css'); + + $title = phutil_tag( + 'span', + array( + 'class' => 'diviner-book-item-title' + ), + $this->title); + + $subtitle = phutil_tag( + 'span', + array( + 'class' => 'diviner-book-item-subtitle' + ), + $this->subtitle); + + $type = phutil_tag( + 'span', + array( + 'class' => 'diviner-book-item-type' + ), + $this->type); + + return array($title, $type, $subtitle); + } + +} diff --git a/webroot/rsrc/css/diviner/diviner-shared.css b/webroot/rsrc/css/diviner/diviner-shared.css index 503107dc6a..a303c62417 100644 --- a/webroot/rsrc/css/diviner/diviner-shared.css +++ b/webroot/rsrc/css/diviner/diviner-shared.css @@ -117,3 +117,37 @@ body .diviner-document-section .phabricator-header-view { padding-bottom: 4px; } +/* - Book Index ---------------------------------------------------------------- + + How big lists of book indexes get displayed + +*/ + +.diviner-book-item { + display: block; + padding: 4px 16px; + margin: 0 -16px; +} + +.diviner-book-item:hover { + text-decoration: none; +} + +.device-desktop .diviner-book-item:hover { + background-color: {$lightgreybackground}; +} + +.diviner-book-item-title { + font-weight: bold; +} + +.diviner-book-item-type { + color: {$lightgreytext}; + padding-left: 8px +} + +.diviner-book-item-subtitle { + display: block; + line-height: 18px; + color: {$lightbluetext}; +}