@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.

Modernize UIExamples

Summary:
- Get rid of an AphrontSideNavView callsite.
- Modernize and simplify the application implementation.
- Doesn't work perfectly on tablet/phone but that's because not all the UI examples work there yet.

Test Plan: Looked at /applications/ and /uiexample/.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+102 -93
+1
scripts/celerity/generate_sprites.php
··· 140 140 'feed' => array(3, 11), 141 141 'paste' => array(9, 2), 142 142 'audit' => array(8, 19), 143 + 'uiexample' => array(7, 28), 143 144 ); 144 145 145 146 $xadj = -1;
+3 -3
src/__celerity_resource_map__.php
··· 65 65 ), 66 66 '/rsrc/image/autosprite.png' => 67 67 array( 68 - 'hash' => 'bd70ca6308d6f80a87a10068a04867f8', 69 - 'uri' => '/res/bd70ca63/rsrc/image/autosprite.png', 68 + 'hash' => '0b78a23fb4cec90e3a35ba1b9ce20f0c', 69 + 'uri' => '/res/0b78a23f/rsrc/image/autosprite.png', 70 70 'disk' => '/rsrc/image/autosprite.png', 71 71 'type' => 'png', 72 72 ), ··· 671 671 ), 672 672 'autosprite-css' => 673 673 array( 674 - 'uri' => '/res/114f6e40/rsrc/css/autosprite.css', 674 + 'uri' => '/res/cb9c82fd/rsrc/css/autosprite.css', 675 675 'type' => 'css', 676 676 'requires' => 677 677 array(
+3 -3
src/__phutil_library_map__.php
··· 570 570 'PhabricatorApplicationProject' => 'applications/project/application/PhabricatorApplicationProject.php', 571 571 'PhabricatorApplicationSettings' => 'applications/settings/application/PhabricatorApplicationSettings.php', 572 572 'PhabricatorApplicationStatusView' => 'applications/meta/view/PhabricatorApplicationStatusView.php', 573 + 'PhabricatorApplicationUIExamples' => 'applications/uiexample/application/PhabricatorApplicationUIExamples.php', 573 574 'PhabricatorApplicationsListController' => 'applications/meta/controller/PhabricatorApplicationsListController.php', 574 575 'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php', 575 576 'PhabricatorAuditAddCommentController' => 'applications/audit/controller/PhabricatorAuditAddCommentController.php', ··· 1076 1077 'PhabricatorTypeaheadDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadDatasourceController.php', 1077 1078 'PhabricatorTypeaheadResult' => 'applications/typeahead/storage/PhabricatorTypeaheadResult.php', 1078 1079 'PhabricatorUIExample' => 'applications/uiexample/examples/PhabricatorUIExample.php', 1079 - 'PhabricatorUIExampleController' => 'applications/uiexample/controller/PhabricatorUIExampleController.php', 1080 1080 'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php', 1081 1081 'PhabricatorUIListFilterExample' => 'applications/uiexample/examples/PhabricatorUIListFilterExample.php', 1082 1082 'PhabricatorUINotificationExample' => 'applications/uiexample/examples/PhabricatorUINotificationExample.php', ··· 1710 1710 'PhabricatorApplicationProject' => 'PhabricatorApplication', 1711 1711 'PhabricatorApplicationSettings' => 'PhabricatorApplication', 1712 1712 'PhabricatorApplicationStatusView' => 'AphrontView', 1713 + 'PhabricatorApplicationUIExamples' => 'PhabricatorApplication', 1713 1714 'PhabricatorApplicationsListController' => 'PhabricatorController', 1714 1715 'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController', 1715 1716 'PhabricatorAuditComment' => 'PhabricatorAuditDAO', ··· 2155 2156 'PhabricatorTrivialTestCase' => 'PhabricatorTestCase', 2156 2157 'PhabricatorTypeaheadCommonDatasourceController' => 'PhabricatorTypeaheadDatasourceController', 2157 2158 'PhabricatorTypeaheadDatasourceController' => 'PhabricatorController', 2158 - 'PhabricatorUIExampleController' => 'PhabricatorController', 2159 - 'PhabricatorUIExampleRenderController' => 'PhabricatorUIExampleController', 2159 + 'PhabricatorUIExampleRenderController' => 'PhabricatorController', 2160 2160 'PhabricatorUIListFilterExample' => 'PhabricatorUIExample', 2161 2161 'PhabricatorUINotificationExample' => 'PhabricatorUIExample', 2162 2162 'PhabricatorUIPagerExample' => 'PhabricatorUIExample',
-5
src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
··· 166 166 => 'HeraldTranscriptController', 167 167 ), 168 168 169 - '/uiexample/' => array( 170 - '' => 'PhabricatorUIExampleRenderController', 171 - 'view/(?P<class>[^/]+)/' => 'PhabricatorUIExampleRenderController', 172 - ), 173 - 174 169 '/owners/' => array( 175 170 '' => 'PhabricatorOwnersListController', 176 171 'view/(?P<view>[^/]+)/' => 'PhabricatorOwnersListController',
+16 -11
src/applications/base/PhabricatorApplication.php
··· 138 138 139 139 140 140 public static function getAllInstalledApplications() { 141 - $classes = id(new PhutilSymbolLoader()) 142 - ->setAncestorClass(__CLASS__) 143 - ->setConcreteOnly(true) 144 - ->selectAndLoadSymbols(); 141 + static $applications; 145 142 146 - $apps = array(); 147 - foreach ($classes as $class) { 148 - $app = newv($class['name'], array()); 149 - if (!$app->isEnabled()) { 150 - continue; 143 + if (empty($applications)) { 144 + $classes = id(new PhutilSymbolLoader()) 145 + ->setAncestorClass(__CLASS__) 146 + ->setConcreteOnly(true) 147 + ->selectAndLoadSymbols(); 148 + 149 + $apps = array(); 150 + foreach ($classes as $class) { 151 + $app = newv($class['name'], array()); 152 + if (!$app->isEnabled()) { 153 + continue; 154 + } 155 + $apps[] = $app; 151 156 } 152 - $apps[] = $app; 157 + $applications = $apps; 153 158 } 154 159 155 - return $apps; 160 + return $applications; 156 161 } 157 162 158 163
+46
src/applications/uiexample/application/PhabricatorApplicationUIExamples.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + final class PhabricatorApplicationUIExamples extends PhabricatorApplication { 20 + 21 + public function getBaseURI() { 22 + return '/uiexample/'; 23 + } 24 + 25 + public function getShortDescription() { 26 + return 'Developer UI Examples'; 27 + } 28 + 29 + public function getAutospriteName() { 30 + return 'uiexample'; 31 + } 32 + 33 + public function getTitleGlyph() { 34 + return "\xE2\x8F\x9A"; 35 + } 36 + 37 + public function getRoutes() { 38 + return array( 39 + '/uiexample/' => array( 40 + '' => 'PhabricatorUIExampleRenderController', 41 + 'view/(?P<class>[^/]+)/' => 'PhabricatorUIExampleRenderController', 42 + ), 43 + ); 44 + } 45 + 46 + }
-34
src/applications/uiexample/controller/PhabricatorUIExampleController.php
··· 1 - <?php 2 - 3 - /* 4 - * Copyright 2011 Facebook, Inc. 5 - * 6 - * Licensed under the Apache License, Version 2.0 (the "License"); 7 - * you may not use this file except in compliance with the License. 8 - * You may obtain a copy of the License at 9 - * 10 - * http://www.apache.org/licenses/LICENSE-2.0 11 - * 12 - * Unless required by applicable law or agreed to in writing, software 13 - * distributed under the License is distributed on an "AS IS" BASIS, 14 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 - * See the License for the specific language governing permissions and 16 - * limitations under the License. 17 - */ 18 - 19 - abstract class PhabricatorUIExampleController extends PhabricatorController { 20 - 21 - public function buildStandardPageResponse($view, array $data) { 22 - $page = $this->buildStandardPageView(); 23 - 24 - $page->setApplicationName('UI Examples'); 25 - $page->setBaseURI('/uiexample/'); 26 - $page->setTitle(idx($data, 'title')); 27 - $page->setGlyph("\xE2\x8F\x9A"); 28 - $page->appendChild($view); 29 - 30 - $response = new AphrontWebpageResponse(); 31 - return $response->setContent($page->render()); 32 - } 33 - 34 - }
+11 -24
src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php
··· 16 16 * limitations under the License. 17 17 */ 18 18 19 - final class PhabricatorUIExampleRenderController 20 - extends PhabricatorUIExampleController { 19 + final class PhabricatorUIExampleRenderController extends PhabricatorController { 21 20 22 21 private $class; 23 22 ··· 29 28 30 29 $classes = id(new PhutilSymbolLoader()) 31 30 ->setAncestorClass('PhabricatorUIExample') 31 + ->setConcreteOnly(true) 32 32 ->selectAndLoadSymbols(); 33 33 $classes = ipull($classes, 'name', 'name'); 34 34 35 - $selected = null; 36 35 foreach ($classes as $class => $ignored) { 37 36 $classes[$class] = newv($class, array()); 38 - if ($this->class == $classes[$class]->getName()) { 39 - $selected = $class; 40 - } 41 37 } 42 38 43 - if (!$selected) { 44 - $selected = head_key($classes); 45 - } 39 + $classes = msort($classes, 'getName'); 46 40 47 - $nav = new AphrontSideNavView(); 41 + $nav = new AphrontSideNavFilterView(); 42 + $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/'))); 48 43 49 44 foreach ($classes as $class => $obj) { 50 45 $name = $obj->getName(); 46 + $nav->addFilter($class, $name); 47 + } 51 48 52 - $nav->addNavItem( 53 - phutil_render_tag( 54 - 'a', 55 - array( 56 - 'href' => '/uiexample/view/'.$name.'/', 57 - 'class' => ($selected == $class) 58 - ? 'aphront-side-nav-selected' 59 - : null, 60 - ), 61 - phutil_escape_html($obj->getName()))); 62 - } 49 + $selected = $nav->selectFilter($this->class, head_key($classes)); 63 50 64 51 require_celerity_resource('phabricator-ui-example-css'); 65 52 66 53 $example = $classes[$selected]; 67 54 $example->setRequest($this->getRequest()); 68 - 69 55 70 56 $nav->appendChild( 71 57 '<div class="phabricator-ui-example-header">'. ··· 80 66 81 67 $nav->appendChild($example->renderExample()); 82 68 83 - return $this->buildStandardPageResponse( 69 + return $this->buildApplicationPage( 84 70 $nav, 85 71 array( 86 - 'title' => 'UI Example', 72 + 'title' => 'UI Example', 73 + 'device' => true, 87 74 )); 88 75 } 89 76
+2 -1
src/applications/uiexample/examples/JavelinReactorExample.php
··· 17 17 */ 18 18 19 19 final class JavelinReactorExample extends PhabricatorUIExample { 20 + 20 21 public function getName() { 21 - return 'Javelin Reactor Examples'; 22 + return 'Javelin Reactor'; 22 23 } 23 24 24 25 public function getDescription() {
+20 -12
webroot/rsrc/css/autosprite.css
··· 251 251 background-position: 0px -2490px; 252 252 } 253 253 254 - .action-file { 254 + .app-uiexample-full { 255 255 background-position: 0px -2521px; 256 256 } 257 257 258 + .app-uiexample { 259 + background-position: 0px -2582px; 260 + } 261 + 262 + .action-file { 263 + background-position: 0px -2613px; 264 + } 265 + 258 266 .action-fork { 259 - background-position: 0px -2538px; 267 + background-position: 0px -2630px; 260 268 } 261 269 262 270 .action-edit { 263 - background-position: 0px -2555px; 271 + background-position: 0px -2647px; 264 272 } 265 273 266 274 .action-flag-0 { 267 - background-position: 0px -2572px; 275 + background-position: 0px -2664px; 268 276 } 269 277 270 278 .action-flag-1 { 271 - background-position: 0px -2589px; 279 + background-position: 0px -2681px; 272 280 } 273 281 274 282 .action-flag-2 { 275 - background-position: 0px -2606px; 283 + background-position: 0px -2698px; 276 284 } 277 285 278 286 .action-flag-3 { 279 - background-position: 0px -2623px; 287 + background-position: 0px -2715px; 280 288 } 281 289 282 290 .action-flag-4 { 283 - background-position: 0px -2640px; 291 + background-position: 0px -2732px; 284 292 } 285 293 286 294 .action-flag-5 { 287 - background-position: 0px -2657px; 295 + background-position: 0px -2749px; 288 296 } 289 297 290 298 .action-flag-6 { 291 - background-position: 0px -2674px; 299 + background-position: 0px -2766px; 292 300 } 293 301 294 302 .action-flag-7 { 295 - background-position: 0px -2691px; 303 + background-position: 0px -2783px; 296 304 } 297 305 298 306 .action-flag-ghost { 299 - background-position: 0px -2708px; 307 + background-position: 0px -2800px; 300 308 }
webroot/rsrc/image/autosprite.png

This is a binary file and will not be displayed.