From 2ad521b96d39db43a86dd68acf3d0e463e632ea7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 May 2017 16:05:03 -0700 Subject: [PATCH] Categorize UIExamples a little bit Summary: Ref M1476. I'm planning to add some PHUIX examples, but sort out the existing examples a little first. I added some categories: - Catalogs: these are what I look at most often (emoji, icons, colors). - Single use: elements with only one use (badges, feed stories, hovercards, setup issues). - Technical: examples which are really just "test this thing in the browser" (avatars, gestures, notifications, remarkup). - Other: evrything else, mostly general-purpose multi-use components. Test Plan: (See left nav.) {F4984042} Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18050 --- src/__phutil_library_map__.php | 2 -- .../PhabricatorUIExampleRenderController.php | 11 ++++++++--- .../examples/JavelinViewExampleServerView.php | 14 -------------- .../uiexample/examples/MacroEmojiExample.php | 8 ++++++-- .../uiexample/examples/PHUIBadgeExample.php | 4 ++++ .../examples/PHUIColorPalletteExample.php | 4 ++++ .../uiexample/examples/PHUIFeedStoryExample.php | 6 +++++- .../uiexample/examples/PHUIHovercardUIExample.php | 4 ++++ .../uiexample/examples/PHUIIconExample.php | 4 ++++ .../PhabricatorFilesComposeAvatarExample.php | 6 +++++- .../examples/PhabricatorGestureUIExample.php | 4 ++++ .../examples/PhabricatorNotificationUIExample.php | 4 ++++ .../examples/PhabricatorRemarkupUIExample.php | 4 ++++ .../examples/PhabricatorSetupIssueUIExample.php | 4 ++++ .../uiexample/examples/PhabricatorUIExample.php | 4 ++++ 15 files changed, 60 insertions(+), 23 deletions(-) delete mode 100644 src/applications/uiexample/examples/JavelinViewExampleServerView.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 7516619a01..5bf2681b1f 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1395,7 +1395,6 @@ phutil_register_library_map(array( 'HeraldTranscriptTestCase' => 'applications/herald/storage/__tests__/HeraldTranscriptTestCase.php', 'HeraldUtilityActionGroup' => 'applications/herald/action/HeraldUtilityActionGroup.php', 'Javelin' => 'infrastructure/javelin/Javelin.php', - 'JavelinViewExampleServerView' => 'applications/uiexample/examples/JavelinViewExampleServerView.php', 'LegalpadController' => 'applications/legalpad/controller/LegalpadController.php', 'LegalpadCreateDocumentsCapability' => 'applications/legalpad/capability/LegalpadCreateDocumentsCapability.php', 'LegalpadDAO' => 'applications/legalpad/storage/LegalpadDAO.php', @@ -6475,7 +6474,6 @@ phutil_register_library_map(array( 'HeraldTranscriptTestCase' => 'PhabricatorTestCase', 'HeraldUtilityActionGroup' => 'HeraldActionGroup', 'Javelin' => 'Phobject', - 'JavelinViewExampleServerView' => 'AphrontView', 'LegalpadController' => 'PhabricatorController', 'LegalpadCreateDocumentsCapability' => 'PhabricatorPolicyCapability', 'LegalpadDAO' => 'PhabricatorLiskDAO', diff --git a/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php b/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php index 6be978a6a9..025b9511b4 100644 --- a/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php +++ b/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php @@ -17,9 +17,14 @@ final class PhabricatorUIExampleRenderController extends PhabricatorController { $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/'))); - foreach ($classes as $class => $obj) { - $name = $obj->getName(); - $nav->addFilter($class, $name); + $groups = mgroup($classes, 'getCategory'); + ksort($groups); + foreach ($groups as $group => $group_classes) { + $nav->addLabel($group); + foreach ($group_classes as $class => $obj) { + $name = $obj->getName(); + $nav->addFilter($class, $name); + } } $selected = $nav->selectFilter($id, head_key($classes)); diff --git a/src/applications/uiexample/examples/JavelinViewExampleServerView.php b/src/applications/uiexample/examples/JavelinViewExampleServerView.php deleted file mode 100644 index 2d59917a7c..0000000000 --- a/src/applications/uiexample/examples/JavelinViewExampleServerView.php +++ /dev/null @@ -1,14 +0,0 @@ - 'server-view', - ), - $this->renderChildren()); - } - -} diff --git a/src/applications/uiexample/examples/MacroEmojiExample.php b/src/applications/uiexample/examples/MacroEmojiExample.php index fddf20bc32..036a5a8932 100644 --- a/src/applications/uiexample/examples/MacroEmojiExample.php +++ b/src/applications/uiexample/examples/MacroEmojiExample.php @@ -3,11 +3,15 @@ final class MacroEmojiExample extends PhabricatorUIExample { public function getName() { - return pht('Emoji Support'); + return pht('Emoji'); } public function getDescription() { - return pht('Shiny happy people holding hands'); + return pht('Shiny happy people holding hands.'); + } + + public function getCategory() { + return pht('Catalogs'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PHUIBadgeExample.php b/src/applications/uiexample/examples/PHUIBadgeExample.php index 14eb3469d0..703595b76c 100644 --- a/src/applications/uiexample/examples/PHUIBadgeExample.php +++ b/src/applications/uiexample/examples/PHUIBadgeExample.php @@ -10,6 +10,10 @@ final class PHUIBadgeExample extends PhabricatorUIExample { return pht('Celebrate the moments of your life.'); } + public function getCategory() { + return pht('Single Use'); + } + public function renderExample() { $badges1 = array(); diff --git a/src/applications/uiexample/examples/PHUIColorPalletteExample.php b/src/applications/uiexample/examples/PHUIColorPalletteExample.php index 0e3193d24d..a8910b930d 100644 --- a/src/applications/uiexample/examples/PHUIColorPalletteExample.php +++ b/src/applications/uiexample/examples/PHUIColorPalletteExample.php @@ -10,6 +10,10 @@ final class PHUIColorPalletteExample extends PhabricatorUIExample { return pht('A Standard Palette of Colors for use.'); } + public function getCategory() { + return pht('Catalogs'); + } + public function renderExample() { $colors = array( diff --git a/src/applications/uiexample/examples/PHUIFeedStoryExample.php b/src/applications/uiexample/examples/PHUIFeedStoryExample.php index 375c6e42fd..0df757cada 100644 --- a/src/applications/uiexample/examples/PHUIFeedStoryExample.php +++ b/src/applications/uiexample/examples/PHUIFeedStoryExample.php @@ -8,7 +8,11 @@ final class PHUIFeedStoryExample extends PhabricatorUIExample { public function getDescription() { return pht( - 'An outlandish exaggeration of intricate tales from around the realm'); + 'An outlandish exaggeration of intricate tales from around the realm.'); + } + + public function getCategory() { + return pht('Single Use'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PHUIHovercardUIExample.php b/src/applications/uiexample/examples/PHUIHovercardUIExample.php index 8673441d09..8cdec56d68 100644 --- a/src/applications/uiexample/examples/PHUIHovercardUIExample.php +++ b/src/applications/uiexample/examples/PHUIHovercardUIExample.php @@ -12,6 +12,10 @@ final class PHUIHovercardUIExample extends PhabricatorUIExample { phutil_tag('tt', array(), 'PHUIHovercardView')); } + public function getCategory() { + return pht('Single Use'); + } + public function renderExample() { $request = $this->getRequest(); $user = $request->getUser(); diff --git a/src/applications/uiexample/examples/PHUIIconExample.php b/src/applications/uiexample/examples/PHUIIconExample.php index 1bf96ce8e5..35395fbff0 100644 --- a/src/applications/uiexample/examples/PHUIIconExample.php +++ b/src/applications/uiexample/examples/PHUIIconExample.php @@ -10,6 +10,10 @@ final class PHUIIconExample extends PhabricatorUIExample { return pht('Easily render icons or images with links and sprites.'); } + public function getCategory() { + return pht('Catalogs'); + } + private function listTransforms() { return array( 'ph-rotate-90', diff --git a/src/applications/uiexample/examples/PhabricatorFilesComposeAvatarExample.php b/src/applications/uiexample/examples/PhabricatorFilesComposeAvatarExample.php index 6ea5537f9d..57a65863db 100644 --- a/src/applications/uiexample/examples/PhabricatorFilesComposeAvatarExample.php +++ b/src/applications/uiexample/examples/PhabricatorFilesComposeAvatarExample.php @@ -3,13 +3,17 @@ final class PhabricatorFilesComposeAvatarExample extends PhabricatorUIExample { public function getName() { - return pht('Generate Avatar Images'); + return pht('Avatars'); } public function getDescription() { return pht('Tests various color palettes and sizes.'); } + public function getCategory() { + return pht('Technical'); + } + public function renderExample() { $request = $this->getRequest(); $viewer = $request->getUser(); diff --git a/src/applications/uiexample/examples/PhabricatorGestureUIExample.php b/src/applications/uiexample/examples/PhabricatorGestureUIExample.php index 1adb7dee16..2adfb795b2 100644 --- a/src/applications/uiexample/examples/PhabricatorGestureUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorGestureUIExample.php @@ -14,6 +14,10 @@ final class PhabricatorGestureUIExample extends PhabricatorUIExample { phutil_tag('tt', array(), 'touchable')); } + public function getCategory() { + return pht('Technical'); + } + public function renderExample() { $id = celerity_generate_unique_node_id(); diff --git a/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php b/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php index 1b825693fa..5d15d884cc 100644 --- a/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php @@ -12,6 +12,10 @@ final class PhabricatorNotificationUIExample extends PhabricatorUIExample { phutil_tag('tt', array(), 'JX.Notification')); } + public function getCategory() { + return pht('Technical'); + } + public function renderExample() { require_celerity_resource('phabricator-notification-css'); Javelin::initBehavior('phabricator-notification-example'); diff --git a/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php b/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php index 46f0262bbb..5044821d82 100644 --- a/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php @@ -11,6 +11,10 @@ final class PhabricatorRemarkupUIExample extends PhabricatorUIExample { 'Demonstrates the visual appearance of various Remarkup elements.'); } + public function getCategory() { + return pht('Technical'); + } + public function renderExample() { $viewer = $this->getRequest()->getUser(); diff --git a/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php b/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php index e5370d30cf..d6386e59d4 100644 --- a/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php @@ -10,6 +10,10 @@ final class PhabricatorSetupIssueUIExample extends PhabricatorUIExample { return pht('Setup errors and warnings.'); } + public function getCategory() { + return pht('Single Use'); + } + public function renderExample() { $request = $this->getRequest(); $user = $request->getUser(); diff --git a/src/applications/uiexample/examples/PhabricatorUIExample.php b/src/applications/uiexample/examples/PhabricatorUIExample.php index 5326cba3fe..7c84f6c9e4 100644 --- a/src/applications/uiexample/examples/PhabricatorUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorUIExample.php @@ -17,6 +17,10 @@ abstract class PhabricatorUIExample extends Phobject { abstract public function getDescription(); abstract public function renderExample(); + public function getCategory() { + return pht('General'); + } + protected function createBasicDummyHandle($name, $type, $fullname = null, $uri = null) {