@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 workboard background colors to be configured

Summary:
Adds a UI for selecting background colors.

You can choose "Use Parent", which is the default, and allows you to set a color that all descendants inherit.

You can also choose "None", if a parent has a WHACKY BACKGROUND that you refuse to put up with.

Test Plan:
{F1114588}

{F1114589}

Reviewers: chad

Reviewed By: chad

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

+383 -8
+2 -2
resources/celerity/map.php
··· 155 155 'rsrc/css/phui/phui-tag-view.css' => '9d5d4400', 156 156 'rsrc/css/phui/phui-timeline-view.css' => '2efceff8', 157 157 'rsrc/css/phui/phui-two-column-view.css' => 'c75bfc5b', 158 - 'rsrc/css/phui/workboards/phui-workboard-color.css' => '543432b9', 158 + 'rsrc/css/phui/workboards/phui-workboard-color.css' => '2f068cc8', 159 159 'rsrc/css/phui/workboards/phui-workboard.css' => 'e6d89647', 160 160 'rsrc/css/phui/workboards/phui-workcard.css' => '3646fb96', 161 161 'rsrc/css/phui/workboards/phui-workpanel.css' => '92197373', ··· 842 842 'phui-theme-css' => 'ab7b848c', 843 843 'phui-timeline-view-css' => '2efceff8', 844 844 'phui-two-column-view-css' => 'c75bfc5b', 845 - 'phui-workboard-color-css' => '543432b9', 845 + 'phui-workboard-color-css' => '2f068cc8', 846 846 'phui-workboard-view-css' => 'e6d89647', 847 847 'phui-workcard-view-css' => '3646fb96', 848 848 'phui-workpanel-view-css' => '92197373',
+4
src/__phutil_library_map__.php
··· 2869 2869 'PhabricatorProjectAddHeraldAction' => 'applications/project/herald/PhabricatorProjectAddHeraldAction.php', 2870 2870 'PhabricatorProjectApplication' => 'applications/project/application/PhabricatorProjectApplication.php', 2871 2871 'PhabricatorProjectArchiveController' => 'applications/project/controller/PhabricatorProjectArchiveController.php', 2872 + 'PhabricatorProjectBoardBackgroundController' => 'applications/project/controller/PhabricatorProjectBoardBackgroundController.php', 2872 2873 'PhabricatorProjectBoardController' => 'applications/project/controller/PhabricatorProjectBoardController.php', 2873 2874 'PhabricatorProjectBoardDisableController' => 'applications/project/controller/PhabricatorProjectBoardDisableController.php', 2874 2875 'PhabricatorProjectBoardImportController' => 'applications/project/controller/PhabricatorProjectBoardImportController.php', ··· 2970 2971 'PhabricatorProjectViewController' => 'applications/project/controller/PhabricatorProjectViewController.php', 2971 2972 'PhabricatorProjectWatchController' => 'applications/project/controller/PhabricatorProjectWatchController.php', 2972 2973 'PhabricatorProjectWatcherListView' => 'applications/project/view/PhabricatorProjectWatcherListView.php', 2974 + 'PhabricatorProjectWorkboardBackgroundColor' => 'applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php', 2973 2975 'PhabricatorProjectWorkboardProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectWorkboardProfilePanel.php', 2974 2976 'PhabricatorProjectsEditEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php', 2975 2977 'PhabricatorProjectsEditField' => 'applications/transactions/editfield/PhabricatorProjectsEditField.php', ··· 7298 7300 'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction', 7299 7301 'PhabricatorProjectApplication' => 'PhabricatorApplication', 7300 7302 'PhabricatorProjectArchiveController' => 'PhabricatorProjectController', 7303 + 'PhabricatorProjectBoardBackgroundController' => 'PhabricatorProjectBoardController', 7301 7304 'PhabricatorProjectBoardController' => 'PhabricatorProjectController', 7302 7305 'PhabricatorProjectBoardDisableController' => 'PhabricatorProjectBoardController', 7303 7306 'PhabricatorProjectBoardImportController' => 'PhabricatorProjectBoardController', ··· 7413 7416 'PhabricatorProjectViewController' => 'PhabricatorProjectController', 7414 7417 'PhabricatorProjectWatchController' => 'PhabricatorProjectController', 7415 7418 'PhabricatorProjectWatcherListView' => 'PhabricatorProjectUserListView', 7419 + 'PhabricatorProjectWorkboardBackgroundColor' => 'Phobject', 7416 7420 'PhabricatorProjectWorkboardProfilePanel' => 'PhabricatorProfilePanel', 7417 7421 'PhabricatorProjectsEditEngineExtension' => 'PhabricatorEditEngineExtension', 7418 7422 'PhabricatorProjectsEditField' => 'PhabricatorTokenizerEditField',
+2
src/applications/project/application/PhabricatorProjectApplication.php
··· 86 86 => 'PhabricatorProjectBoardDisableController', 87 87 'manage/' 88 88 => 'PhabricatorProjectBoardManageController', 89 + 'background/' 90 + => 'PhabricatorProjectBoardBackgroundController', 89 91 ), 90 92 'update/(?P<id>[1-9]\d*)/(?P<action>[^/]+)/' 91 93 => 'PhabricatorProjectUpdateController',
+124
src/applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php
··· 1 + <?php 2 + 3 + final class PhabricatorProjectWorkboardBackgroundColor extends Phobject { 4 + 5 + public static function getOptions() { 6 + $options = array( 7 + array( 8 + 'key' => '', 9 + 'name' => pht('Use Parent Background (Default)'), 10 + 'special' => 'parent', 11 + 'icon' => 'fa-chevron-circle-up', 12 + 'group' => 'basic', 13 + ), 14 + array( 15 + 'key' => 'none', 16 + 'name' => pht('No Background'), 17 + 'special' => 'none', 18 + 'icon' => 'fa-ban', 19 + 'group' => 'basic', 20 + ), 21 + array( 22 + 'key' => 'red', 23 + 'name' => pht('Red'), 24 + ), 25 + array( 26 + 'key' => 'orange', 27 + 'name' => pht('Orange'), 28 + ), 29 + array( 30 + 'key' => 'yellow', 31 + 'name' => pht('Yellow'), 32 + ), 33 + array( 34 + 'key' => 'green', 35 + 'name' => pht('Green'), 36 + ), 37 + array( 38 + 'key' => 'blue', 39 + 'name' => pht('Blue'), 40 + ), 41 + array( 42 + 'key' => 'indigo', 43 + 'name' => pht('Indigo'), 44 + ), 45 + array( 46 + 'key' => 'violet', 47 + 'name' => pht('Violet'), 48 + ), 49 + array( 50 + 'key' => 'sky', 51 + 'name' => pht('Sky'), 52 + ), 53 + array( 54 + 'key' => 'pink', 55 + 'name' => pht('Pink'), 56 + ), 57 + array( 58 + 'key' => 'fire', 59 + 'name' => pht('Fire'), 60 + ), 61 + array( 62 + 'key' => 'grey', 63 + 'name' => pht('Grey'), 64 + ), 65 + array( 66 + 'key' => 'gradient-red', 67 + 'name' => pht('Ripe Peach'), 68 + ), 69 + array( 70 + 'key' => 'gradient-orange', 71 + 'name' => pht('Ripe Orange'), 72 + ), 73 + array( 74 + 'key' => 'gradient-yellow', 75 + 'name' => pht('Ripe Mango'), 76 + ), 77 + array( 78 + 'key' => 'gradient-green', 79 + 'name' => pht('Shallows'), 80 + ), 81 + array( 82 + 'key' => 'gradient-blue', 83 + 'name' => pht('Reef'), 84 + ), 85 + array( 86 + 'key' => 'gradient-bluegrey', 87 + 'name' => pht('Depths'), 88 + ), 89 + array( 90 + 'key' => 'gradient-indigo', 91 + 'name' => pht('This One Is Purple'), 92 + ), 93 + array( 94 + 'key' => 'gradient-violet', 95 + 'name' => pht('Unripe Plum'), 96 + ), 97 + array( 98 + 'key' => 'gradient-sky', 99 + 'name' => pht('Blue Sky'), 100 + ), 101 + array( 102 + 'key' => 'gradient-pink', 103 + 'name' => pht('Intensity'), 104 + ), 105 + array( 106 + 'key' => 'gradient-grey', 107 + 'name' => pht('Into The Expanse'), 108 + ), 109 + ); 110 + 111 + foreach ($options as $key => $option) { 112 + if (empty($option['group'])) { 113 + if (preg_match('/^gradient/', $option['key'])) { 114 + $option['group'] = 'gradient'; 115 + } else { 116 + $option['group'] = 'solid'; 117 + } 118 + } 119 + $options[$key] = $option; 120 + } 121 + 122 + return ipull($options, null, 'key'); 123 + } 124 + }
+168
src/applications/project/controller/PhabricatorProjectBoardBackgroundController.php
··· 1 + <?php 2 + 3 + final class PhabricatorProjectBoardBackgroundController 4 + extends PhabricatorProjectBoardController { 5 + 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getUser(); 8 + $board_id = $request->getURIData('projectID'); 9 + 10 + $board = id(new PhabricatorProjectQuery()) 11 + ->setViewer($viewer) 12 + ->withIDs(array($board_id)) 13 + ->needImages(true) 14 + ->requireCapabilities( 15 + array( 16 + PhabricatorPolicyCapability::CAN_VIEW, 17 + PhabricatorPolicyCapability::CAN_EDIT, 18 + )) 19 + ->executeOne(); 20 + if (!$board) { 21 + return new Aphront404Response(); 22 + } 23 + 24 + if (!$board->getHasWorkboard()) { 25 + return new Aphront404Response(); 26 + } 27 + 28 + $this->setProject($board); 29 + $id = $board->getID(); 30 + 31 + $manage_uri = $this->getApplicationURI("board/{$id}/manage/"); 32 + 33 + if ($request->isFormPost()) { 34 + $background_key = $request->getStr('backgroundKey'); 35 + 36 + $xactions = array(); 37 + 38 + $xactions[] = id(new PhabricatorProjectTransaction()) 39 + ->setTransactionType(PhabricatorProjectTransaction::TYPE_BACKGROUND) 40 + ->setNewValue($background_key); 41 + 42 + id(new PhabricatorProjectTransactionEditor()) 43 + ->setActor($viewer) 44 + ->setContentSourceFromRequest($request) 45 + ->setContinueOnNoEffect(true) 46 + ->setContinueOnMissingFields(true) 47 + ->applyTransactions($board, $xactions); 48 + 49 + return id(new AphrontRedirectResponse()) 50 + ->setURI($manage_uri); 51 + } 52 + 53 + $nav = $this->getProfileMenu(); 54 + 55 + $crumbs = id($this->buildApplicationCrumbs()) 56 + ->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/") 57 + ->addTextCrumb(pht('Manage'), $manage_uri) 58 + ->addTextCrumb(pht('Background Color')); 59 + 60 + $form = id(new AphrontFormView()) 61 + ->setUser($viewer); 62 + 63 + $group_info = array( 64 + 'basic' => array( 65 + 'label' => pht('Basics'), 66 + ), 67 + 'solid' => array( 68 + 'label' => pht('Solid Colors'), 69 + ), 70 + 'gradient' => array( 71 + 'label' => pht('Gradients'), 72 + ), 73 + ); 74 + 75 + $groups = array(); 76 + $options = PhabricatorProjectWorkboardBackgroundColor::getOptions(); 77 + $option_groups = igroup($options, 'group'); 78 + 79 + require_celerity_resource('people-profile-css'); 80 + require_celerity_resource('phui-workboard-color-css'); 81 + Javelin::initBehavior('phabricator-tooltips', array()); 82 + 83 + foreach ($group_info as $group_key => $spec) { 84 + $buttons = array(); 85 + 86 + $available_options = idx($option_groups, $group_key, array()); 87 + foreach ($available_options as $option) { 88 + $buttons[] = $this->renderOptionButton($option); 89 + } 90 + 91 + $form->appendControl( 92 + id(new AphrontFormMarkupControl()) 93 + ->setLabel($spec['label']) 94 + ->setValue($buttons)); 95 + } 96 + 97 + // NOTE: Each button is its own form, so we can't wrap them in a normal 98 + // form. 99 + $layout_view = $form->buildLayoutView(); 100 + 101 + $form_box = id(new PHUIObjectBoxView()) 102 + ->setHeaderText(pht('Edit Background Color')) 103 + ->appendChild($layout_view); 104 + 105 + return $this->newPage() 106 + ->setTitle( 107 + array( 108 + pht('Edit Background Color'), 109 + $board->getDisplayName(), 110 + )) 111 + ->setCrumbs($crumbs) 112 + ->setNavigation($nav) 113 + ->appendChild($form_box); 114 + } 115 + 116 + private function renderOptionButton(array $option) { 117 + $viewer = $this->getViewer(); 118 + 119 + $icon = idx($option, 'icon'); 120 + if ($icon) { 121 + $preview_class = null; 122 + $preview_content = id(new PHUIIconView()) 123 + ->setIcon($icon, 'lightbluetext'); 124 + } else { 125 + $preview_class = 'phui-workboard-'.$option['key']; 126 + $preview_content = null; 127 + } 128 + 129 + $preview = phutil_tag( 130 + 'div', 131 + array( 132 + 'class' => 'phui-workboard-color-preview '.$preview_class, 133 + ), 134 + $preview_content); 135 + 136 + $button = javelin_tag( 137 + 'button', 138 + array( 139 + 'class' => 'grey profile-image-button', 140 + 'sigil' => 'has-tooltip', 141 + 'meta' => array( 142 + 'tip' => $option['name'], 143 + 'size' => 300, 144 + ), 145 + ), 146 + $preview); 147 + 148 + $input = phutil_tag( 149 + 'input', 150 + array( 151 + 'type' => 'hidden', 152 + 'name' => 'backgroundKey', 153 + 'value' => $option['key'], 154 + )); 155 + 156 + return phabricator_form( 157 + $viewer, 158 + array( 159 + 'class' => 'profile-image-form', 160 + 'method' => 'POST', 161 + ), 162 + array( 163 + $button, 164 + $input, 165 + )); 166 + } 167 + 168 + }
+19
src/applications/project/controller/PhabricatorProjectBoardManageController.php
··· 96 96 ->setDisabled(!$can_edit) 97 97 ->setWorkflow(true)); 98 98 99 + $background_uri = $this->getApplicationURI("board/{$id}/background/"); 100 + 101 + $actions->addAction( 102 + id(new PhabricatorActionView()) 103 + ->setIcon('fa-paint-brush') 104 + ->setName(pht('Change Background Color')) 105 + ->setHref($background_uri) 106 + ->setDisabled(!$can_edit) 107 + ->setWorkflow(!$can_edit)); 108 + 99 109 $disable_uri = $this->getApplicationURI("board/{$id}/disable/"); 100 110 101 111 $actions->addAction( ··· 116 126 $properties = id(new PHUIPropertyListView()) 117 127 ->setUser($viewer) 118 128 ->setObject($board); 129 + 130 + $background = $board->getDisplayWorkboardBackgroundColor(); 131 + if ($background !== null) { 132 + $map = PhabricatorProjectWorkboardBackgroundColor::getOptions(); 133 + $map = ipull($map, 'name'); 134 + 135 + $name = idx($map, $background, $background); 136 + $properties->addProperty(pht('Background Color'), $name); 137 + } 119 138 120 139 return $properties; 121 140 }
+12 -6
src/applications/project/controller/PhabricatorProjectBoardViewController.php
··· 431 431 $crumbs->addAction($manage_menu); 432 432 $crumbs->addAction($fullscreen); 433 433 434 - // TODO: Wire to Workboard Preferences 435 - // require_celerity_resource('phui-workboard-color-css'); 436 - // ->addClass('phui-workboard-color') 437 - // ->addClass('phui-workboard-bluegrey') 438 - 439 - return $this->newPage() 434 + $page = $this->newPage() 440 435 ->setTitle( 441 436 array( 442 437 $project->getDisplayName(), ··· 454 449 array( 455 450 $board_box, 456 451 )); 452 + 453 + $background = $project->getDisplayWorkboardBackgroundColor(); 454 + if ($background !== null) { 455 + require_celerity_resource('phui-workboard-color-css'); 456 + $background_color_class = "phui-workboard-{$background}"; 457 + 458 + $page->addClass('phui-workboard-color'); 459 + $nav->addClass($background_color_class); 460 + } 461 + 462 + return $page; 457 463 } 458 464 459 465 private function readRequestState() {
+13
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
··· 42 42 $types[] = PhabricatorProjectTransaction::TYPE_HASWORKBOARD; 43 43 $types[] = PhabricatorProjectTransaction::TYPE_DEFAULT_SORT; 44 44 $types[] = PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER; 45 + $types[] = PhabricatorProjectTransaction::TYPE_BACKGROUND; 45 46 46 47 return $types; 47 48 } ··· 77 78 return $object->getDefaultWorkboardSort(); 78 79 case PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER: 79 80 return $object->getDefaultWorkboardFilter(); 81 + case PhabricatorProjectTransaction::TYPE_BACKGROUND: 82 + return $object->getWorkboardBackgroundColor(); 80 83 } 81 84 82 85 return parent::getCustomTransactionOldValue($object, $xaction); ··· 100 103 return $xaction->getNewValue(); 101 104 case PhabricatorProjectTransaction::TYPE_HASWORKBOARD: 102 105 return (int)$xaction->getNewValue(); 106 + case PhabricatorProjectTransaction::TYPE_BACKGROUND: 107 + $value = $xaction->getNewValue(); 108 + if (!strlen($value)) { 109 + return null; 110 + } 111 + return $value; 103 112 case PhabricatorProjectTransaction::TYPE_SLUGS: 104 113 return $this->normalizeSlugs($xaction->getNewValue()); 105 114 } ··· 153 162 case PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER: 154 163 $object->setDefaultWorkboardFilter($xaction->getNewValue()); 155 164 return; 165 + case PhabricatorProjectTransaction::TYPE_BACKGROUND: 166 + $object->setWorkboardBackgroundColor($xaction->getNewValue()); 167 + return; 156 168 } 157 169 158 170 return parent::applyCustomInternalTransaction($object, $xaction); ··· 198 210 case PhabricatorProjectTransaction::TYPE_HASWORKBOARD: 199 211 case PhabricatorProjectTransaction::TYPE_DEFAULT_SORT: 200 212 case PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER: 213 + case PhabricatorProjectTransaction::TYPE_BACKGROUND: 201 214 return; 202 215 } 203 216
+25
src/applications/project/storage/PhabricatorProject.php
··· 579 579 return $this->setProperty('workboard.filter.default', $filter); 580 580 } 581 581 582 + public function getWorkboardBackgroundColor() { 583 + return $this->getProperty('workboard.background'); 584 + } 585 + 586 + public function setWorkboardBackgroundColor($color) { 587 + return $this->setProperty('workboard.background', $color); 588 + } 589 + 590 + public function getDisplayWorkboardBackgroundColor() { 591 + $color = $this->getWorkboardBackgroundColor(); 592 + 593 + if ($color === null) { 594 + $parent = $this->getParentProject(); 595 + if ($parent) { 596 + return $parent->getDisplayWorkboardBackgroundColor(); 597 + } 598 + } 599 + 600 + if ($color === 'none') { 601 + $color = null; 602 + } 603 + 604 + return $color; 605 + } 606 + 582 607 583 608 /* -( PhabricatorCustomFieldInterface )------------------------------------ */ 584 609
+8
src/applications/project/storage/PhabricatorProjectTransaction.php
··· 15 15 const TYPE_HASWORKBOARD = 'project:hasworkboard'; 16 16 const TYPE_DEFAULT_SORT = 'project:sort'; 17 17 const TYPE_DEFAULT_FILTER = 'project:filter'; 18 + const TYPE_BACKGROUND = 'project:background'; 18 19 19 20 // NOTE: This is deprecated, members are just a normal edge now. 20 21 const TYPE_MEMBERS = 'project:members'; ··· 73 74 case self::TYPE_HASWORKBOARD: 74 75 case self::TYPE_DEFAULT_SORT: 75 76 case self::TYPE_DEFAULT_FILTER: 77 + case self::TYPE_BACKGROUND: 76 78 return true; 77 79 } 78 80 ··· 84 86 case self::TYPE_HASWORKBOARD: 85 87 case self::TYPE_DEFAULT_SORT: 86 88 case self::TYPE_DEFAULT_FILTER: 89 + case self::TYPE_BACKGROUND: 87 90 return true; 88 91 } 89 92 ··· 290 293 case self::TYPE_DEFAULT_FILTER: 291 294 return pht( 292 295 '%s changed the default filter for the project workboard.', 296 + $author_handle); 297 + 298 + case self::TYPE_BACKGROUND: 299 + return pht( 300 + '%s changed the background color of the project workboard.', 293 301 $author_handle); 294 302 } 295 303
+6
webroot/rsrc/css/phui/workboards/phui-workboard-color.css
··· 30 30 background-color: rgba(255,255,255,.6); 31 31 } 32 32 33 + .phui-workboard-color-preview { 34 + width: 50px; 35 + height: 50px; 36 + font-size: 34px; 37 + } 38 + 33 39 /* Gradients */ 34 40 35 41 .phui-workboard-gradient-red {