mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +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' =>
|
'diviner-shared-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/7c3cca5f/rsrc/css/diviner/diviner-shared.css',
|
'uri' => '/res/bee7ddb9/rsrc/css/diviner/diviner-shared.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -521,6 +521,7 @@ phutil_register_library_map(array(
|
||||||
'DivinerAtomizeWorkflow' => 'applications/diviner/workflow/DivinerAtomizeWorkflow.php',
|
'DivinerAtomizeWorkflow' => 'applications/diviner/workflow/DivinerAtomizeWorkflow.php',
|
||||||
'DivinerAtomizer' => 'applications/diviner/atomizer/DivinerAtomizer.php',
|
'DivinerAtomizer' => 'applications/diviner/atomizer/DivinerAtomizer.php',
|
||||||
'DivinerBookController' => 'applications/diviner/controller/DivinerBookController.php',
|
'DivinerBookController' => 'applications/diviner/controller/DivinerBookController.php',
|
||||||
|
'DivinerBookItemView' => 'applications/diviner/view/DivinerBookItemView.php',
|
||||||
'DivinerBookQuery' => 'applications/diviner/query/DivinerBookQuery.php',
|
'DivinerBookQuery' => 'applications/diviner/query/DivinerBookQuery.php',
|
||||||
'DivinerController' => 'applications/diviner/controller/DivinerController.php',
|
'DivinerController' => 'applications/diviner/controller/DivinerController.php',
|
||||||
'DivinerDAO' => 'applications/diviner/storage/DivinerDAO.php',
|
'DivinerDAO' => 'applications/diviner/storage/DivinerDAO.php',
|
||||||
|
@ -2560,6 +2561,7 @@ phutil_register_library_map(array(
|
||||||
'DivinerAtomSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'DivinerAtomSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'DivinerAtomizeWorkflow' => 'DivinerWorkflow',
|
'DivinerAtomizeWorkflow' => 'DivinerWorkflow',
|
||||||
'DivinerBookController' => 'DivinerController',
|
'DivinerBookController' => 'DivinerController',
|
||||||
|
'DivinerBookItemView' => 'AphrontTagView',
|
||||||
'DivinerBookQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DivinerBookQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'DivinerController' => 'PhabricatorController',
|
'DivinerController' => 'PhabricatorController',
|
||||||
'DivinerDAO' => 'PhabricatorLiskDAO',
|
'DivinerDAO' => 'PhabricatorLiskDAO',
|
||||||
|
|
|
@ -27,22 +27,16 @@ abstract class DivinerController extends PhabricatorController {
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
$list = array();
|
||||||
->setUser($user)
|
|
||||||
->setPlain(true)
|
|
||||||
->setFlush(true);
|
|
||||||
|
|
||||||
foreach ($symbols as $symbol) {
|
foreach ($symbols as $symbol) {
|
||||||
$item = id(new PHUIObjectItemView())
|
$item = id(new DivinerBookItemView())
|
||||||
->setHeader($symbol->getTitle())
|
->setTitle($symbol->getTitle())
|
||||||
->setHref($symbol->getURI())
|
->setHref($symbol->getURI())
|
||||||
->addIcon('none',
|
->setSubtitle($symbol->getSummary())
|
||||||
DivinerAtom::getAtomTypeNameString(
|
->setType(DivinerAtom::getAtomTypeNameString(
|
||||||
$symbol->getType()));
|
$symbol->getType()));
|
||||||
|
|
||||||
$item->addAttribute($symbol->getSummary());
|
$list[] = $item;
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $list;
|
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;
|
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