From 38ae1191def98ea5266f458deaec12a75ece84cd Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 25 Jun 2014 22:01:42 -0700 Subject: [PATCH] In standard property lists, render projects with tag UIs Summary: Ref T2628. There are a few UIs that need updates, but generally I want to show project icons everywhere that we show project names, to more strongly reinforce the ideas of projects being groups/tags/policies/etc. Test Plan: See screenshot. Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T2628 Differential Revision: https://secure.phabricator.com/D9709 --- src/applications/phid/PhabricatorObjectHandle.php | 12 ++++++++++++ .../events/PhabricatorProjectUIEventListener.php | 14 ++++++++++++-- webroot/rsrc/css/phui/phui-tag-view.css | 4 ++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/applications/phid/PhabricatorObjectHandle.php b/src/applications/phid/PhabricatorObjectHandle.php index be6b1c09e5..62fe85d9db 100644 --- a/src/applications/phid/PhabricatorObjectHandle.php +++ b/src/applications/phid/PhabricatorObjectHandle.php @@ -30,6 +30,10 @@ final class PhabricatorObjectHandle return $this->getTypeIcon(); } + public function getIconColor() { + return 'bluegrey'; + } + public function getTypeIcon() { if ($this->getPHIDType()) { return $this->getPHIDType()->getTypeIcon(); @@ -255,6 +259,14 @@ final class PhabricatorObjectHandle array($icon, $name)); } + public function renderTag() { + return id(new PHUITagView()) + ->setType(PHUITagView::TYPE_OBJECT) + ->setIcon($this->getIcon().' '.$this->getIconColor()) + ->setHref($this->getURI()) + ->setName($this->getLinkName()); + } + public function getLinkName() { switch ($this->getType()) { case PhabricatorPeoplePHIDTypeUser::TYPECONST: diff --git a/src/applications/project/events/PhabricatorProjectUIEventListener.php b/src/applications/project/events/PhabricatorProjectUIEventListener.php index 0cd80875c1..7bf62b91f8 100644 --- a/src/applications/project/events/PhabricatorProjectUIEventListener.php +++ b/src/applications/project/events/PhabricatorProjectUIEventListener.php @@ -45,9 +45,19 @@ final class PhabricatorProjectUIEventListener if ($handles) { $list = array(); foreach ($handles as $handle) { - $list[] = $handle->renderLink(); + $list[] = phutil_tag( + 'li', + array( + 'class' => 'phabricator-handle-tag-list-item', + ), + $handle->renderTag()); } - $list = phutil_implode_html(phutil_tag('br'), $list); + $list = phutil_tag( + 'ul', + array( + 'class' => 'phabricator-handle-tag-list', + ), + $list); } else { $list = phutil_tag('em', array(), pht('None')); } diff --git a/webroot/rsrc/css/phui/phui-tag-view.css b/webroot/rsrc/css/phui/phui-tag-view.css index fb3aabf270..bdee25210d 100644 --- a/webroot/rsrc/css/phui/phui-tag-view.css +++ b/webroot/rsrc/css/phui/phui-tag-view.css @@ -300,3 +300,7 @@ a.phui-tag-view:hover.phui-tag-shade-checkered .phui-tag-core { a.phui-tag-view:hover.phui-tag-shade-disabled .phui-tag-core { border-color: {$sh-disabledborder}; } + +.phabricator-handle-tag-list-item + .phabricator-handle-tag-list-item { + margin-top: 4px; +}