mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Project Hovercards: Show Description
Summary: Fixes T15275. Test Plan: Project pages have "Developer > View Hovercard" button. Or hover over a project handle, I guess. Also test for empty description and with the description field disabled. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15275 Differential Revision: https://we.phorge.it/D25331
This commit is contained in:
parent
71f38a90a3
commit
d5a28e12a0
2 changed files with 42 additions and 0 deletions
|
@ -28,6 +28,26 @@ final class PhabricatorProjectHovercardEngineExtension
|
|||
->execute();
|
||||
$projects = mpull($projects, null, 'getPHID');
|
||||
|
||||
$custom_fields = array();
|
||||
foreach ($projects as $project) {
|
||||
$field = PhabricatorCustomField::getObjectField(
|
||||
$project,
|
||||
PhabricatorCustomField::ROLE_VIEW,
|
||||
'std:project:internal:description');
|
||||
if ($field === null) {
|
||||
// This means the field is disabled, it would always be null.
|
||||
break;
|
||||
}
|
||||
$field
|
||||
->setViewer($viewer)
|
||||
->readValueFromObject($project);
|
||||
$custom_fields[] = $field;
|
||||
}
|
||||
|
||||
id(new PhabricatorCustomFieldStorageQuery())
|
||||
->addFields($custom_fields)
|
||||
->execute();
|
||||
|
||||
return array(
|
||||
'projects' => $projects,
|
||||
);
|
||||
|
|
|
@ -68,6 +68,28 @@ final class PhabricatorProjectCardView extends AphrontTagView {
|
|||
|
||||
$description = null;
|
||||
|
||||
// This getProxy() feels hacky - see also PhabricatorProjectDatasource:67
|
||||
$description_field = PhabricatorCustomField::getObjectField(
|
||||
$project,
|
||||
PhabricatorCustomField::ROLE_VIEW,
|
||||
'std:project:internal:description');
|
||||
|
||||
if ($description_field !== null) {
|
||||
$description_field = $description_field->getProxy();
|
||||
|
||||
$description = $description_field->getFieldValue();
|
||||
if (phutil_nonempty_string($description)) {
|
||||
$description = PhabricatorMarkupEngine::summarizeSentence($description);
|
||||
$description = id(new PHUIRemarkupView($viewer, $description))
|
||||
->setContextObject($project);
|
||||
|
||||
$description = phutil_tag(
|
||||
'div',
|
||||
array('class' => 'project-card-body phui-header-shell'),
|
||||
$description);
|
||||
}
|
||||
}
|
||||
|
||||
$card = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
|
|
Loading…
Reference in a new issue