Page MenuHomePhabricator

D9710.id23389.diff
No OneTemporary

D9710.id23389.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -7,7 +7,7 @@
return array(
'names' =>
array(
- 'core.pkg.css' => 'c2e44da2',
+ 'core.pkg.css' => 'e428441c',
'core.pkg.js' => '8c184823',
'darkconsole.pkg.js' => 'df001cab',
'differential.pkg.css' => '4a93db37',
@@ -142,7 +142,7 @@
'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b',
'rsrc/css/phui/phui-spacing.css' => '042804d6',
'rsrc/css/phui/phui-status.css' => '2f562399',
- 'rsrc/css/phui/phui-tag-view.css' => '67017012',
+ 'rsrc/css/phui/phui-tag-view.css' => '8ac14ba8',
'rsrc/css/phui/phui-text.css' => '23e9b4b7',
'rsrc/css/phui/phui-timeline-view.css' => 'bbd990d0',
'rsrc/css/phui/phui-workboard-view.css' => '2bf82d00',
@@ -787,7 +787,7 @@
'phui-remarkup-preview-css' => '19ad512b',
'phui-spacing-css' => '042804d6',
'phui-status-list-view-css' => '2f562399',
- 'phui-tag-view-css' => '67017012',
+ 'phui-tag-view-css' => '8ac14ba8',
'phui-text-css' => '23e9b4b7',
'phui-timeline-view-css' => 'bbd990d0',
'phui-workboard-view-css' => '2bf82d00',
diff --git a/resources/sql/autopatches/20140624.projcolor.1.sql b/resources/sql/autopatches/20140624.projcolor.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140624.projcolor.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_project.project
+ ADD color VARCHAR(32) NOT NULL COLLATE utf8_bin;
diff --git a/resources/sql/autopatches/20140624.projcolor.2.sql b/resources/sql/autopatches/20140624.projcolor.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140624.projcolor.2.sql
@@ -0,0 +1,2 @@
+UPDATE {$NAMESPACE}_project.project
+ SET color = 'blue' WHERE color = '';
diff --git a/src/applications/phid/PhabricatorObjectHandle.php b/src/applications/phid/PhabricatorObjectHandle.php
--- a/src/applications/phid/PhabricatorObjectHandle.php
+++ b/src/applications/phid/PhabricatorObjectHandle.php
@@ -11,6 +11,7 @@
private $title;
private $imageURI;
private $icon;
+ private $tagColor;
private $timestamp;
private $status = PhabricatorObjectHandleStatus::STATUS_OPEN;
private $complete;
@@ -30,8 +31,24 @@
return $this->getTypeIcon();
}
- public function getIconColor() {
- return 'bluegrey';
+ public function setTagColor($color) {
+ static $colors;
+ if (!$colors) {
+ $colors = array_fuse(array_keys(PHUITagView::getShadeMap()));
+ }
+
+ if (isset($colors[$color])) {
+ $this->tagColor = $color;
+ }
+
+ return $this;
+ }
+
+ public function getTagColor() {
+ if ($this->tagColor) {
+ return $this->tagColor;
+ }
+ return 'blue';
}
public function getTypeIcon() {
@@ -262,7 +279,8 @@
public function renderTag() {
return id(new PHUITagView())
->setType(PHUITagView::TYPE_OBJECT)
- ->setIcon($this->getIcon().' '.$this->getIconColor())
+ ->setShade($this->getTagColor())
+ ->setIcon($this->getIcon())
->setHref($this->getURI())
->setName($this->getLinkName());
}
diff --git a/src/applications/project/controller/PhabricatorProjectEditIconController.php b/src/applications/project/controller/PhabricatorProjectEditIconController.php
--- a/src/applications/project/controller/PhabricatorProjectEditIconController.php
+++ b/src/applications/project/controller/PhabricatorProjectEditIconController.php
@@ -30,11 +30,20 @@
$edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/');
if ($request->isFormPost()) {
+ $xactions = array();
+
$v_icon = $request->getStr('icon');
+ $v_icon_color = $request->getStr('color');
+
$type_icon = PhabricatorProjectTransaction::TYPE_ICON;
- $xactions = array(id(new PhabricatorProjectTransaction())
+ $xactions[] = id(new PhabricatorProjectTransaction())
->setTransactionType($type_icon)
- ->setNewValue($v_icon));
+ ->setNewValue($v_icon);
+
+ $type_icon_color = PhabricatorProjectTransaction::TYPE_COLOR;
+ $xactions[] = id(new PhabricatorProjectTransaction())
+ ->setTransactionType($type_icon_color)
+ ->setNewValue($v_icon_color);
$editor = id(new PhabricatorProjectTransactionEditor())
->setActor($viewer)
@@ -47,6 +56,20 @@
return id(new AphrontReloadResponse())->setURI($edit_uri);
}
+ $shades = PHUITagView::getShadeMap();
+ $shades = array_select_keys(
+ $shades,
+ array(PhabricatorProject::DEFAULT_COLOR)) + $shades;
+ unset($shades[PHUITagView::COLOR_DISABLED]);
+
+ $color_form = id(new AphrontFormView())
+ ->appendChild(
+ id(new AphrontFormSelectControl())
+ ->setLabel(pht('Color'))
+ ->setName('color')
+ ->setValue($project->getColor())
+ ->setOptions($shades));
+
require_celerity_resource('project-icon-css');
Javelin::initBehavior('phabricator-tooltips');
@@ -55,7 +78,7 @@
$buttons = array();
foreach ($project_icons as $icon => $label) {
$view = id(new PHUIIconView())
- ->setIconFont($icon.' bluegrey');
+ ->setIconFont($icon);
$aural = javelin_tag(
'span',
@@ -66,10 +89,8 @@
if ($icon == $project->getIcon()) {
$class_extra = ' selected';
- $tip = $label.pht(' - selected');
} else {
$class_extra = null;
- $tip = $label;
}
$buttons[] = javelin_tag(
@@ -81,7 +102,7 @@
'type' => 'submit',
'sigil' => 'has-tooltip',
'meta' => array(
- 'tip' => $tip,
+ 'tip' => $label,
)
),
array(
@@ -100,12 +121,14 @@
),
$buttons);
- $dialog = id(new AphrontDialogView())
- ->setUser($viewer)
+ $color_form->appendChild(
+ id(new AphrontFormMarkupControl())
+ ->setLabel(pht('Icon'))
+ ->setValue($buttons));
+
+ return $this->newDialog()
->setTitle(pht('Choose Project Icon'))
- ->appendChild($buttons)
+ ->appendChild($color_form->buildLayoutView())
->addCancelButton($edit_uri);
-
- return id(new AphrontDialogResponse())->setDialog($dialog);
}
}
diff --git a/src/applications/project/controller/PhabricatorProjectEditMainController.php b/src/applications/project/controller/PhabricatorProjectEditMainController.php
--- a/src/applications/project/controller/PhabricatorProjectEditMainController.php
+++ b/src/applications/project/controller/PhabricatorProjectEditMainController.php
@@ -145,6 +145,12 @@
$viewer,
$project);
+ $this->loadHandles(array($project->getPHID()));
+
+ $view->addProperty(
+ pht('Looks Like'),
+ $this->getHandle($project->getPHID())->renderTag());
+
$view->addProperty(
pht('Visible To'),
$descriptions[PhabricatorPolicyCapability::CAN_VIEW]);
diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
--- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
+++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
@@ -16,6 +16,7 @@
$types[] = PhabricatorProjectTransaction::TYPE_STATUS;
$types[] = PhabricatorProjectTransaction::TYPE_IMAGE;
$types[] = PhabricatorProjectTransaction::TYPE_ICON;
+ $types[] = PhabricatorProjectTransaction::TYPE_COLOR;
return $types;
}
@@ -38,6 +39,8 @@
return $object->getProfileImagePHID();
case PhabricatorProjectTransaction::TYPE_ICON:
return $object->getIcon();
+ case PhabricatorProjectTransaction::TYPE_COLOR:
+ return $object->getColor();
}
return parent::getCustomTransactionOldValue($object, $xaction);
@@ -53,6 +56,7 @@
case PhabricatorProjectTransaction::TYPE_STATUS:
case PhabricatorProjectTransaction::TYPE_IMAGE:
case PhabricatorProjectTransaction::TYPE_ICON:
+ case PhabricatorProjectTransaction::TYPE_COLOR:
return $xaction->getNewValue();
}
@@ -79,6 +83,9 @@
case PhabricatorProjectTransaction::TYPE_ICON:
$object->setIcon($xaction->getNewValue());
return;
+ case PhabricatorProjectTransaction::TYPE_COLOR:
+ $object->setColor($xaction->getNewValue());
+ return;
case PhabricatorTransactions::TYPE_EDGE:
return;
case PhabricatorTransactions::TYPE_VIEW_POLICY:
@@ -181,6 +188,7 @@
case PhabricatorProjectTransaction::TYPE_STATUS:
case PhabricatorProjectTransaction::TYPE_IMAGE:
case PhabricatorProjectTransaction::TYPE_ICON:
+ case PhabricatorProjectTransaction::TYPE_COLOR:
return;
case PhabricatorTransactions::TYPE_EDGE:
$edge_type = $xaction->getMetadataValue('edge:type');
@@ -358,6 +366,7 @@
case PhabricatorProjectTransaction::TYPE_STATUS:
case PhabricatorProjectTransaction::TYPE_IMAGE:
case PhabricatorProjectTransaction::TYPE_ICON:
+ case PhabricatorProjectTransaction::TYPE_COLOR:
PhabricatorPolicyFilter::requireCapability(
$this->requireActor(),
$object,
diff --git a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
--- a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
+++ b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
@@ -50,6 +50,7 @@
$handle->setURI("/tag/{$slug}/");
$handle->setImageURI($project->getProfileImageURI());
$handle->setIcon($project->getIcon());
+ $handle->setTagColor($project->getColor());
if ($project->isArchived()) {
$handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED);
diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php
--- a/src/applications/project/storage/PhabricatorProject.php
+++ b/src/applications/project/storage/PhabricatorProject.php
@@ -15,6 +15,7 @@
protected $phrictionSlug;
protected $profileImagePHID;
protected $icon;
+ protected $color;
protected $viewPolicy;
protected $editPolicy;
@@ -29,12 +30,14 @@
private $slugs = self::ATTACHABLE;
const DEFAULT_ICON = 'fa-briefcase';
+ const DEFAULT_COLOR = 'blue';
public static function initializeNewProject(PhabricatorUser $actor) {
return id(new PhabricatorProject())
->setName('')
->setAuthorPHID($actor->getPHID())
->setIcon(self::DEFAULT_ICON)
+ ->setColor(self::DEFAULT_COLOR)
->setViewPolicy(PhabricatorPolicies::POLICY_USER)
->setEditPolicy(PhabricatorPolicies::POLICY_USER)
->setJoinPolicy(PhabricatorPolicies::POLICY_USER)
@@ -208,6 +211,14 @@
return $this->assertAttached($this->slugs);
}
+ public function getColor() {
+ if ($this->isArchived()) {
+ return PHUITagView::COLOR_DISABLED;
+ }
+
+ return $this->color;
+ }
+
/* -( PhabricatorSubscribableInterface )----------------------------------- */
diff --git a/src/applications/project/storage/PhabricatorProjectTransaction.php b/src/applications/project/storage/PhabricatorProjectTransaction.php
--- a/src/applications/project/storage/PhabricatorProjectTransaction.php
+++ b/src/applications/project/storage/PhabricatorProjectTransaction.php
@@ -8,6 +8,7 @@
const TYPE_STATUS = 'project:status';
const TYPE_IMAGE = 'project:image';
const TYPE_ICON = 'project:icon';
+ const TYPE_COLOR = 'project:color';
// NOTE: This is deprecated, members are just a normal edge now.
const TYPE_MEMBERS = 'project:members';
@@ -93,6 +94,12 @@
$author_handle,
PhabricatorProjectIcon::getLabel($new));
+ case PhabricatorProjectTransaction::TYPE_COLOR:
+ return pht(
+ '%s set this project\'s color to %s.',
+ $author_handle,
+ PHUITagView::getShadeName($new));
+
case PhabricatorProjectTransaction::TYPE_SLUGS:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
@@ -288,7 +288,7 @@
->setDisplayType('Project')
->setURI('/project/view/'.$proj->getID().'/')
->setPHID($proj->getPHID())
- ->setIcon($proj->getIcon().' bluegrey')
+ ->setIcon($proj->getIcon().' '.$proj->getColor())
->setPriorityType('proj')
->setClosed($closed);
diff --git a/src/view/phui/PHUIIconView.php b/src/view/phui/PHUIIconView.php
--- a/src/view/phui/PHUIIconView.php
+++ b/src/view/phui/PHUIIconView.php
@@ -586,5 +586,4 @@
);
}
-
}
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
@@ -211,20 +211,29 @@
}
public static function getShades() {
+ return array_keys(self::getShadeMap());
+ }
+
+ public static function getShadeMap() {
return array(
- self::COLOR_RED,
- self::COLOR_ORANGE,
- self::COLOR_YELLOW,
- self::COLOR_BLUE,
- self::COLOR_INDIGO,
- self::COLOR_VIOLET,
- self::COLOR_GREEN,
- self::COLOR_GREY,
- self::COLOR_CHECKERED,
- self::COLOR_DISABLED,
+ self::COLOR_RED => pht('Red'),
+ self::COLOR_ORANGE => pht('Orange'),
+ self::COLOR_YELLOW => pht('Yellow'),
+ self::COLOR_BLUE => pht('Blue'),
+ self::COLOR_INDIGO => pht('Indigo'),
+ self::COLOR_VIOLET => pht('Violet'),
+ self::COLOR_GREEN => pht('Green'),
+ self::COLOR_GREY => pht('Grey'),
+ self::COLOR_CHECKERED => pht('Checkered'),
+ self::COLOR_DISABLED => pht('Disabled'),
);
}
+ public static function getShadeName($shade) {
+ return idx(self::getShadeMap(), $shade, $shade);
+ }
+
+
public function setExternal($external) {
$this->external = $external;
return $this;

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 10, 11:29 PM (1 w, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723783
Default Alt Text
D9710.id23389.diff (14 KB)

Event Timeline