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

Move "Open in Editor" to File Box

Summary: Moves this single action to the File Contents box in Diffusion Browse. Also fixes a PHUIObjectBox missing when enable highlighting is on.

Test Plan: Enable/Disable Highlighting. See disabled Editor button.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4467

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

+31 -16
+21 -16
src/applications/diffusion/controller/DiffusionBrowseFileController.php
··· 208 208 209 209 if (!$show_color) { 210 210 $style = 211 - "margin: 1em 2em; width: 90%; height: 80em; font-family: monospace"; 211 + "border: none; width: 100%; height: 80em; font-family: monospace"; 212 212 if (!$show_blame) { 213 213 $corpus = phutil_tag( 214 214 'textarea', ··· 301 301 ), 302 302 $corpus_table); 303 303 304 - $corpus = id(new PHUIObjectBoxView()) 305 - ->setHeaderText('File Contents') 306 - ->appendChild($corpus); 307 - 308 304 Javelin::initBehavior('load-blame', array('id' => $id)); 309 305 } 310 306 307 + $button = $this->createEditButton(); 308 + $header = id(new PHUIHeaderView()) 309 + ->setHeader(pht('File Contents')) 310 + ->addActionLink($button); 311 + 312 + $corpus = id(new PHUIObjectBoxView()) 313 + ->setHeader($header) 314 + ->appendChild($corpus); 315 + 311 316 return $corpus; 312 317 } 313 318 ··· 348 353 ->setIcon($blame_icon) 349 354 ->setUser($viewer) 350 355 ->setRenderAsForm(true)); 351 - 352 356 353 357 if ($show_color) { 354 358 $highlight_text = pht('Disable Highlighting'); ··· 406 410 ->setIcon('file')); 407 411 } 408 412 409 - $view->addAction($this->createEditAction()); 410 - 411 413 return $view; 412 414 } 413 415 414 - private function createEditAction() { 416 + private function createEditButton() { 415 417 $request = $this->getRequest(); 416 418 $user = $request->getUser(); 417 419 ··· 424 426 $callsign = $repository->getCallsign(); 425 427 $editor_link = $user->loadEditorLink($path, $line, $callsign); 426 428 427 - $action = id(new PhabricatorActionView()) 428 - ->setName(pht('Open in Editor')) 429 - ->setIcon('edit'); 429 + $icon_edit = id(new PHUIIconView()) 430 + ->setSpriteSheet(PHUIIconView::SPRITE_ICONS) 431 + ->setSpriteIcon('edit'); 432 + $button = id(new PHUIButtonView()) 433 + ->setTag('a') 434 + ->setText(pht('Open in Editor')) 435 + ->setHref($editor_link) 436 + ->setIcon($icon_edit) 437 + ->setDisabled(!$editor_link); 430 438 431 - $action->setHref($editor_link); 432 - $action->setDisabled(!$editor_link); 433 - 434 - return $action; 439 + return $button; 435 440 } 436 441 437 442 private function buildDisplayRows(
+10
src/view/phui/PHUIButtonView.php
··· 20 20 private $icon; 21 21 private $href = null; 22 22 private $title = null; 23 + private $disabled; 23 24 24 25 public function setText($text) { 25 26 $this->text = $text; ··· 43 44 44 45 public function setColor($color) { 45 46 $this->color = $color; 47 + return $this; 48 + } 49 + 50 + public function setDisabled($disabled) { 51 + $this->disabled = $disabled; 46 52 return $this; 47 53 } 48 54 ··· 91 97 92 98 if ($this->icon) { 93 99 $classes[] = 'has-icon'; 100 + } 101 + 102 + if ($this->disabled) { 103 + $classes[] = 'disabled'; 94 104 } 95 105 96 106 return array('class' => $classes,