Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2682385
D25303.1734657289.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
7 KB
Referenced Files
None
Subscribers
None
D25303.1734657289.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -159,7 +159,7 @@
'rsrc/css/phui/phui-formation-view.css' => 'd2dec8ed',
'rsrc/css/phui/phui-head-thing.css' => 'd7f293df',
'rsrc/css/phui/phui-header-view.css' => '36c86a58',
- 'rsrc/css/phui/phui-hovercard.css' => '6ca90fa0',
+ 'rsrc/css/phui/phui-hovercard.css' => '0812717d',
'rsrc/css/phui/phui-icon-set-selector.css' => '7aa5f3ec',
'rsrc/css/phui/phui-icon.css' => '4cbc684a',
'rsrc/css/phui/phui-image-mask.css' => '62c7f4d2',
@@ -855,7 +855,7 @@
'phui-header-view-css' => '36c86a58',
'phui-hovercard' => '6199f752',
'phui-hovercard-list' => 'de4b4919',
- 'phui-hovercard-view-css' => '6ca90fa0',
+ 'phui-hovercard-view-css' => '0812717d',
'phui-icon-set-selector-css' => '7aa5f3ec',
'phui-icon-view-css' => '4cbc684a',
'phui-image-mask-css' => '62c7f4d2',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -318,7 +318,6 @@
'CelerityDefaultPostprocessor' => 'applications/celerity/postprocessor/CelerityDefaultPostprocessor.php',
'CelerityHighContrastPostprocessor' => 'applications/celerity/postprocessor/CelerityHighContrastPostprocessor.php',
'CelerityLargeFontPostprocessor' => 'applications/celerity/postprocessor/CelerityLargeFontPostprocessor.php',
- 'CelerityManagementGenerateSpritesWorkflow' => 'applications/celerity/management/CelerityManagementGenerateSpritesWorkflow.php',
'CelerityManagementMapWorkflow' => 'applications/celerity/management/CelerityManagementMapWorkflow.php',
'CelerityManagementSyntaxWorkflow' => 'applications/celerity/management/CelerityManagementSyntaxWorkflow.php',
'CelerityManagementWorkflow' => 'applications/celerity/management/CelerityManagementWorkflow.php',
@@ -5641,6 +5640,7 @@
'PhrictionEditEngineController' => 'applications/phriction/controller/PhrictionEditEngineController.php',
'PhrictionHistoryConduitAPIMethod' => 'applications/phriction/conduit/PhrictionHistoryConduitAPIMethod.php',
'PhrictionHistoryController' => 'applications/phriction/controller/PhrictionHistoryController.php',
+ 'PhrictionHovercardEngineExtension' => 'applications/phriction/engineextension/PhrictionHovercardEngineExtension.php',
'PhrictionInfoConduitAPIMethod' => 'applications/phriction/conduit/PhrictionInfoConduitAPIMethod.php',
'PhrictionListController' => 'applications/phriction/controller/PhrictionListController.php',
'PhrictionMarkupPreviewController' => 'applications/phriction/controller/PhrictionMarkupPreviewController.php',
@@ -6312,7 +6312,6 @@
'CelerityDefaultPostprocessor' => 'CelerityPostprocessor',
'CelerityHighContrastPostprocessor' => 'CelerityPostprocessor',
'CelerityLargeFontPostprocessor' => 'CelerityPostprocessor',
- 'CelerityManagementGenerateSpritesWorkflow' => 'CelerityManagementWorkflow',
'CelerityManagementMapWorkflow' => 'CelerityManagementWorkflow',
'CelerityManagementSyntaxWorkflow' => 'CelerityManagementWorkflow',
'CelerityManagementWorkflow' => 'PhabricatorManagementWorkflow',
@@ -12539,6 +12538,7 @@
'PhrictionEditEngineController' => 'PhrictionController',
'PhrictionHistoryConduitAPIMethod' => 'PhrictionConduitAPIMethod',
'PhrictionHistoryController' => 'PhrictionController',
+ 'PhrictionHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
'PhrictionInfoConduitAPIMethod' => 'PhrictionConduitAPIMethod',
'PhrictionListController' => 'PhrictionController',
'PhrictionMarkupPreviewController' => 'PhabricatorController',
diff --git a/src/applications/phriction/engineextension/PhrictionHovercardEngineExtension.php b/src/applications/phriction/engineextension/PhrictionHovercardEngineExtension.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phriction/engineextension/PhrictionHovercardEngineExtension.php
@@ -0,0 +1,99 @@
+<?php
+
+final class PhrictionHovercardEngineExtension
+ extends PhabricatorHovercardEngineExtension {
+
+ const EXTENSIONKEY = 'phriction';
+
+ public function isExtensionEnabled() {
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorPhrictionApplication');
+ }
+
+ public function getExtensionName() {
+ return pht('Wiki Documents');
+ }
+
+ public function canRenderObjectHovercard($object) {
+ return ($object instanceof PhrictionDocument);
+ }
+
+ public function renderHovercard(
+ PHUIHovercardView $hovercard,
+ PhabricatorObjectHandle $handle,
+ $object,
+ $data) {
+
+ $viewer = $this->getViewer();
+
+ $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $object->getPHID(),
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
+
+ $has_projects = (bool)$project_phids;
+ $project_phids = array_reverse($project_phids);
+ $project_handles = $viewer->loadHandles($project_phids);
+
+ $detail_content = array(
+ id(new PHUIIconView())->setIcon('fa-book'),
+ pht('Wiki Document'),
+ );
+
+ if ($has_projects) {
+ $list = id(new PHUIHandleTagListView())
+ ->setHandles($project_handles)
+ ->setSlim(true)
+ ->setShowHovercards(false);
+
+ $detail_content[] = " \xC2\xB7 ";
+ $detail_content[] = $list;
+ }
+
+ $hovercard->setDetail(
+ phutil_tag(
+ 'div',
+ array(
+ 'class' => 'phui-hovercard-object-type',
+ ),
+ $detail_content));
+
+ $ancestors = $object->getAncestors();
+ // remove Wiki homepage
+ array_shift($ancestors);
+
+ $ancestor_phids = mpull($ancestors, 'getPHID');
+ $ancestor_handles = array();
+ if ($ancestor_phids) {
+ $ancestor_handles = $viewer->loadHandles($ancestor_phids);
+ $breadcrumbs = array();
+ foreach ($ancestor_handles as $ancestor_handle) {
+ $breadcrumbs[] = phutil_tag(
+ 'a',
+ array(
+ 'href' => $ancestor_handle->getUri(),
+ ),
+ $ancestor_handle->getName());
+ $breadcrumbs[] = id(new PHUIIconView())
+ ->setIcon('fa-angle-right')
+ ->addClass('phui-crumb-divider');
+ }
+ array_pop($breadcrumbs);
+ $hovercard->addField(
+ pht('Parent Docs'),
+ $breadcrumbs);
+ }
+
+ $content = $object->getContent();
+
+ if ($content) {
+ $hovercard->addField(
+ pht('Last Author'),
+ $viewer->renderHandle($content->getAuthorPHID()));
+
+ $hovercard->addField(
+ pht('Last Edited'),
+ phabricator_dual_datetime($content->getDateCreated(), $viewer));
+ }
+ }
+
+}
diff --git a/webroot/rsrc/css/phui/phui-hovercard.css b/webroot/rsrc/css/phui/phui-hovercard.css
--- a/webroot/rsrc/css/phui/phui-hovercard.css
+++ b/webroot/rsrc/css/phui/phui-hovercard.css
@@ -115,3 +115,20 @@
.hovercard-task-view .phui-oi-disabled.phui-workcard {
background-color: #fff;
}
+
+.phui-hovercard-object-type {
+ font-size: 12px;
+}
+
+.phui-hovercard-object-type .phui-icon-view {
+ margin-right: 5px;
+}
+
+.phui-hovercard-object-type .phabricator-handle-tag-list {
+ display: inline;
+}
+
+.phui-hovercard-object-type .phabricator-handle-tag-list-item {
+ display: inline-block;
+ margin: 0 4px 2px 0;
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 01:14 (20 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1016313
Default Alt Text
D25303.1734657289.diff (7 KB)
Attached To
Mode
D25303: Implements a more informative hovercard for wiki documents
Attached
Detach File
Event Timeline
Log In to Comment