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

Make the quick create menu more or less work correctly

Summary:
Ref T3623. I'm sure I didn't get the margins / drop shadow quite right, but this looks and works reasonably well:

{F105637}

Test Plan: Clicked stuff to quick create.

Reviewers: chad, btrahan

Reviewed By: chad

CC: chad, aran

Maniphest Tasks: T3623

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

+140 -42
+27 -26
resources/celerity/map.php
··· 7 7 return array( 8 8 'names' => 9 9 array( 10 - 'core.pkg.css' => '63255578', 11 - 'core.pkg.js' => 'c907bd96', 10 + 'core.pkg.css' => 'a2b5fd6a', 11 + 'core.pkg.js' => 'c7854cc5', 12 12 'darkconsole.pkg.js' => 'ca8671ce', 13 13 'differential.pkg.css' => '5a65a762', 14 14 'differential.pkg.js' => '322ea941', ··· 39 39 'rsrc/css/aphront/two-column.css' => '16ab3ad2', 40 40 'rsrc/css/aphront/typeahead.css' => '00c9a200', 41 41 'rsrc/css/application/auth/auth.css' => '1e655982', 42 - 'rsrc/css/application/base/main-menu-view.css' => 'aba0b7a6', 42 + 'rsrc/css/application/base/main-menu-view.css' => 'aa18107a', 43 43 'rsrc/css/application/base/notification-menu.css' => 'fc9a363c', 44 44 'rsrc/css/application/base/phabricator-application-launch-view.css' => '6f8453d9', 45 45 'rsrc/css/application/base/standard-page-view.css' => '517cdfb1', ··· 337 337 'rsrc/image/texture/table_header_hover.png' => '038ec3b9', 338 338 'rsrc/image/texture/table_header_tall.png' => 'd56b434f', 339 339 'rsrc/js/application/aphlict/Aphlict.js' => '493665ee', 340 - 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'd4220f5b', 340 + 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '2a2dba85', 341 341 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '845731b8', 342 342 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 343 343 'rsrc/js/application/config/behavior-reorder-fields.js' => '69bb5094', ··· 420 420 'rsrc/js/core/Busy.js' => '6453c869', 421 421 'rsrc/js/core/DragAndDropFileUpload.js' => 'ae6abfba', 422 422 'rsrc/js/core/DraggableList.js' => '1681c4d4', 423 - 'rsrc/js/core/DropdownMenu.js' => '2f6f80f4', 423 + 'rsrc/js/core/DropdownMenu.js' => 'fb342e18', 424 424 'rsrc/js/core/DropdownMenuItem.js' => '0f386ef4', 425 425 'rsrc/js/core/FileUpload.js' => '96713558', 426 426 'rsrc/js/core/Hovercard.js' => '4f344388', ··· 519 519 'inline-comment-summary-css' => '14a91639', 520 520 'javelin-aphlict' => '493665ee', 521 521 'javelin-behavior' => '8a3ed18b', 522 - 'javelin-behavior-aphlict-dropdown' => 'd4220f5b', 522 + 'javelin-behavior-aphlict-dropdown' => '2a2dba85', 523 523 'javelin-behavior-aphlict-listen' => '845731b8', 524 524 'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884', 525 525 'javelin-behavior-aphront-crop' => 'b98fc918', ··· 679 679 'phabricator-crumbs-view-css' => '2d9db584', 680 680 'phabricator-drag-and-drop-file-upload' => 'ae6abfba', 681 681 'phabricator-draggable-list' => '1681c4d4', 682 - 'phabricator-dropdown-menu' => '2f6f80f4', 682 + 'phabricator-dropdown-menu' => 'fb342e18', 683 683 'phabricator-fatal-config-template-css' => '25d446d6', 684 684 'phabricator-feed-css' => '0d17c209', 685 685 'phabricator-file-upload' => '96713558', ··· 690 690 'phabricator-jump-nav' => 'f0c5e726', 691 691 'phabricator-keyboard-shortcut' => '1ae869f2', 692 692 'phabricator-keyboard-shortcut-manager' => 'ad7a69ca', 693 - 'phabricator-main-menu-view' => 'aba0b7a6', 693 + 'phabricator-main-menu-view' => 'aa18107a', 694 694 'phabricator-menu-item' => '0f386ef4', 695 695 'phabricator-nav-view-css' => 'd0d4a509', 696 696 'phabricator-notification' => '95944043', ··· 972 972 1 => 'javelin-stratcom', 973 973 2 => 'javelin-dom', 974 974 ), 975 + '2a2dba85' => 976 + array( 977 + 0 => 'javelin-behavior', 978 + 1 => 'javelin-request', 979 + 2 => 'javelin-stratcom', 980 + 3 => 'javelin-vector', 981 + 4 => 'javelin-dom', 982 + 5 => 'javelin-uri', 983 + 6 => 'javelin-behavior-device', 984 + ), 975 985 '2f2e18aa' => 976 986 array( 977 987 0 => 'javelin-behavior', ··· 979 989 2 => 'javelin-workflow', 980 990 3 => 'javelin-stratcom', 981 991 ), 982 - '2f6f80f4' => 983 - array( 984 - 0 => 'javelin-install', 985 - 1 => 'javelin-util', 986 - 2 => 'javelin-dom', 987 - 3 => 'javelin-vector', 988 - 4 => 'javelin-stratcom', 989 - 5 => 'phabricator-menu-item', 990 - ), 991 992 '2fa810fc' => 992 993 array( 993 994 0 => 'javelin-behavior', ··· 1710 1711 array( 1711 1712 0 => 'javelin-util', 1712 1713 ), 1713 - 'd4220f5b' => 1714 - array( 1715 - 0 => 'javelin-behavior', 1716 - 1 => 'javelin-request', 1717 - 2 => 'javelin-stratcom', 1718 - 3 => 'javelin-vector', 1719 - 4 => 'javelin-dom', 1720 - 5 => 'javelin-uri', 1721 - ), 1722 1714 'd4a14807' => 1723 1715 array( 1724 1716 0 => 'javelin-install', ··· 1920 1912 3 => 'javelin-json', 1921 1913 4 => 'javelin-stratcom', 1922 1914 5 => 'phabricator-shaped-request', 1915 + ), 1916 + 'fb342e18' => 1917 + array( 1918 + 0 => 'javelin-install', 1919 + 1 => 'javelin-util', 1920 + 2 => 'javelin-dom', 1921 + 3 => 'javelin-vector', 1922 + 4 => 'javelin-stratcom', 1923 + 5 => 'phabricator-menu-item', 1923 1924 ), 1924 1925 'fbbce3bf' => 1925 1926 array(
+17
src/applications/base/PhabricatorApplication.php
··· 259 259 260 260 261 261 /** 262 + * Build extra items for the main menu. Generally, this is used to render 263 + * static dropdowns. 264 + * 265 + * @param PhabricatorUser The viewing user. 266 + * @param AphrontController The current controller. May be null for special 267 + * pages like 404, exception handlers, etc. 268 + * @return view List of menu items. 269 + * @task ui 270 + */ 271 + public function buildMainMenuExtraNodes( 272 + PhabricatorUser $viewer, 273 + PhabricatorController $controller = null) { 274 + return array(); 275 + } 276 + 277 + 278 + /** 262 279 * On the Phabricator homepage sidebar, this function returns the URL for 263 280 * a quick create X link which is displayed in the wide button only. 264 281 *
+52
src/applications/home/application/PhabricatorApplicationHome.php
··· 42 42 $items = array(); 43 43 44 44 if ($user->isLoggedIn() && $user->isUserActivated()) { 45 + $create_id = celerity_generate_unique_node_id(); 46 + Javelin::initBehavior( 47 + 'aphlict-dropdown', 48 + array( 49 + 'bubbleID' => $create_id, 50 + 'dropdownID' => 'phabricator-quick-create-menu', 51 + 'local' => true, 52 + 'desktop' => true, 53 + 'right' => true, 54 + )); 55 + 45 56 $item = id(new PHUIListItemView()) 46 57 ->setName(pht('Create New...')) 47 58 ->setIcon('new') 48 59 ->addClass('core-menu-item') 49 60 ->setHref('/home/create/') 61 + ->addSigil('quick-create-menu') 62 + ->setID($create_id) 50 63 ->setOrder(300); 51 64 $items[] = $item; 52 65 } 53 66 54 67 return $items; 68 + } 69 + 70 + public function loadAllQuickCreateItems(PhabricatorUser $viewer) { 71 + $applications = id(new PhabricatorApplicationQuery()) 72 + ->setViewer($viewer) 73 + ->withInstalled(true) 74 + ->execute(); 75 + 76 + $items = array(); 77 + foreach ($applications as $application) { 78 + $app_items = $application->getQuickCreateItems($viewer); 79 + foreach ($app_items as $app_item) { 80 + $items[] = $app_item; 81 + } 82 + } 83 + 84 + return $items; 85 + } 86 + 87 + public function buildMainMenuExtraNodes( 88 + PhabricatorUser $viewer, 89 + PhabricatorController $controller = null) { 90 + 91 + $items = $this->loadAllQuickCreateItems($viewer); 92 + 93 + $view = new PHUIListView(); 94 + $view->newLabel(pht('Create New...')); 95 + foreach ($items as $item) { 96 + $view->addMenuItem($item); 97 + } 98 + 99 + return phutil_tag( 100 + 'div', 101 + array( 102 + 'id' => 'phabricator-quick-create-menu', 103 + 'class' => 'phabricator-main-menu-dropdown phui-list-sidenav', 104 + 'style' => 'display: none', 105 + ), 106 + $view); 55 107 } 56 108 57 109 }
+1 -12
src/applications/home/controller/PhabricatorHomeQuickCreateController.php
··· 6 6 public function processRequest() { 7 7 $viewer = $this->getRequest()->getUser(); 8 8 9 - $applications = id(new PhabricatorApplicationQuery()) 10 - ->setViewer($viewer) 11 - ->withInstalled(true) 12 - ->execute(); 13 - 14 - $items = array(); 15 - foreach ($applications as $application) { 16 - $app_items = $application->getQuickCreateItems($viewer); 17 - foreach ($app_items as $app_item) { 18 - $items[] = $app_item; 19 - } 20 - } 9 + $items = $this->getCurrentApplication()->loadAllQuickCreateItems($viewer); 21 10 22 11 $list = id(new PHUIObjectItemListView()) 23 12 ->setUser($viewer);
+7
src/view/page/menu/PhabricatorMainMenuView.php
··· 395 395 $notification_dropdown, 396 396 $message_notification_dropdown); 397 397 398 + $applications = PhabricatorApplication::getAllInstalledApplications(); 399 + foreach ($applications as $application) { 400 + $dropdowns[] = $application->buildMainMenuExtraNodes( 401 + $this->getUser(), 402 + $this->getController()); 403 + } 404 + 398 405 return array( 399 406 hsprintf('%s%s', $bubble_tag, $message_tag), 400 407 $dropdowns
+10
webroot/rsrc/css/application/base/main-menu-view.css
··· 389 389 height: 28px; 390 390 } 391 391 392 + .phabricator-main-menu-dropdown { 393 + position: absolute; 394 + background: #ffffff; 395 + top: 44px; 396 + padding: 2px; 397 + border: 1px solid {$lightgreyborder}; 398 + box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.25); 399 + } 400 + 401 + 392 402 /* - Application Menu ---------------------------------------------------------- 393 403 394 404 Styles unique to the application menu (right button on mobile).
+22 -4
webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js
··· 6 6 * javelin-vector 7 7 * javelin-dom 8 8 * javelin-uri 9 + * javelin-behavior-device 9 10 */ 10 11 11 12 JX.behavior('aphlict-dropdown', function(config, statics) { ··· 13 14 statics.visible = statics.visible || null; 14 15 15 16 var dropdown = JX.$(config.dropdownID); 16 - var count = JX.$(config.countID); 17 17 var bubble = JX.$(config.bubbleID); 18 + 19 + var count; 20 + if (config.countID) { 21 + count = JX.$(config.countID); 22 + } 23 + 18 24 var request = null; 19 - var dirty = true; 25 + var dirty = config.local ? false : true; 20 26 21 27 function refresh() { 22 28 if (dirty) { ··· 86 92 return; 87 93 } 88 94 95 + if (config.desktop && JX.Device.getDevice() != 'desktop') { 96 + return; 97 + } 98 + 89 99 e.kill(); 90 100 91 101 // If a menu is currently open, close it. ··· 108 118 } 109 119 110 120 var p = JX.$V(bubble); 121 + JX.DOM.show(dropdown); 122 + 111 123 p.y = null; 112 - p.x -= 6; 124 + if (config.right) { 125 + p.x -= (JX.Vector.getDim(dropdown).x - JX.Vector.getDim(bubble).x); 126 + } else { 127 + p.x -= 6; 128 + } 113 129 p.setPos(dropdown); 114 130 115 - JX.DOM.show(dropdown); 116 131 statics.visible = dropdown; 117 132 } 118 133 ); 119 134 120 135 JX.Stratcom.listen('notification-panel-update', null, function() { 136 + if (config.local) { 137 + return; 138 + } 121 139 dirty = true; 122 140 refresh(); 123 141 });
+4
webroot/rsrc/js/core/DropdownMenu.js
··· 77 77 78 78 this._open = true; 79 79 this._show(); 80 + 81 + return this; 80 82 }, 81 83 82 84 close : function() { ··· 85 87 } 86 88 this._open = false; 87 89 this._hide(); 90 + 91 + return this; 88 92 }, 89 93 90 94 clear : function() {