@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow projects icon color to be selected from several fabulous shades

Summary: This further helps differentiate types/roles for projects.

Test Plan: {F169758}

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9710

+116 -29
+3 -3
resources/celerity/map.php
··· 7 7 return array( 8 8 'names' => 9 9 array( 10 - 'core.pkg.css' => 'c2e44da2', 10 + 'core.pkg.css' => 'e428441c', 11 11 'core.pkg.js' => '8c184823', 12 12 'darkconsole.pkg.js' => 'df001cab', 13 13 'differential.pkg.css' => '4a93db37', ··· 142 142 'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b', 143 143 'rsrc/css/phui/phui-spacing.css' => '042804d6', 144 144 'rsrc/css/phui/phui-status.css' => '2f562399', 145 - 'rsrc/css/phui/phui-tag-view.css' => '67017012', 145 + 'rsrc/css/phui/phui-tag-view.css' => '8ac14ba8', 146 146 'rsrc/css/phui/phui-text.css' => '23e9b4b7', 147 147 'rsrc/css/phui/phui-timeline-view.css' => 'bbd990d0', 148 148 'rsrc/css/phui/phui-workboard-view.css' => '2bf82d00', ··· 787 787 'phui-remarkup-preview-css' => '19ad512b', 788 788 'phui-spacing-css' => '042804d6', 789 789 'phui-status-list-view-css' => '2f562399', 790 - 'phui-tag-view-css' => '67017012', 790 + 'phui-tag-view-css' => '8ac14ba8', 791 791 'phui-text-css' => '23e9b4b7', 792 792 'phui-timeline-view-css' => 'bbd990d0', 793 793 'phui-workboard-view-css' => '2bf82d00',
+2
resources/sql/autopatches/20140624.projcolor.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_project.project 2 + ADD color VARCHAR(32) NOT NULL COLLATE utf8_bin;
+2
resources/sql/autopatches/20140624.projcolor.2.sql
··· 1 + UPDATE {$NAMESPACE}_project.project 2 + SET color = 'blue' WHERE color = '';
+21 -3
src/applications/phid/PhabricatorObjectHandle.php
··· 11 11 private $title; 12 12 private $imageURI; 13 13 private $icon; 14 + private $tagColor; 14 15 private $timestamp; 15 16 private $status = PhabricatorObjectHandleStatus::STATUS_OPEN; 16 17 private $complete; ··· 30 31 return $this->getTypeIcon(); 31 32 } 32 33 33 - public function getIconColor() { 34 - return 'bluegrey'; 34 + public function setTagColor($color) { 35 + static $colors; 36 + if (!$colors) { 37 + $colors = array_fuse(array_keys(PHUITagView::getShadeMap())); 38 + } 39 + 40 + if (isset($colors[$color])) { 41 + $this->tagColor = $color; 42 + } 43 + 44 + return $this; 45 + } 46 + 47 + public function getTagColor() { 48 + if ($this->tagColor) { 49 + return $this->tagColor; 50 + } 51 + return 'blue'; 35 52 } 36 53 37 54 public function getTypeIcon() { ··· 262 279 public function renderTag() { 263 280 return id(new PHUITagView()) 264 281 ->setType(PHUITagView::TYPE_OBJECT) 265 - ->setIcon($this->getIcon().' '.$this->getIconColor()) 282 + ->setShade($this->getTagColor()) 283 + ->setIcon($this->getIcon()) 266 284 ->setHref($this->getURI()) 267 285 ->setName($this->getLinkName()); 268 286 }
+34 -11
src/applications/project/controller/PhabricatorProjectEditIconController.php
··· 30 30 $edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/'); 31 31 32 32 if ($request->isFormPost()) { 33 + $xactions = array(); 34 + 33 35 $v_icon = $request->getStr('icon'); 36 + $v_icon_color = $request->getStr('color'); 37 + 34 38 $type_icon = PhabricatorProjectTransaction::TYPE_ICON; 35 - $xactions = array(id(new PhabricatorProjectTransaction()) 39 + $xactions[] = id(new PhabricatorProjectTransaction()) 36 40 ->setTransactionType($type_icon) 37 - ->setNewValue($v_icon)); 41 + ->setNewValue($v_icon); 42 + 43 + $type_icon_color = PhabricatorProjectTransaction::TYPE_COLOR; 44 + $xactions[] = id(new PhabricatorProjectTransaction()) 45 + ->setTransactionType($type_icon_color) 46 + ->setNewValue($v_icon_color); 38 47 39 48 $editor = id(new PhabricatorProjectTransactionEditor()) 40 49 ->setActor($viewer) ··· 47 56 return id(new AphrontReloadResponse())->setURI($edit_uri); 48 57 } 49 58 59 + $shades = PHUITagView::getShadeMap(); 60 + $shades = array_select_keys( 61 + $shades, 62 + array(PhabricatorProject::DEFAULT_COLOR)) + $shades; 63 + unset($shades[PHUITagView::COLOR_DISABLED]); 64 + 65 + $color_form = id(new AphrontFormView()) 66 + ->appendChild( 67 + id(new AphrontFormSelectControl()) 68 + ->setLabel(pht('Color')) 69 + ->setName('color') 70 + ->setValue($project->getColor()) 71 + ->setOptions($shades)); 72 + 50 73 require_celerity_resource('project-icon-css'); 51 74 Javelin::initBehavior('phabricator-tooltips'); 52 75 ··· 55 78 $buttons = array(); 56 79 foreach ($project_icons as $icon => $label) { 57 80 $view = id(new PHUIIconView()) 58 - ->setIconFont($icon.' bluegrey'); 81 + ->setIconFont($icon); 59 82 60 83 $aural = javelin_tag( 61 84 'span', ··· 66 89 67 90 if ($icon == $project->getIcon()) { 68 91 $class_extra = ' selected'; 69 - $tip = $label.pht(' - selected'); 70 92 } else { 71 93 $class_extra = null; 72 - $tip = $label; 73 94 } 74 95 75 96 $buttons[] = javelin_tag( ··· 81 102 'type' => 'submit', 82 103 'sigil' => 'has-tooltip', 83 104 'meta' => array( 84 - 'tip' => $tip, 105 + 'tip' => $label, 85 106 ) 86 107 ), 87 108 array( ··· 100 121 ), 101 122 $buttons); 102 123 103 - $dialog = id(new AphrontDialogView()) 104 - ->setUser($viewer) 124 + $color_form->appendChild( 125 + id(new AphrontFormMarkupControl()) 126 + ->setLabel(pht('Icon')) 127 + ->setValue($buttons)); 128 + 129 + return $this->newDialog() 105 130 ->setTitle(pht('Choose Project Icon')) 106 - ->appendChild($buttons) 131 + ->appendChild($color_form->buildLayoutView()) 107 132 ->addCancelButton($edit_uri); 108 - 109 - return id(new AphrontDialogResponse())->setDialog($dialog); 110 133 } 111 134 }
+6
src/applications/project/controller/PhabricatorProjectEditMainController.php
··· 145 145 $viewer, 146 146 $project); 147 147 148 + $this->loadHandles(array($project->getPHID())); 149 + 150 + $view->addProperty( 151 + pht('Looks Like'), 152 + $this->getHandle($project->getPHID())->renderTag()); 153 + 148 154 $view->addProperty( 149 155 pht('Visible To'), 150 156 $descriptions[PhabricatorPolicyCapability::CAN_VIEW]);
+9
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
··· 16 16 $types[] = PhabricatorProjectTransaction::TYPE_STATUS; 17 17 $types[] = PhabricatorProjectTransaction::TYPE_IMAGE; 18 18 $types[] = PhabricatorProjectTransaction::TYPE_ICON; 19 + $types[] = PhabricatorProjectTransaction::TYPE_COLOR; 19 20 20 21 return $types; 21 22 } ··· 38 39 return $object->getProfileImagePHID(); 39 40 case PhabricatorProjectTransaction::TYPE_ICON: 40 41 return $object->getIcon(); 42 + case PhabricatorProjectTransaction::TYPE_COLOR: 43 + return $object->getColor(); 41 44 } 42 45 43 46 return parent::getCustomTransactionOldValue($object, $xaction); ··· 53 56 case PhabricatorProjectTransaction::TYPE_STATUS: 54 57 case PhabricatorProjectTransaction::TYPE_IMAGE: 55 58 case PhabricatorProjectTransaction::TYPE_ICON: 59 + case PhabricatorProjectTransaction::TYPE_COLOR: 56 60 return $xaction->getNewValue(); 57 61 } 58 62 ··· 78 82 return; 79 83 case PhabricatorProjectTransaction::TYPE_ICON: 80 84 $object->setIcon($xaction->getNewValue()); 85 + return; 86 + case PhabricatorProjectTransaction::TYPE_COLOR: 87 + $object->setColor($xaction->getNewValue()); 81 88 return; 82 89 case PhabricatorTransactions::TYPE_EDGE: 83 90 return; ··· 181 188 case PhabricatorProjectTransaction::TYPE_STATUS: 182 189 case PhabricatorProjectTransaction::TYPE_IMAGE: 183 190 case PhabricatorProjectTransaction::TYPE_ICON: 191 + case PhabricatorProjectTransaction::TYPE_COLOR: 184 192 return; 185 193 case PhabricatorTransactions::TYPE_EDGE: 186 194 $edge_type = $xaction->getMetadataValue('edge:type'); ··· 358 366 case PhabricatorProjectTransaction::TYPE_STATUS: 359 367 case PhabricatorProjectTransaction::TYPE_IMAGE: 360 368 case PhabricatorProjectTransaction::TYPE_ICON: 369 + case PhabricatorProjectTransaction::TYPE_COLOR: 361 370 PhabricatorPolicyFilter::requireCapability( 362 371 $this->requireActor(), 363 372 $object,
+1
src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
··· 50 50 $handle->setURI("/tag/{$slug}/"); 51 51 $handle->setImageURI($project->getProfileImageURI()); 52 52 $handle->setIcon($project->getIcon()); 53 + $handle->setTagColor($project->getColor()); 53 54 54 55 if ($project->isArchived()) { 55 56 $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED);
+11
src/applications/project/storage/PhabricatorProject.php
··· 15 15 protected $phrictionSlug; 16 16 protected $profileImagePHID; 17 17 protected $icon; 18 + protected $color; 18 19 19 20 protected $viewPolicy; 20 21 protected $editPolicy; ··· 29 30 private $slugs = self::ATTACHABLE; 30 31 31 32 const DEFAULT_ICON = 'fa-briefcase'; 33 + const DEFAULT_COLOR = 'blue'; 32 34 33 35 public static function initializeNewProject(PhabricatorUser $actor) { 34 36 return id(new PhabricatorProject()) 35 37 ->setName('') 36 38 ->setAuthorPHID($actor->getPHID()) 37 39 ->setIcon(self::DEFAULT_ICON) 40 + ->setColor(self::DEFAULT_COLOR) 38 41 ->setViewPolicy(PhabricatorPolicies::POLICY_USER) 39 42 ->setEditPolicy(PhabricatorPolicies::POLICY_USER) 40 43 ->setJoinPolicy(PhabricatorPolicies::POLICY_USER) ··· 206 209 207 210 public function getSlugs() { 208 211 return $this->assertAttached($this->slugs); 212 + } 213 + 214 + public function getColor() { 215 + if ($this->isArchived()) { 216 + return PHUITagView::COLOR_DISABLED; 217 + } 218 + 219 + return $this->color; 209 220 } 210 221 211 222
+7
src/applications/project/storage/PhabricatorProjectTransaction.php
··· 8 8 const TYPE_STATUS = 'project:status'; 9 9 const TYPE_IMAGE = 'project:image'; 10 10 const TYPE_ICON = 'project:icon'; 11 + const TYPE_COLOR = 'project:color'; 11 12 12 13 // NOTE: This is deprecated, members are just a normal edge now. 13 14 const TYPE_MEMBERS = 'project:members'; ··· 92 93 '%s set this project\'s icon to %s.', 93 94 $author_handle, 94 95 PhabricatorProjectIcon::getLabel($new)); 96 + 97 + case PhabricatorProjectTransaction::TYPE_COLOR: 98 + return pht( 99 + '%s set this project\'s color to %s.', 100 + $author_handle, 101 + PHUITagView::getShadeName($new)); 95 102 96 103 case PhabricatorProjectTransaction::TYPE_SLUGS: 97 104 $add = array_diff($new, $old);
+1 -1
src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
··· 288 288 ->setDisplayType('Project') 289 289 ->setURI('/project/view/'.$proj->getID().'/') 290 290 ->setPHID($proj->getPHID()) 291 - ->setIcon($proj->getIcon().' bluegrey') 291 + ->setIcon($proj->getIcon().' '.$proj->getColor()) 292 292 ->setPriorityType('proj') 293 293 ->setClosed($closed); 294 294
-1
src/view/phui/PHUIIconView.php
··· 586 586 ); 587 587 } 588 588 589 - 590 589 }
+19 -10
src/view/phui/PHUITagView.php
··· 211 211 } 212 212 213 213 public static function getShades() { 214 + return array_keys(self::getShadeMap()); 215 + } 216 + 217 + public static function getShadeMap() { 214 218 return array( 215 - self::COLOR_RED, 216 - self::COLOR_ORANGE, 217 - self::COLOR_YELLOW, 218 - self::COLOR_BLUE, 219 - self::COLOR_INDIGO, 220 - self::COLOR_VIOLET, 221 - self::COLOR_GREEN, 222 - self::COLOR_GREY, 223 - self::COLOR_CHECKERED, 224 - self::COLOR_DISABLED, 219 + self::COLOR_RED => pht('Red'), 220 + self::COLOR_ORANGE => pht('Orange'), 221 + self::COLOR_YELLOW => pht('Yellow'), 222 + self::COLOR_BLUE => pht('Blue'), 223 + self::COLOR_INDIGO => pht('Indigo'), 224 + self::COLOR_VIOLET => pht('Violet'), 225 + self::COLOR_GREEN => pht('Green'), 226 + self::COLOR_GREY => pht('Grey'), 227 + self::COLOR_CHECKERED => pht('Checkered'), 228 + self::COLOR_DISABLED => pht('Disabled'), 225 229 ); 226 230 } 231 + 232 + public static function getShadeName($shade) { 233 + return idx(self::getShadeMap(), $shade, $shade); 234 + } 235 + 227 236 228 237 public function setExternal($external) { 229 238 $this->external = $external;