Page MenuHomePhabricator

D17451.id41959.diff
No OneTemporary

D17451.id41959.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -9,7 +9,7 @@
'names' => array(
'conpherence.pkg.css' => '6875302f',
'conpherence.pkg.js' => '6249a1cf',
- 'core.pkg.css' => 'c0340df0',
+ 'core.pkg.css' => '10de0483',
'core.pkg.js' => '1fa7c0c5',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '90b30783',
@@ -167,7 +167,7 @@
'rsrc/css/phui/phui-segment-bar-view.css' => 'b1d1b892',
'rsrc/css/phui/phui-spacing.css' => '042804d6',
'rsrc/css/phui/phui-status.css' => 'd5263e49',
- 'rsrc/css/phui/phui-tag-view.css' => '84d65f26',
+ 'rsrc/css/phui/phui-tag-view.css' => '51354cd2',
'rsrc/css/phui/phui-timeline-view.css' => 'bf45789e',
'rsrc/css/phui/phui-two-column-view.css' => '8a1074c7',
'rsrc/css/phui/workboards/phui-workboard-color.css' => '783cdff5',
@@ -887,7 +887,7 @@
'phui-segment-bar-view-css' => 'b1d1b892',
'phui-spacing-css' => '042804d6',
'phui-status-list-view-css' => 'd5263e49',
- 'phui-tag-view-css' => '84d65f26',
+ 'phui-tag-view-css' => '51354cd2',
'phui-theme-css' => '9f261c6b',
'phui-timeline-view-css' => 'bf45789e',
'phui-two-column-view-css' => '8a1074c7',
diff --git a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
--- a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
+++ b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
@@ -333,6 +333,8 @@
"task", "feature", or "bug".
- `name` //Required string.// Human-readable name for this subtype, like
"Task", "Feature Request" or "Bug Report".
+ - `icon` //Optional string.// Display icon for this subtype.
+ - `color` //Optioinal string.// Display color for this subtype.
Each subtype must have a unique key, and you must define a subtype with
the key "%s", which is used as a default subtype.
diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -240,6 +240,25 @@
}
}
+ $subtype_key = $task->getSubtype();
+ if ($subtype_key != PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT) {
+ $subtype_map = $task->newEditEngineSubtypeMap();
+ $subtype = idx($subtype_map, $subtype_key);
+ if ($subtype) {
+ $subtype_tag = id(new PHUITagView())
+ ->setName($subtype->getName())
+ ->setIcon($subtype->getIcon())
+ ->setType(PHUITagView::TYPE_SHADE);
+
+ $color = $subtype->getColor();
+ if ($color) {
+ $subtype_tag->setShade($color);
+ }
+
+ $view->addTag($subtype_tag);
+ }
+ }
+
return $view;
}
diff --git a/src/applications/maniphest/typeahead/ManiphestTaskSubtypeDatasource.php b/src/applications/maniphest/typeahead/ManiphestTaskSubtypeDatasource.php
--- a/src/applications/maniphest/typeahead/ManiphestTaskSubtypeDatasource.php
+++ b/src/applications/maniphest/typeahead/ManiphestTaskSubtypeDatasource.php
@@ -32,6 +32,7 @@
$result = id(new PhabricatorTypeaheadResult())
->setIcon($subtype->getIcon())
+ ->setColor($subtype->getColor())
->setPHID($key)
->setName($subtype->getName());
diff --git a/src/applications/maniphest/view/ManiphestTaskListView.php b/src/applications/maniphest/view/ManiphestTaskListView.php
--- a/src/applications/maniphest/view/ManiphestTaskListView.php
+++ b/src/applications/maniphest/view/ManiphestTaskListView.php
@@ -56,6 +56,9 @@
Javelin::initBehavior('maniphest-list-editor');
}
+ $subtype_map = id(new ManiphestTask())
+ ->newEditEngineSubtypeMap();
+
foreach ($this->tasks as $task) {
$item = id(new PHUIObjectItemView())
->setUser($this->getUser())
@@ -94,6 +97,29 @@
$item->addSigil('maniphest-task');
}
+ $subtype_key = $task->getSubtype();
+ if ($subtype_key != PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT) {
+ $subtype = idx($subtype_map, $subtype_key);
+ if ($subtype) {
+ $subtype_tag = id(new PHUITagView())
+ ->setIcon($subtype->getIcon())
+ ->setSlimShady(true)
+ ->setType(PHUITagView::TYPE_SHADE)
+ ->addSigil('has-tooltip')
+ ->setMetadata(
+ array(
+ 'tip' => $subtype->getName(),
+ ));
+
+ $color = $subtype->getColor();
+ if ($color) {
+ $subtype_tag->setShade($color);
+ }
+
+ $item->addAttribute($subtype_tag);
+ }
+ }
+
$project_handles = array_select_keys(
$handles,
array_reverse($task->getProjectPHIDs()));
diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php
--- a/src/applications/project/view/ProjectBoardTaskCard.php
+++ b/src/applications/project/view/ProjectBoardTaskCard.php
@@ -108,6 +108,30 @@
}
}
+ $subtype_key = $task->getSubtype();
+ if ($subtype_key != PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT) {
+ $subtype_map = $task->newEditEngineSubtypeMap();
+ $subtype = idx($subtype_map, $subtype_key);
+ if ($subtype) {
+ $subtype_tag = id(new PHUITagView())
+ ->setIcon($subtype->getIcon())
+ ->setSlimShady(true)
+ ->setType(PHUITagView::TYPE_SHADE)
+ ->addSigil('has-tooltip')
+ ->setMetadata(
+ array(
+ 'tip' => $subtype->getName(),
+ ));
+
+ $color = $subtype->getColor();
+ if ($color) {
+ $subtype_tag->setShade($color);
+ }
+
+ $card->addAttribute($subtype_tag);
+ }
+ }
+
if ($task->isClosed()) {
$icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
$icon = id(new PHUIIconView())
diff --git a/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php b/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php
--- a/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php
@@ -8,6 +8,8 @@
private $key;
private $name;
+ private $icon;
+ private $color;
public function setKey($key) {
$this->key = $key;
@@ -27,8 +29,22 @@
return $this->name;
}
+ public function setIcon($icon) {
+ $this->icon = $icon;
+ return $this;
+ }
+
public function getIcon() {
- return 'fa-drivers-license-o';
+ return $this->icon;
+ }
+
+ public function setColor($color) {
+ $this->color = $color;
+ return $this;
+ }
+
+ public function getColor() {
+ return $this->color;
}
public static function validateSubtypeKey($subtype) {
@@ -72,6 +88,8 @@
array(
'key' => 'string',
'name' => 'string',
+ 'icon' => 'optional string',
+ 'color' => 'optional string',
));
$key = $value['key'];
@@ -113,9 +131,19 @@
$key = $entry['key'];
$name = $entry['name'];
- $map[$key] = id(new self())
+ $icon = idx($entry, 'icon', 'fa-drivers-license-o');
+ $color = idx($entry, 'color');
+
+ $subtype = id(new self())
->setKey($key)
- ->setName($name);
+ ->setName($name)
+ ->setIcon($icon);
+
+ if ($color) {
+ $subtype->setColor($color);
+ }
+
+ $map[$key] = $subtype;
}
return $map;
diff --git a/src/view/phui/PHUITagView.php b/src/view/phui/PHUITagView.php
--- a/src/view/phui/PHUITagView.php
+++ b/src/view/phui/PHUITagView.php
@@ -117,8 +117,8 @@
}
}
- if ($this->icon) {
- $classes[] = 'phui-tag-icon-view';
+ if ($this->name === null) {
+ $classes[] = 'phui-tag-icon-nameless';
}
if ($this->phid) {
diff --git a/webroot/rsrc/css/phui/phui-tag-view.css b/webroot/rsrc/css/phui/phui-tag-view.css
--- a/webroot/rsrc/css/phui/phui-tag-view.css
+++ b/webroot/rsrc/css/phui/phui-tag-view.css
@@ -43,6 +43,12 @@
margin: 0 4px 0 2px;
}
+.phui-tag-view.phui-tag-icon-nameless .phui-icon-view {
+ /* When the tag just as an icon, like task subtype tags, tighten up the
+ margins a little bit. */
+ margin: 0;
+}
+
.phui-tag-dot {
position: relative;
display: inline-block;

File Metadata

Mime Type
text/plain
Expires
Oct 7 2025, 7:19 AM (6 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
9636605
Default Alt Text
D17451.id41959.diff (8 KB)

Event Timeline