diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ 'names' => array( 'conpherence.pkg.css' => '3c8a0668', 'conpherence.pkg.js' => '020aebcf', - 'core.pkg.css' => '3b565a84', + 'core.pkg.css' => '2d4810eb', 'core.pkg.js' => 'a568e834', 'differential.pkg.css' => '8d8360fb', 'differential.pkg.js' => '67e02996', @@ -58,7 +58,7 @@ 'rsrc/css/application/contentsource/content-source-view.css' => 'cdf0d579', 'rsrc/css/application/countdown/timer.css' => 'bff8012f', 'rsrc/css/application/daemon/bulk-job.css' => '73af99f5', - 'rsrc/css/application/dashboard/dashboard.css' => '4267d6c6', + 'rsrc/css/application/dashboard/dashboard.css' => '5a205b9d', 'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d', 'rsrc/css/application/differential/add-comment.css' => '7e5900d9', 'rsrc/css/application/differential/changeset-view.css' => 'bde53589', @@ -765,7 +765,7 @@ 'phabricator-countdown-css' => 'bff8012f', 'phabricator-darklog' => '3b869402', 'phabricator-darkmessage' => '26cd4b73', - 'phabricator-dashboard-css' => '4267d6c6', + 'phabricator-dashboard-css' => '5a205b9d', 'phabricator-diff-changeset' => 'd0a85a85', 'phabricator-diff-changeset-list' => '04023d82', 'phabricator-diff-inline' => 'a4a14a94', diff --git a/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php b/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php --- a/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php @@ -42,8 +42,7 @@ return new Aphront404Response(); } - $redirect_uri = $this->getApplicationURI( - 'arrange/'.$dashboard->getID().'/'); + $redirect_uri = $dashboard->getURI(); $layout_config = $dashboard->getLayoutConfigObject(); if ($request->isFormPost()) { diff --git a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php --- a/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php +++ b/src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php @@ -9,28 +9,35 @@ $engine = id(new PhabricatorDashboardPanelEditEngine()) ->setController($this); + // We can create or edit a panel in the context of a dashboard. If we + // started on a dashboard, we want to return to that dashboard when we're + // done editing. + $dashboard_id = $request->getStr('dashboardID'); + if (strlen($dashboard_id)) { + $dashboard = id(new PhabricatorDashboardQuery()) + ->setViewer($viewer) + ->withIDs(array($dashboard_id)) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + PhabricatorPolicyCapability::CAN_EDIT, + )) + ->executeOne(); + if (!$dashboard) { + return new Aphront404Response(); + } + + $engine + ->setDashboard($dashboard) + ->addContextParameter('dashboardID', $dashboard_id); + } else { + $dashboard = null; + } + $id = $request->getURIData('id'); if (!$id) { - $dashboard_id = $request->getStr('dashboardID'); $column_id = $request->getStr('columnID'); - if (strlen($dashboard_id)) { - $dashboard = id(new PhabricatorDashboardQuery()) - ->setViewer($viewer) - ->withIDs(array($dashboard_id)) - ->requireCapabilities( - array( - PhabricatorPolicyCapability::CAN_VIEW, - PhabricatorPolicyCapability::CAN_EDIT, - )) - ->executeOne(); - if (!$dashboard) { - return new Aphront404Response(); - } - } else { - $dashboard = null; - } - if ($dashboard) { $cancel_uri = $dashboard->getURI(); } else { @@ -45,10 +52,8 @@ $engine ->addContextParameter('panelType', $panel_type) - ->addContextParameter('dashboardID', $dashboard_id) ->addContextParameter('columnID', $column_id) ->setPanelType($panel_type) - ->setDashboard($dashboard) ->setColumnID($column_id); } diff --git a/src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php b/src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php --- a/src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php @@ -101,6 +101,15 @@ return parent::getEffectiveObjectEditDoneURI($object); } + protected function getObjectEditCancelURI($object) { + $dashboard = $this->getDashboard(); + if ($dashboard) { + return $dashboard->getURI(); + } + + return parent::getObjectEditCancelURI($object); + } + protected function getObjectEditTitleText($object) { return pht('Edit Panel: %s', $object->getName()); } diff --git a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php --- a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php +++ b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php @@ -277,10 +277,13 @@ private function addPanelHeaderActions( PHUIHeaderView $header) { - $panel = $this->getPanel(); + $viewer = $this->getViewer(); + $panel = $this->getPanel(); $dashboard_id = $this->getDashboardID(); + $actions = array(); + if ($panel) { $panel_id = $panel->getID(); @@ -290,12 +293,10 @@ $edit_uri->replaceQueryParam('dashboardID', $dashboard_id); } - $action_edit = id(new PHUIIconView()) + $actions[] = id(new PhabricatorActionView()) ->setIcon('fa-pencil') - ->setWorkflow(true) + ->setName(pht('Edit Panel')) ->setHref((string)$edit_uri); - - $header->addActionItem($action_edit); } if ($dashboard_id) { @@ -305,14 +306,28 @@ $remove_uri = id(new PhutilURI($remove_uri)) ->replaceQueryParam('panelPHID', $panel_phid); - $action_remove = id(new PHUIIconView()) - ->setIcon('fa-trash-o') + $actions[] = id(new PhabricatorActionView()) + ->setIcon('fa-times') ->setHref((string)$remove_uri) + ->setName(pht('Remove Panel')) ->setWorkflow(true); + } + + $dropdown_menu = id(new PhabricatorActionListView()) + ->setViewer($viewer); - $header->addActionItem($action_remove); + foreach ($actions as $action) { + $dropdown_menu->addAction($action); } + $action_menu = id(new PHUIButtonView()) + ->setTag('a') + ->setIcon('fa-cog') + ->setText(pht('Manage Panel')) + ->setDropdownMenu($dropdown_menu); + + $header->addActionLink($action_menu); + return $header; } diff --git a/webroot/rsrc/css/application/dashboard/dashboard.css b/webroot/rsrc/css/application/dashboard/dashboard.css --- a/webroot/rsrc/css/application/dashboard/dashboard.css +++ b/webroot/rsrc/css/application/dashboard/dashboard.css @@ -54,7 +54,7 @@ } .grippable .aphront-multi-column-column .dashboard-box.phui-object-box:hover { - box-shadow: {$dropshadow}; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.10); } .grippable .aphront-multi-column-column .dashboard-box.phui-object-box:hover