Page MenuHomePhabricator

D15253.diff
No OneTemporary

D15253.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -93,7 +93,7 @@
'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43',
'rsrc/css/application/policy/policy.css' => '957ea14c',
'rsrc/css/application/ponder/ponder-view.css' => '7b0df4da',
- 'rsrc/css/application/project/project-card-view.css' => '9c3631e5',
+ 'rsrc/css/application/project/project-card-view.css' => '9418c97d',
'rsrc/css/application/project/project-view.css' => '4693497c',
'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733',
'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5',
@@ -854,7 +854,7 @@
'policy-edit-css' => '815c66f7',
'policy-transaction-detail-css' => '82100a43',
'ponder-view-css' => '7b0df4da',
- 'project-card-view-css' => '9c3631e5',
+ 'project-card-view-css' => '9418c97d',
'project-view-css' => '4693497c',
'releeph-core' => '9b3c5733',
'releeph-preview-branch' => 'b7a6f4a5',
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
@@ -2904,6 +2904,7 @@
'PhabricatorProjectHeraldAction' => 'applications/project/herald/PhabricatorProjectHeraldAction.php',
'PhabricatorProjectHeraldAdapter' => 'applications/project/herald/PhabricatorProjectHeraldAdapter.php',
'PhabricatorProjectHeraldFieldGroup' => 'applications/project/herald/PhabricatorProjectHeraldFieldGroup.php',
+ 'PhabricatorProjectHovercardEngineExtension' => 'applications/project/engineextension/PhabricatorProjectHovercardEngineExtension.php',
'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php',
'PhabricatorProjectIconsConfigOptionType' => 'applications/project/config/PhabricatorProjectIconsConfigOptionType.php',
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
@@ -3376,6 +3377,7 @@
'PhabricatorUnsubscribedFromObjectEdgeType' => 'applications/transactions/edges/PhabricatorUnsubscribedFromObjectEdgeType.php',
'PhabricatorUser' => 'applications/people/storage/PhabricatorUser.php',
'PhabricatorUserBlurbField' => 'applications/people/customfield/PhabricatorUserBlurbField.php',
+ 'PhabricatorUserCardView' => 'applications/people/view/PhabricatorUserCardView.php',
'PhabricatorUserConfigOptions' => 'applications/people/config/PhabricatorUserConfigOptions.php',
'PhabricatorUserConfiguredCustomField' => 'applications/people/customfield/PhabricatorUserConfiguredCustomField.php',
'PhabricatorUserConfiguredCustomFieldStorage' => 'applications/people/storage/PhabricatorUserConfiguredCustomFieldStorage.php',
@@ -3828,7 +3830,6 @@
'ProjectDefaultJoinCapability' => 'applications/project/capability/ProjectDefaultJoinCapability.php',
'ProjectDefaultViewCapability' => 'applications/project/capability/ProjectDefaultViewCapability.php',
'ProjectEditConduitAPIMethod' => 'applications/project/conduit/ProjectEditConduitAPIMethod.php',
- 'ProjectHovercardEngineExtension' => 'applications/project/events/ProjectHovercardEngineExtension.php',
'ProjectQueryConduitAPIMethod' => 'applications/project/conduit/ProjectQueryConduitAPIMethod.php',
'ProjectRemarkupRule' => 'applications/project/remarkup/ProjectRemarkupRule.php',
'ProjectRemarkupRuleTestCase' => 'applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php',
@@ -7338,6 +7339,7 @@
'PhabricatorProjectHeraldAction' => 'HeraldAction',
'PhabricatorProjectHeraldAdapter' => 'HeraldAdapter',
'PhabricatorProjectHeraldFieldGroup' => 'HeraldFieldGroup',
+ 'PhabricatorProjectHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
'PhabricatorProjectIconSet' => 'PhabricatorIconSet',
'PhabricatorProjectIconsConfigOptionType' => 'PhabricatorConfigJSONOptionType',
'PhabricatorProjectListController' => 'PhabricatorProjectController',
@@ -7887,6 +7889,7 @@
'PhabricatorFulltextInterface',
),
'PhabricatorUserBlurbField' => 'PhabricatorUserCustomField',
+ 'PhabricatorUserCardView' => 'AphrontTagView',
'PhabricatorUserConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorUserConfiguredCustomField' => array(
'PhabricatorUserCustomField',
@@ -8474,7 +8477,6 @@
'ProjectDefaultJoinCapability' => 'PhabricatorPolicyCapability',
'ProjectDefaultViewCapability' => 'PhabricatorPolicyCapability',
'ProjectEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
- 'ProjectHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
'ProjectQueryConduitAPIMethod' => 'ProjectConduitAPIMethod',
'ProjectRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'ProjectRemarkupRuleTestCase' => 'PhabricatorTestCase',
diff --git a/src/applications/people/engineextension/PeopleHovercardEngineExtension.php b/src/applications/people/engineextension/PeopleHovercardEngineExtension.php
--- a/src/applications/people/engineextension/PeopleHovercardEngineExtension.php
+++ b/src/applications/people/engineextension/PeopleHovercardEngineExtension.php
@@ -25,6 +25,7 @@
->setViewer($viewer)
->withPHIDs($phids)
->needAvailability(true)
+ ->needProfileImage(true)
->needProfile(true)
->needBadges(true)
->execute();
@@ -47,69 +48,12 @@
return;
}
- $hovercard->setTitle($user->getUsername());
+ $user_card = id(new PhabricatorUserCardView())
+ ->setProfile($user)
+ ->setViewer($viewer);
- $profile = $user->getUserProfile();
- $detail = $user->getRealName();
- if ($profile->getTitle()) {
- $detail .= ' - '.$profile->getTitle();
- }
- $hovercard->setDetail($detail);
-
- if ($user->getIsDisabled()) {
- $hovercard->addField(pht('Account'), pht('Disabled'));
- } else if (!$user->isUserActivated()) {
- $hovercard->addField(pht('Account'), pht('Not Activated'));
- } else if (PhabricatorApplication::isClassInstalledForViewer(
- 'PhabricatorCalendarApplication',
- $viewer)) {
- $hovercard->addField(
- pht('Status'),
- $user->getAvailabilityDescription($viewer));
- }
-
- $hovercard->addField(
- pht('User Since'),
- phabricator_date($user->getDateCreated(), $viewer));
+ $hovercard->appendChild($user_card);
- if ($profile->getBlurb()) {
- $hovercard->addField(pht('Blurb'),
- id(new PhutilUTF8StringTruncator())
- ->setMaximumGlyphs(120)
- ->truncateString($profile->getBlurb()));
- }
-
- $badges = $this->buildBadges($user, $viewer);
- foreach ($badges as $badge) {
- $hovercard->addBadge($badge);
- }
- }
-
- private function buildBadges(
- PhabricatorUser $user,
- $viewer) {
-
- $class = 'PhabricatorBadgesApplication';
- $items = array();
-
- if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
- $badge_phids = $user->getBadgePHIDs();
- if ($badge_phids) {
- $badges = id(new PhabricatorBadgesQuery())
- ->setViewer($viewer)
- ->withPHIDs($badge_phids)
- ->withStatuses(array(PhabricatorBadgesBadge::STATUS_ACTIVE))
- ->execute();
-
- foreach ($badges as $badge) {
- $items[] = id(new PHUIBadgeMiniView())
- ->setIcon($badge->getIcon())
- ->setHeader($badge->getName())
- ->setQuality($badge->getQuality());
- }
- }
- }
- return $items;
}
}
diff --git a/src/applications/people/view/PhabricatorUserCardView.php b/src/applications/people/view/PhabricatorUserCardView.php
new file mode 100644
--- /dev/null
+++ b/src/applications/people/view/PhabricatorUserCardView.php
@@ -0,0 +1,151 @@
+<?php
+
+final class PhabricatorUserCardView extends AphrontTagView {
+
+ private $profile;
+ private $viewer;
+ private $tag;
+
+ public function setProfile(PhabricatorUser $profile) {
+ $this->profile = $profile;
+ return $this;
+ }
+
+ public function setViewer(PhabricatorUser $viewer) {
+ $this->viewer = $viewer;
+ return $this;
+ }
+
+ public function setTag($tag) {
+ $this->tag = $tag;
+ return $this;
+ }
+
+ protected function getTagName() {
+ if ($this->tag) {
+ return $this->tag;
+ }
+ return 'div';
+ }
+
+ protected function getTagAttributes() {
+ $classes = array();
+ $classes[] = 'project-card-view';
+
+ if ($this->profile->getIsDisabled()) {
+ $classes[] = 'project-card-grey';
+ } else {
+ $classes[] = 'project-card-blue';
+ }
+
+ return array(
+ 'class' => implode($classes, ' '),
+ );
+ }
+
+ protected function getTagContent() {
+
+ $user = $this->profile;
+ $profile = $user->loadUserProfile();
+ $picture = $user->getProfileImageURI();
+ $viewer = $this->viewer;
+
+ require_celerity_resource('project-card-view-css');
+
+ $profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon());
+ $profile_title = $profile->getDisplayTitle();
+
+ $tag = id(new PHUITagView())
+ ->setIcon($profile_icon)
+ ->setName($profile_title)
+ ->addClass('project-view-header-tag')
+ ->setType(PHUITagView::TYPE_SHADE);
+
+ $header = id(new PHUIHeaderView())
+ ->setHeader(array($user->getFullName(), $tag))
+ ->setUser($viewer)
+ ->setImage($picture);
+
+ $body = array();
+
+ $body[] = $this->addItem(
+ pht('User Since'),
+ phabricator_date($profile->getDateCreated(), $viewer));
+
+ if (PhabricatorApplication::isClassInstalledForViewer(
+ 'PhabricatorCalendarApplication',
+ $viewer)) {
+ $availability = $user->getAvailabilityDescription($viewer);
+ $body[] = $this->addItem(pht('Status'), $availability);
+ }
+
+ $badges = $this->buildBadges($user, $viewer);
+ if ($badges) {
+ $badges = id(new PHUIBadgeBoxView())
+ ->addItems($badges)
+ ->setCollapsed(true);
+ $body[] = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'phui-hovercard-body-item hovercard-badges',
+ ),
+ $badges);
+ }
+
+ $body = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'project-card-body',
+ ),
+ $body);
+
+ $card = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'project-card-inner',
+ ),
+ array(
+ $header,
+ $body,
+ ));
+
+ return $card;
+ }
+
+ private function addItem($label, $value) {
+ $item = array(
+ phutil_tag('strong', array(), $label),
+ ': ',
+ phutil_tag('span', array(), $value),
+ );
+ return phutil_tag_div('project-card-item', $item);
+ }
+
+ private function buildBadges(
+ PhabricatorUser $user,
+ $viewer) {
+
+ $class = 'PhabricatorBadgesApplication';
+ $items = array();
+
+ if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
+ $badge_phids = $user->getBadgePHIDs();
+ if ($badge_phids) {
+ $badges = id(new PhabricatorBadgesQuery())
+ ->setViewer($viewer)
+ ->withPHIDs($badge_phids)
+ ->withStatuses(array(PhabricatorBadgesBadge::STATUS_ACTIVE))
+ ->execute();
+
+ foreach ($badges as $badge) {
+ $items[] = id(new PHUIBadgeMiniView())
+ ->setIcon($badge->getIcon())
+ ->setHeader($badge->getName())
+ ->setQuality($badge->getQuality());
+ }
+ }
+ }
+ return $items;
+ }
+
+}
diff --git a/src/applications/project/events/ProjectHovercardEngineExtension.php b/src/applications/project/engineextension/PhabricatorProjectHovercardEngineExtension.php
rename from src/applications/project/events/ProjectHovercardEngineExtension.php
rename to src/applications/project/engineextension/PhabricatorProjectHovercardEngineExtension.php
--- a/src/applications/project/events/ProjectHovercardEngineExtension.php
+++ b/src/applications/project/engineextension/PhabricatorProjectHovercardEngineExtension.php
@@ -1,6 +1,6 @@
<?php
-final class ProjectHovercardEngineExtension
+final class PhabricatorProjectHovercardEngineExtension
extends PhabricatorHovercardEngineExtension {
const EXTENSIONKEY = 'project.card';
diff --git a/webroot/rsrc/css/application/project/project-card-view.css b/webroot/rsrc/css/application/project/project-card-view.css
--- a/webroot/rsrc/css/application/project/project-card-view.css
+++ b/webroot/rsrc/css/application/project/project-card-view.css
@@ -14,7 +14,7 @@
.project-card-view .phui-header-shell {
margin: 0;
- padding: 12px 12px 16px 12px;
+ padding: 12px 12px 4px 12px;
border: none;
border-radius: 3px;
}
@@ -43,6 +43,7 @@
.project-card-view .phui-header-subheader {
font-size: {$normalfontsize};
margin-top: 12px;
+ padding-bottom: 12px;
}
.project-card-view .phui-header-header .phui-tag-view {
@@ -63,6 +64,10 @@
color: {$bluetext};
}
+.project-card-view .project-card-body {
+ padding: 0 12px 12px 76px;
+ color: {$darkbluetext};
+}
/* Colors */

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 17, 7:05 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6715566
Default Alt Text
D15253.diff (12 KB)

Event Timeline