mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 16:30:59 +01:00
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
This commit is contained in:
parent
ab1f8fa7a4
commit
93f735ed2f
5 changed files with 111 additions and 13 deletions
|
@ -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(
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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;
|
||||
|
|
68
src/applications/diviner/view/DivinerBookItemView.php
Normal file
68
src/applications/diviner/view/DivinerBookItemView.php
Normal file
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
final class DivinerBookItemView extends AphrontTagView {
|
||||
|
||||
private $title;
|
||||
private $subtitle;
|
||||
private $type;
|
||||
private $href;
|
||||
|
||||
public function setTitle($title) {
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue