diff --git a/scripts/celerity/generate_sprites.php b/scripts/celerity/generate_sprites.php index 5bf389f9a7..be0de39f8f 100755 --- a/scripts/celerity/generate_sprites.php +++ b/scripts/celerity/generate_sprites.php @@ -140,6 +140,7 @@ $app_map = array( 'feed' => array(3, 11), 'paste' => array(9, 2), 'audit' => array(8, 19), + 'uiexample' => array(7, 28), ); $xadj = -1; diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 962c603c99..72368d272c 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -65,8 +65,8 @@ celerity_register_resource_map(array( ), '/rsrc/image/autosprite.png' => array( - 'hash' => 'bd70ca6308d6f80a87a10068a04867f8', - 'uri' => '/res/bd70ca63/rsrc/image/autosprite.png', + 'hash' => '0b78a23fb4cec90e3a35ba1b9ce20f0c', + 'uri' => '/res/0b78a23f/rsrc/image/autosprite.png', 'disk' => '/rsrc/image/autosprite.png', 'type' => 'png', ), @@ -671,7 +671,7 @@ celerity_register_resource_map(array( ), 'autosprite-css' => array( - 'uri' => '/res/114f6e40/rsrc/css/autosprite.css', + 'uri' => '/res/cb9c82fd/rsrc/css/autosprite.css', 'type' => 'css', 'requires' => array( diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 9cc36962a7..e73163dd4f 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -570,6 +570,7 @@ phutil_register_library_map(array( 'PhabricatorApplicationProject' => 'applications/project/application/PhabricatorApplicationProject.php', 'PhabricatorApplicationSettings' => 'applications/settings/application/PhabricatorApplicationSettings.php', 'PhabricatorApplicationStatusView' => 'applications/meta/view/PhabricatorApplicationStatusView.php', + 'PhabricatorApplicationUIExamples' => 'applications/uiexample/application/PhabricatorApplicationUIExamples.php', 'PhabricatorApplicationsListController' => 'applications/meta/controller/PhabricatorApplicationsListController.php', 'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php', 'PhabricatorAuditAddCommentController' => 'applications/audit/controller/PhabricatorAuditAddCommentController.php', @@ -1076,7 +1077,6 @@ phutil_register_library_map(array( 'PhabricatorTypeaheadDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadDatasourceController.php', 'PhabricatorTypeaheadResult' => 'applications/typeahead/storage/PhabricatorTypeaheadResult.php', 'PhabricatorUIExample' => 'applications/uiexample/examples/PhabricatorUIExample.php', - 'PhabricatorUIExampleController' => 'applications/uiexample/controller/PhabricatorUIExampleController.php', 'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php', 'PhabricatorUIListFilterExample' => 'applications/uiexample/examples/PhabricatorUIListFilterExample.php', 'PhabricatorUINotificationExample' => 'applications/uiexample/examples/PhabricatorUINotificationExample.php', @@ -1710,6 +1710,7 @@ phutil_register_library_map(array( 'PhabricatorApplicationProject' => 'PhabricatorApplication', 'PhabricatorApplicationSettings' => 'PhabricatorApplication', 'PhabricatorApplicationStatusView' => 'AphrontView', + 'PhabricatorApplicationUIExamples' => 'PhabricatorApplication', 'PhabricatorApplicationsListController' => 'PhabricatorController', 'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController', 'PhabricatorAuditComment' => 'PhabricatorAuditDAO', @@ -2155,8 +2156,7 @@ phutil_register_library_map(array( 'PhabricatorTrivialTestCase' => 'PhabricatorTestCase', 'PhabricatorTypeaheadCommonDatasourceController' => 'PhabricatorTypeaheadDatasourceController', 'PhabricatorTypeaheadDatasourceController' => 'PhabricatorController', - 'PhabricatorUIExampleController' => 'PhabricatorController', - 'PhabricatorUIExampleRenderController' => 'PhabricatorUIExampleController', + 'PhabricatorUIExampleRenderController' => 'PhabricatorController', 'PhabricatorUIListFilterExample' => 'PhabricatorUIExample', 'PhabricatorUINotificationExample' => 'PhabricatorUIExample', 'PhabricatorUIPagerExample' => 'PhabricatorUIExample', diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php index a665f40c20..9db2809c51 100644 --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -166,11 +166,6 @@ class AphrontDefaultApplicationConfiguration => 'HeraldTranscriptController', ), - '/uiexample/' => array( - '' => 'PhabricatorUIExampleRenderController', - 'view/(?P[^/]+)/' => 'PhabricatorUIExampleRenderController', - ), - '/owners/' => array( '' => 'PhabricatorOwnersListController', 'view/(?P[^/]+)/' => 'PhabricatorOwnersListController', diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php index 2bea83af0e..547e0f66fa 100644 --- a/src/applications/base/PhabricatorApplication.php +++ b/src/applications/base/PhabricatorApplication.php @@ -138,21 +138,26 @@ abstract class PhabricatorApplication { public static function getAllInstalledApplications() { - $classes = id(new PhutilSymbolLoader()) - ->setAncestorClass(__CLASS__) - ->setConcreteOnly(true) - ->selectAndLoadSymbols(); + static $applications; - $apps = array(); - foreach ($classes as $class) { - $app = newv($class['name'], array()); - if (!$app->isEnabled()) { - continue; + if (empty($applications)) { + $classes = id(new PhutilSymbolLoader()) + ->setAncestorClass(__CLASS__) + ->setConcreteOnly(true) + ->selectAndLoadSymbols(); + + $apps = array(); + foreach ($classes as $class) { + $app = newv($class['name'], array()); + if (!$app->isEnabled()) { + continue; + } + $apps[] = $app; } - $apps[] = $app; + $applications = $apps; } - return $apps; + return $applications; } diff --git a/src/applications/uiexample/application/PhabricatorApplicationUIExamples.php b/src/applications/uiexample/application/PhabricatorApplicationUIExamples.php new file mode 100644 index 0000000000..c9547169f1 --- /dev/null +++ b/src/applications/uiexample/application/PhabricatorApplicationUIExamples.php @@ -0,0 +1,46 @@ + array( + '' => 'PhabricatorUIExampleRenderController', + 'view/(?P[^/]+)/' => 'PhabricatorUIExampleRenderController', + ), + ); + } + +} diff --git a/src/applications/uiexample/controller/PhabricatorUIExampleController.php b/src/applications/uiexample/controller/PhabricatorUIExampleController.php deleted file mode 100644 index 7e47ca9b75..0000000000 --- a/src/applications/uiexample/controller/PhabricatorUIExampleController.php +++ /dev/null @@ -1,34 +0,0 @@ -buildStandardPageView(); - - $page->setApplicationName('UI Examples'); - $page->setBaseURI('/uiexample/'); - $page->setTitle(idx($data, 'title')); - $page->setGlyph("\xE2\x8F\x9A"); - $page->appendChild($view); - - $response = new AphrontWebpageResponse(); - return $response->setContent($page->render()); - } - -} diff --git a/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php b/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php index 3cd4165565..2fc92bfaf5 100644 --- a/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php +++ b/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php @@ -16,8 +16,7 @@ * limitations under the License. */ -final class PhabricatorUIExampleRenderController - extends PhabricatorUIExampleController { +final class PhabricatorUIExampleRenderController extends PhabricatorController { private $class; @@ -29,44 +28,31 @@ final class PhabricatorUIExampleRenderController $classes = id(new PhutilSymbolLoader()) ->setAncestorClass('PhabricatorUIExample') + ->setConcreteOnly(true) ->selectAndLoadSymbols(); $classes = ipull($classes, 'name', 'name'); - $selected = null; foreach ($classes as $class => $ignored) { $classes[$class] = newv($class, array()); - if ($this->class == $classes[$class]->getName()) { - $selected = $class; - } } - if (!$selected) { - $selected = head_key($classes); - } + $classes = msort($classes, 'getName'); - $nav = new AphrontSideNavView(); + $nav = new AphrontSideNavFilterView(); + $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/'))); foreach ($classes as $class => $obj) { $name = $obj->getName(); - - $nav->addNavItem( - phutil_render_tag( - 'a', - array( - 'href' => '/uiexample/view/'.$name.'/', - 'class' => ($selected == $class) - ? 'aphront-side-nav-selected' - : null, - ), - phutil_escape_html($obj->getName()))); + $nav->addFilter($class, $name); } + $selected = $nav->selectFilter($this->class, head_key($classes)); + require_celerity_resource('phabricator-ui-example-css'); $example = $classes[$selected]; $example->setRequest($this->getRequest()); - $nav->appendChild( '
'. '

'. @@ -80,10 +66,11 @@ final class PhabricatorUIExampleRenderController $nav->appendChild($example->renderExample()); - return $this->buildStandardPageResponse( + return $this->buildApplicationPage( $nav, array( - 'title' => 'UI Example', + 'title' => 'UI Example', + 'device' => true, )); } diff --git a/src/applications/uiexample/examples/JavelinReactorExample.php b/src/applications/uiexample/examples/JavelinReactorExample.php index bd005814df..d0ae394fa5 100644 --- a/src/applications/uiexample/examples/JavelinReactorExample.php +++ b/src/applications/uiexample/examples/JavelinReactorExample.php @@ -17,8 +17,9 @@ */ final class JavelinReactorExample extends PhabricatorUIExample { + public function getName() { - return 'Javelin Reactor Examples'; + return 'Javelin Reactor'; } public function getDescription() { diff --git a/webroot/rsrc/css/autosprite.css b/webroot/rsrc/css/autosprite.css index ed5d10a23a..f0780c0313 100644 --- a/webroot/rsrc/css/autosprite.css +++ b/webroot/rsrc/css/autosprite.css @@ -251,50 +251,58 @@ background-position: 0px -2490px; } -.action-file { +.app-uiexample-full { background-position: 0px -2521px; } +.app-uiexample { + background-position: 0px -2582px; +} + +.action-file { + background-position: 0px -2613px; +} + .action-fork { - background-position: 0px -2538px; + background-position: 0px -2630px; } .action-edit { - background-position: 0px -2555px; + background-position: 0px -2647px; } .action-flag-0 { - background-position: 0px -2572px; + background-position: 0px -2664px; } .action-flag-1 { - background-position: 0px -2589px; + background-position: 0px -2681px; } .action-flag-2 { - background-position: 0px -2606px; + background-position: 0px -2698px; } .action-flag-3 { - background-position: 0px -2623px; + background-position: 0px -2715px; } .action-flag-4 { - background-position: 0px -2640px; + background-position: 0px -2732px; } .action-flag-5 { - background-position: 0px -2657px; + background-position: 0px -2749px; } .action-flag-6 { - background-position: 0px -2674px; + background-position: 0px -2766px; } .action-flag-7 { - background-position: 0px -2691px; + background-position: 0px -2783px; } .action-flag-ghost { - background-position: 0px -2708px; + background-position: 0px -2800px; } diff --git a/webroot/rsrc/image/autosprite.png b/webroot/rsrc/image/autosprite.png index 4366ac3c2e..c866558fb9 100644 Binary files a/webroot/rsrc/image/autosprite.png and b/webroot/rsrc/image/autosprite.png differ