@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add PHUIStatusListView

Summary: For Diffusion's auditors list, and Differential's reviewers list (eventually). An inline option might make more sense in Differential, but I want to use this in Diffusion first, and we need more information there.

Test Plan: {F51424}

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6559

+263 -7
+9
src/__celerity_resource_map__.php
··· 3873 3873 ), 3874 3874 'disk' => '/rsrc/css/phui/phui-spacing.css', 3875 3875 ), 3876 + 'phui-status-list-view-css' => 3877 + array( 3878 + 'uri' => '/res/a91b3fbe/rsrc/css/phui/phui-status.css', 3879 + 'type' => 'css', 3880 + 'requires' => 3881 + array( 3882 + ), 3883 + 'disk' => '/rsrc/css/phui/phui-status.css', 3884 + ), 3876 3885 'phui-text-css' => 3877 3886 array( 3878 3887 'uri' => '/res/63e53cac/rsrc/css/phui/phui-text.css',
+6
src/__phutil_library_map__.php
··· 742 742 'PHUIListView' => 'view/phui/PHUIListView.php', 743 743 'PHUIListViewTestCase' => 'view/layout/__tests__/PHUIListViewTestCase.php', 744 744 'PHUIPagedFormView' => 'view/form/PHUIPagedFormView.php', 745 + 'PHUIStatusItemView' => 'view/phui/PHUIStatusItemView.php', 746 + 'PHUIStatusListView' => 'view/phui/PHUIStatusListView.php', 745 747 'PHUITextExample' => 'applications/uiexample/examples/PHUITextExample.php', 746 748 'PHUITextView' => 'view/phui/PHUITextView.php', 747 749 'PackageCreateMail' => 'applications/owners/mail/PackageCreateMail.php', ··· 1636 1638 'PhabricatorUIListFilterExample' => 'applications/uiexample/examples/PhabricatorUIListFilterExample.php', 1637 1639 'PhabricatorUINotificationExample' => 'applications/uiexample/examples/PhabricatorUINotificationExample.php', 1638 1640 'PhabricatorUIPagerExample' => 'applications/uiexample/examples/PhabricatorUIPagerExample.php', 1641 + 'PhabricatorUIStatusExample' => 'applications/uiexample/examples/PhabricatorUIStatusExample.php', 1639 1642 'PhabricatorUITooltipExample' => 'applications/uiexample/examples/PhabricatorUITooltipExample.php', 1640 1643 'PhabricatorUnitsTestCase' => 'view/__tests__/PhabricatorUnitsTestCase.php', 1641 1644 'PhabricatorUser' => 'applications/people/storage/PhabricatorUser.php', ··· 2722 2725 'PHUIListView' => 'AphrontTagView', 2723 2726 'PHUIListViewTestCase' => 'PhabricatorTestCase', 2724 2727 'PHUIPagedFormView' => 'AphrontTagView', 2728 + 'PHUIStatusItemView' => 'AphrontTagView', 2729 + 'PHUIStatusListView' => 'AphrontTagView', 2725 2730 'PHUITextExample' => 'PhabricatorUIExample', 2726 2731 'PHUITextView' => 'AphrontTagView', 2727 2732 'PackageCreateMail' => 'PackageMail', ··· 3661 3666 'PhabricatorUIListFilterExample' => 'PhabricatorUIExample', 3662 3667 'PhabricatorUINotificationExample' => 'PhabricatorUIExample', 3663 3668 'PhabricatorUIPagerExample' => 'PhabricatorUIExample', 3669 + 'PhabricatorUIStatusExample' => 'PhabricatorUIExample', 3664 3670 'PhabricatorUITooltipExample' => 'PhabricatorUIExample', 3665 3671 'PhabricatorUnitsTestCase' => 'PhabricatorTestCase', 3666 3672 'PhabricatorUser' =>
+79
src/applications/uiexample/examples/PhabricatorUIStatusExample.php
··· 1 + <?php 2 + 3 + final class PhabricatorUIStatusExample extends PhabricatorUIExample { 4 + 5 + public function getName() { 6 + return 'Status List'; 7 + } 8 + 9 + public function getDescription() { 10 + return hsprintf( 11 + 'Use <tt>PHUIStatusListView</tt> to show relationships with objects.'); 12 + } 13 + 14 + public function renderExample() { 15 + 16 + $out = array(); 17 + 18 + $view = new PHUIStatusListView(); 19 + 20 + $view->addItem( 21 + id(new PHUIStatusItemView()) 22 + ->setIcon('accept-green', pht('Yum')) 23 + ->setTarget(pht('Apple')) 24 + ->setNote(pht('You can eat them.'))); 25 + 26 + $view->addItem( 27 + id(new PHUIStatusItemView()) 28 + ->setIcon('add-blue', pht('Has Peel')) 29 + ->setTarget(pht('Banana')) 30 + ->setNote(pht('Comes in bunches.')) 31 + ->setHighlighted(true)); 32 + 33 + $view->addItem( 34 + id(new PHUIStatusItemView()) 35 + ->setIcon('warning-dark', pht('Caution')) 36 + ->setTarget(pht('Pomegranite')) 37 + ->setNote(pht('Lots of seeds. Watch out.'))); 38 + 39 + $view->addItem( 40 + id(new PHUIStatusItemView()) 41 + ->setIcon('reject-red', pht('Bleh!')) 42 + ->setTarget(pht('Zucchini')) 43 + ->setNote(pht('Slimy and gross. Yuck!'))); 44 + 45 + $out[] = id(new PhabricatorHeaderView()) 46 + ->setHeader(pht('Fruit and Vegetable Status')); 47 + 48 + $out[] = id(new PHUIBoxView()) 49 + ->addMargin(PHUI::MARGIN_LARGE) 50 + ->addPadding(PHUI::PADDING_LARGE) 51 + ->setShadow(true) 52 + ->appendChild($view); 53 + 54 + 55 + $view = new PHUIStatusListView(); 56 + 57 + $manifest = PHUIIconView::getSheetManifest(PHUIIconView::SPRITE_STATUS); 58 + 59 + foreach ($manifest as $sprite) { 60 + $name = substr($sprite['name'], strlen('status-')); 61 + 62 + $view->addItem( 63 + id(new PHUIStatusItemView()) 64 + ->setIcon($name) 65 + ->setTarget($name)); 66 + } 67 + 68 + $out[] = id(new PhabricatorHeaderView()) 69 + ->setHeader(pht('All Icons')); 70 + 71 + $out[] = id(new PHUIBoxView()) 72 + ->addMargin(PHUI::MARGIN_LARGE) 73 + ->addPadding(PHUI::PADDING_LARGE) 74 + ->setShadow(true) 75 + ->appendChild($view); 76 + 77 + return $out; 78 + } 79 + }
+2 -5
src/view/layout/PhabricatorActionView.php
··· 161 161 } 162 162 163 163 public static function getAvailableIcons() { 164 - $root = dirname(phutil_get_library_root('phabricator')); 165 - $path = $root.'/resources/sprite/manifest/icons.json'; 166 - $data = Filesystem::readFile($path); 167 - $manifest = json_decode($data, true); 164 + $manifest = PHUIIconView::getSheetManifest(PHUIIconView::SPRITE_ICONS); 168 165 169 166 $results = array(); 170 167 $prefix = 'icons-'; 171 - foreach ($manifest['sprites'] as $sprite) { 168 + foreach ($manifest as $sprite) { 172 169 $name = $sprite['name']; 173 170 if (preg_match('/-(white|grey)$/', $name)) { 174 171 continue;
+10
src/view/phui/PHUIIconView.php
··· 9 9 const SPRITE_PAYMENTS = 'payments'; 10 10 const SPRITE_ICONS = 'icons'; 11 11 const SPRITE_LOGIN = 'login'; 12 + const SPRITE_STATUS = 'status'; 12 13 13 14 const HEAD_SMALL = 'phuihead-small'; 14 15 const HEAD_MEDIUM = 'phuihead-medium'; ··· 76 77 'class' => $classes, 77 78 ); 78 79 } 80 + 81 + public static function getSheetManifest($sheet) { 82 + $root = dirname(phutil_get_library_root('phabricator')); 83 + $path = $root.'/resources/sprite/manifest/'.$sheet.'.json'; 84 + $data = Filesystem::readFile($path); 85 + return idx(json_decode($data, true), 'sprites'); 86 + } 87 + 88 + 79 89 }
-2
src/view/phui/PHUIListItemView.php
··· 17 17 private $key; 18 18 private $icon; 19 19 private $selected; 20 - private $containerAttrs; 21 20 private $disabled; 22 21 private $renderNameAsTooltip; 23 - 24 22 25 23 public function setRenderNameAsTooltip($render_name_as_tooltip) { 26 24 $this->renderNameAsTooltip = $render_name_as_tooltip;
+94
src/view/phui/PHUIStatusItemView.php
··· 1 + <?php 2 + 3 + final class PHUIStatusItemView extends AphrontTagView { 4 + 5 + private $icon; 6 + private $iconLabel; 7 + private $target; 8 + private $note; 9 + private $highlighted; 10 + 11 + public function setIcon($icon, $label = null) { 12 + $this->icon = $icon; 13 + $this->iconLabel = $label; 14 + return $this; 15 + } 16 + 17 + public function setTarget($target) { 18 + $this->target = $target; 19 + return $this; 20 + } 21 + 22 + public function setNote($note) { 23 + $this->note = $note; 24 + return $this; 25 + } 26 + 27 + public function setHighlighted($highlighted) { 28 + $this->highlighted = $highlighted; 29 + return $this; 30 + } 31 + 32 + protected function canAppendChild() { 33 + return false; 34 + } 35 + 36 + protected function getTagName() { 37 + return 'tr'; 38 + } 39 + 40 + protected function getTagAttributes() { 41 + $classes = array(); 42 + if ($this->highlighted) { 43 + $classes[] = 'phui-status-item-highlighted'; 44 + } 45 + 46 + return array( 47 + 'class' => $classes, 48 + ); 49 + } 50 + 51 + protected function getTagContent() { 52 + 53 + $icon = null; 54 + if ($this->icon) { 55 + $icon = id(new PHUIIconView()) 56 + ->setSpriteSheet(PHUIIconView::SPRITE_STATUS) 57 + ->setSpriteIcon($this->icon); 58 + 59 + if ($this->iconLabel) { 60 + Javelin::initBehavior('phabricator-tooltips'); 61 + $icon->addSigil('has-tooltip'); 62 + $icon->setMetadata( 63 + array( 64 + 'tip' => $this->iconLabel, 65 + )); 66 + } 67 + } 68 + 69 + $icon_cell = phutil_tag( 70 + 'td', 71 + array(), 72 + $icon); 73 + 74 + $target_cell = phutil_tag( 75 + 'td', 76 + array( 77 + 'class' => 'phui-status-item-target', 78 + ), 79 + $this->target); 80 + 81 + $note_cell = phutil_tag( 82 + 'td', 83 + array( 84 + 'class' => 'phui-status-item-note', 85 + ), 86 + $this->note); 87 + 88 + return array( 89 + $icon_cell, 90 + $target_cell, 91 + $note_cell, 92 + ); 93 + } 94 + }
+33
src/view/phui/PHUIStatusListView.php
··· 1 + <?php 2 + 3 + final class PHUIStatusListView extends AphrontTagView { 4 + 5 + private $items; 6 + 7 + public function addItem(PHUIStatusItemView $item) { 8 + $this->items[] = $item; 9 + } 10 + 11 + protected function canAppendChild() { 12 + return false; 13 + } 14 + 15 + public function getTagName() { 16 + return 'table'; 17 + } 18 + 19 + protected function getTagAttributes() { 20 + require_celerity_resource('phui-status-list-view-css'); 21 + 22 + $classes = array(); 23 + $classes[] = 'phui-status-list-view'; 24 + 25 + return array( 26 + 'class' => implode(' ', $classes), 27 + ); 28 + } 29 + 30 + protected function getTagContent() { 31 + return $this->items; 32 + } 33 + }
+30
webroot/rsrc/css/phui/phui-status.css
··· 1 + /** 2 + * @provides phui-status-list-view-css 3 + */ 4 + 5 + .phui-status-list-view { 6 + width: 100%; 7 + } 8 + 9 + .phui-status-list-view .phui-icon-view { 10 + display: block; 11 + width: 14px; 12 + height: 14px; 13 + margin: 4px 4px; 14 + } 15 + 16 + .phui-status-item-target { 17 + padding: 0 12px 0 4px; 18 + line-height: 22px; 19 + white-space: nowrap; 20 + } 21 + 22 + .phui-status-item-note { 23 + width: 100%; 24 + color: #666666; 25 + line-height: 22px; 26 + } 27 + 28 + .phui-status-item-highlighted { 29 + background-color: {$lightyellow}; 30 + }