1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-27 14:09:11 +01:00

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
This commit is contained in:
epriestley 2017-05-30 16:05:03 -07:00
parent 7725d7cc45
commit 2ad521b96d
15 changed files with 60 additions and 23 deletions

View file

@ -1395,7 +1395,6 @@ phutil_register_library_map(array(
'HeraldTranscriptTestCase' => 'applications/herald/storage/__tests__/HeraldTranscriptTestCase.php', 'HeraldTranscriptTestCase' => 'applications/herald/storage/__tests__/HeraldTranscriptTestCase.php',
'HeraldUtilityActionGroup' => 'applications/herald/action/HeraldUtilityActionGroup.php', 'HeraldUtilityActionGroup' => 'applications/herald/action/HeraldUtilityActionGroup.php',
'Javelin' => 'infrastructure/javelin/Javelin.php', 'Javelin' => 'infrastructure/javelin/Javelin.php',
'JavelinViewExampleServerView' => 'applications/uiexample/examples/JavelinViewExampleServerView.php',
'LegalpadController' => 'applications/legalpad/controller/LegalpadController.php', 'LegalpadController' => 'applications/legalpad/controller/LegalpadController.php',
'LegalpadCreateDocumentsCapability' => 'applications/legalpad/capability/LegalpadCreateDocumentsCapability.php', 'LegalpadCreateDocumentsCapability' => 'applications/legalpad/capability/LegalpadCreateDocumentsCapability.php',
'LegalpadDAO' => 'applications/legalpad/storage/LegalpadDAO.php', 'LegalpadDAO' => 'applications/legalpad/storage/LegalpadDAO.php',
@ -6475,7 +6474,6 @@ phutil_register_library_map(array(
'HeraldTranscriptTestCase' => 'PhabricatorTestCase', 'HeraldTranscriptTestCase' => 'PhabricatorTestCase',
'HeraldUtilityActionGroup' => 'HeraldActionGroup', 'HeraldUtilityActionGroup' => 'HeraldActionGroup',
'Javelin' => 'Phobject', 'Javelin' => 'Phobject',
'JavelinViewExampleServerView' => 'AphrontView',
'LegalpadController' => 'PhabricatorController', 'LegalpadController' => 'PhabricatorController',
'LegalpadCreateDocumentsCapability' => 'PhabricatorPolicyCapability', 'LegalpadCreateDocumentsCapability' => 'PhabricatorPolicyCapability',
'LegalpadDAO' => 'PhabricatorLiskDAO', 'LegalpadDAO' => 'PhabricatorLiskDAO',

View file

@ -17,10 +17,15 @@ final class PhabricatorUIExampleRenderController extends PhabricatorController {
$nav = new AphrontSideNavFilterView(); $nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/'))); $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
foreach ($classes as $class => $obj) { $groups = mgroup($classes, 'getCategory');
ksort($groups);
foreach ($groups as $group => $group_classes) {
$nav->addLabel($group);
foreach ($group_classes as $class => $obj) {
$name = $obj->getName(); $name = $obj->getName();
$nav->addFilter($class, $name); $nav->addFilter($class, $name);
} }
}
$selected = $nav->selectFilter($id, head_key($classes)); $selected = $nav->selectFilter($id, head_key($classes));

View file

@ -1,14 +0,0 @@
<?php
final class JavelinViewExampleServerView extends AphrontView {
public function render() {
return phutil_tag(
'div',
array(
'class' => 'server-view',
),
$this->renderChildren());
}
}

View file

@ -3,11 +3,15 @@
final class MacroEmojiExample extends PhabricatorUIExample { final class MacroEmojiExample extends PhabricatorUIExample {
public function getName() { public function getName() {
return pht('Emoji Support'); return pht('Emoji');
} }
public function getDescription() { 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() { public function renderExample() {

View file

@ -10,6 +10,10 @@ final class PHUIBadgeExample extends PhabricatorUIExample {
return pht('Celebrate the moments of your life.'); return pht('Celebrate the moments of your life.');
} }
public function getCategory() {
return pht('Single Use');
}
public function renderExample() { public function renderExample() {
$badges1 = array(); $badges1 = array();

View file

@ -10,6 +10,10 @@ final class PHUIColorPalletteExample extends PhabricatorUIExample {
return pht('A Standard Palette of Colors for use.'); return pht('A Standard Palette of Colors for use.');
} }
public function getCategory() {
return pht('Catalogs');
}
public function renderExample() { public function renderExample() {
$colors = array( $colors = array(

View file

@ -8,7 +8,11 @@ final class PHUIFeedStoryExample extends PhabricatorUIExample {
public function getDescription() { public function getDescription() {
return pht( 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() { public function renderExample() {

View file

@ -12,6 +12,10 @@ final class PHUIHovercardUIExample extends PhabricatorUIExample {
phutil_tag('tt', array(), 'PHUIHovercardView')); phutil_tag('tt', array(), 'PHUIHovercardView'));
} }
public function getCategory() {
return pht('Single Use');
}
public function renderExample() { public function renderExample() {
$request = $this->getRequest(); $request = $this->getRequest();
$user = $request->getUser(); $user = $request->getUser();

View file

@ -10,6 +10,10 @@ final class PHUIIconExample extends PhabricatorUIExample {
return pht('Easily render icons or images with links and sprites.'); return pht('Easily render icons or images with links and sprites.');
} }
public function getCategory() {
return pht('Catalogs');
}
private function listTransforms() { private function listTransforms() {
return array( return array(
'ph-rotate-90', 'ph-rotate-90',

View file

@ -3,13 +3,17 @@
final class PhabricatorFilesComposeAvatarExample extends PhabricatorUIExample { final class PhabricatorFilesComposeAvatarExample extends PhabricatorUIExample {
public function getName() { public function getName() {
return pht('Generate Avatar Images'); return pht('Avatars');
} }
public function getDescription() { public function getDescription() {
return pht('Tests various color palettes and sizes.'); return pht('Tests various color palettes and sizes.');
} }
public function getCategory() {
return pht('Technical');
}
public function renderExample() { public function renderExample() {
$request = $this->getRequest(); $request = $this->getRequest();
$viewer = $request->getUser(); $viewer = $request->getUser();

View file

@ -14,6 +14,10 @@ final class PhabricatorGestureUIExample extends PhabricatorUIExample {
phutil_tag('tt', array(), 'touchable')); phutil_tag('tt', array(), 'touchable'));
} }
public function getCategory() {
return pht('Technical');
}
public function renderExample() { public function renderExample() {
$id = celerity_generate_unique_node_id(); $id = celerity_generate_unique_node_id();

View file

@ -12,6 +12,10 @@ final class PhabricatorNotificationUIExample extends PhabricatorUIExample {
phutil_tag('tt', array(), 'JX.Notification')); phutil_tag('tt', array(), 'JX.Notification'));
} }
public function getCategory() {
return pht('Technical');
}
public function renderExample() { public function renderExample() {
require_celerity_resource('phabricator-notification-css'); require_celerity_resource('phabricator-notification-css');
Javelin::initBehavior('phabricator-notification-example'); Javelin::initBehavior('phabricator-notification-example');

View file

@ -11,6 +11,10 @@ final class PhabricatorRemarkupUIExample extends PhabricatorUIExample {
'Demonstrates the visual appearance of various Remarkup elements.'); 'Demonstrates the visual appearance of various Remarkup elements.');
} }
public function getCategory() {
return pht('Technical');
}
public function renderExample() { public function renderExample() {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getRequest()->getUser();

View file

@ -10,6 +10,10 @@ final class PhabricatorSetupIssueUIExample extends PhabricatorUIExample {
return pht('Setup errors and warnings.'); return pht('Setup errors and warnings.');
} }
public function getCategory() {
return pht('Single Use');
}
public function renderExample() { public function renderExample() {
$request = $this->getRequest(); $request = $this->getRequest();
$user = $request->getUser(); $user = $request->getUser();

View file

@ -17,6 +17,10 @@ abstract class PhabricatorUIExample extends Phobject {
abstract public function getDescription(); abstract public function getDescription();
abstract public function renderExample(); abstract public function renderExample();
public function getCategory() {
return pht('General');
}
protected function createBasicDummyHandle($name, $type, $fullname = null, protected function createBasicDummyHandle($name, $type, $fullname = null,
$uri = null) { $uri = null) {