1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Embed dashboard panels in comments

Summary: Fixes T4983, Panel prefix 'W' should be recognized as a shortcut to a dashboard panel

Test Plan: Open any comment input, type '{W1}', or other existing panel, preview should embed that panel.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T4983

Differential Revision: https://secure.phabricator.com/D9215
This commit is contained in:
lkassianik 2014-05-20 10:53:27 -07:00 committed by epriestley
parent b38ad4e45a
commit 8a429c51ac
3 changed files with 38 additions and 0 deletions

View file

@ -1489,6 +1489,7 @@ phutil_register_library_map(array(
'PhabricatorDashboardPanelTypeText' => 'applications/dashboard/paneltype/PhabricatorDashboardPanelTypeText.php',
'PhabricatorDashboardPanelViewController' => 'applications/dashboard/controller/PhabricatorDashboardPanelViewController.php',
'PhabricatorDashboardQuery' => 'applications/dashboard/query/PhabricatorDashboardQuery.php',
'PhabricatorDashboardRemarkupRule' => 'applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php',
'PhabricatorDashboardRemovePanelController' => 'applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php',
'PhabricatorDashboardRenderingEngine' => 'applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php',
'PhabricatorDashboardSearchEngine' => 'applications/dashboard/query/PhabricatorDashboardSearchEngine.php',
@ -4284,6 +4285,7 @@ phutil_register_library_map(array(
'PhabricatorDashboardPanelTypeText' => 'PhabricatorDashboardPanelType',
'PhabricatorDashboardPanelViewController' => 'PhabricatorDashboardController',
'PhabricatorDashboardQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorDashboardRemarkupRule' => 'PhabricatorRemarkupRuleObject',
'PhabricatorDashboardRemovePanelController' => 'PhabricatorDashboardController',
'PhabricatorDashboardRenderingEngine' => 'Phobject',
'PhabricatorDashboardSearchEngine' => 'PhabricatorApplicationSearchEngine',

View file

@ -41,6 +41,12 @@ final class PhabricatorApplicationDashboard extends PhabricatorApplication {
);
}
public function getRemarkupRules() {
return array(
new PhabricatorDashboardRemarkupRule(),
);
}
public function shouldAppearInLaunchView() {
return false;
}

View file

@ -0,0 +1,30 @@
<?php
final class PhabricatorDashboardRemarkupRule
extends PhabricatorRemarkupRuleObject {
protected function getObjectNamePrefix() {
return 'W';
}
protected function loadObjects(array $ids) {
$viewer = $this->getEngine()->getConfig('viewer');
return id(new PhabricatorDashboardPanelQuery())
->setViewer($viewer)
->withIDs($ids)
->execute();
}
protected function renderObjectEmbed($object, $handle, $options) {
$viewer = $this->getEngine()->getConfig('viewer');
return id(new PhabricatorDashboardPanelRenderingEngine())
->setViewer($viewer)
->setPanel($object)
->setParentPanelPHIDs(array())
->renderPanel();
}
}