@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.

Display examples when editing configuratoin

Summary: Show example config values to the user when available.

Test Plan:
{F28465}
{F28466}

Reviewers: btrahan, codeblock

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2221, T2255

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

+82 -1
+9
src/__celerity_resource_map__.php
··· 725 725 ), 726 726 'disk' => '/rsrc/css/aphront/typeahead.css', 727 727 ), 728 + 'config-options-css' => 729 + array( 730 + 'uri' => '/res/c67b0cbf/rsrc/css/application/config/config-options.css', 731 + 'type' => 'css', 732 + 'requires' => 733 + array( 734 + ), 735 + 'disk' => '/rsrc/css/application/config/config-options.css', 736 + ), 728 737 'differential-changeset-view-css' => 729 738 array( 730 739 'uri' => '/res/ea694162/rsrc/css/application/differential/changeset-view.css',
+41 -1
src/applications/config/controller/PhabricatorConfigEditController.php
··· 106 106 ->addHiddenInput('issue', $request->getStr('issue')) 107 107 ->appendChild( 108 108 id(new AphrontFormMarkupControl()) 109 - ->setLabel('Description') 109 + ->setLabel(pht('Description')) 110 110 ->setValue($description)) 111 111 ->appendChild($control) 112 112 ->appendChild( 113 113 id(new AphrontFormSubmitControl()) 114 114 ->addCancelButton($done_uri) 115 115 ->setValue(pht('Save Config Entry'))); 116 + 117 + $examples = $this->renderExamples($option); 118 + if ($examples) { 119 + $form->appendChild( 120 + id(new AphrontFormMarkupControl()) 121 + ->setLabel(pht('Examples')) 122 + ->setValue($examples)); 123 + } 116 124 117 125 118 126 // TODO: This isn't quite correct -- we should read from the entire ··· 285 293 ->setName('value'); 286 294 287 295 return $control; 296 + } 297 + 298 + private function renderExamples(PhabricatorConfigOption $option) { 299 + $examples = $option->getExamples(); 300 + if (!$examples) { 301 + return null; 302 + } 303 + 304 + $table = array(); 305 + foreach ($examples as $example) { 306 + list($value, $description) = $example; 307 + 308 + if ($value === null) { 309 + $value = '<em>(empty)</em>'; 310 + } else { 311 + $value = phutil_escape_html($value); 312 + } 313 + 314 + $table[] = '<tr>'; 315 + $table[] = '<th>'.$value.'</th>'; 316 + $table[] = '<td>'.phutil_escape_html($description).'</td>'; 317 + $table[] = '</tr>'; 318 + } 319 + 320 + require_celerity_resource('config-options-css'); 321 + 322 + return phutil_render_tag( 323 + 'table', 324 + array( 325 + 'class' => 'config-option-examples', 326 + ), 327 + implode("\n", $table)); 288 328 } 289 329 290 330 }
+32
webroot/rsrc/css/application/config/config-options.css
··· 1 + /** 2 + * @provides config-options-css 3 + */ 4 + 5 + .config-option-examples { 6 + width: 100%; 7 + border-collapse: collapse; 8 + border: 1px solid #cccccc; 9 + } 10 + 11 + .config-option-examples th, 12 + .config-option-examples td { 13 + padding: 4px 6px; 14 + border: 1px solid #cccccc; 15 + } 16 + 17 + .config-option-examples th { 18 + background: #dfdfdf; 19 + text-align: right; 20 + font-weight: bold; 21 + } 22 + 23 + .config-option-examples th em { 24 + font-weight: normal; 25 + color: #666666; 26 + } 27 + 28 + .config-option-examples td { 29 + color: #333333; 30 + } 31 + 32 +