From d054f87f93e5598b8312393e0b396e03d6d2f343 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 3 Feb 2017 09:20:17 -0800 Subject: [PATCH] Make drag-and-drop to upload files work on any Home dashboard, not just "Magic Home" Summary: Ref T12174. Drag-and-drop-to-upload requires some stuff in the document. Put that stuff on all the content pages (currently: dashboards, magic home), not just the builtin home. Test Plan: - Dragged-and-dropped onto a Home dashbboard to upload. - Viewed, and dragged-and-dropped onto "builtin home" to upload. - Dragged onto "Edit Menu" for home, no upload. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12174 Differential Revision: https://secure.phabricator.com/D17307 --- .../PhabricatorHomeProfileMenuEngine.php | 18 ++++++++++++++++++ src/applications/home/view/PHUIHomeView.php | 9 --------- .../engine/PhabricatorProfileMenuEngine.php | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php b/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php index d7ecd9db6f..cbfe62aaa6 100644 --- a/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php +++ b/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php @@ -11,6 +11,24 @@ final class PhabricatorHomeProfileMenuEngine return "/home/menu/{$path}"; } + protected function buildItemViewContent( + PhabricatorProfileMenuItemConfiguration $item) { + $viewer = $this->getViewer(); + + // Add content to the document so that you can drag-and-drop files onto + // the home page or any home dashboard to upload them. + + $upload = id(new PhabricatorGlobalUploadTargetView()) + ->setUser($viewer); + + $content = parent::buildItemViewContent($item); + + return array( + $content, + $upload, + ); + } + protected function getBuiltinProfileItems($object) { $viewer = $this->getViewer(); $items = array(); diff --git a/src/applications/home/view/PHUIHomeView.php b/src/applications/home/view/PHUIHomeView.php index e68643f6d3..c511908326 100644 --- a/src/applications/home/view/PHUIHomeView.php +++ b/src/applications/home/view/PHUIHomeView.php @@ -12,15 +12,6 @@ final class PHUIHomeView } protected function getTagContent() { - $viewer = $this->getViewer(); - - return array( - $this->buildMainResponse(), - id(new PhabricatorGlobalUploadTargetView())->setUser($viewer), - ); - } - - private function buildMainResponse() { require_celerity_resource('phabricator-dashboard-css'); $viewer = $this->getViewer(); diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php index 8cd64763bb..f41424a4e7 100644 --- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php +++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php @@ -685,7 +685,7 @@ abstract class PhabricatorProfileMenuEngine extends Phobject { ->setURI($this->getConfigureURI()); } - private function buildItemViewContent( + protected function buildItemViewContent( PhabricatorProfileMenuItemConfiguration $item) { return $item->newPageContent(); }