@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 raw file download icon to file box in Diffusion

Summary: For images and text, show the "Raw" buttons on the file's ObjectBox

Test Plan: View an image and a text file in Diffusion, click on the download link in each.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4467

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

+40 -22
+40 -22
src/applications/diffusion/controller/DiffusionBrowseFileController.php
··· 104 104 $view, 105 105 $drequest, 106 106 $show_blame, 107 - $show_color, 108 - $binary_uri); 107 + $show_color); 109 108 110 109 $properties = $this->buildPropertyView($drequest, $action_list); 111 110 $object_box = id(new PHUIObjectBoxView()) ··· 304 303 Javelin::initBehavior('load-blame', array('id' => $id)); 305 304 } 306 305 307 - $button = $this->createEditButton(); 306 + $edit = $this->renderEditButton(); 307 + $file = $this->renderFileButton(); 308 308 $header = id(new PHUIHeaderView()) 309 309 ->setHeader(pht('File Contents')) 310 - ->addActionLink($button); 310 + ->addActionLink($edit) 311 + ->addActionLink($file); 311 312 312 313 $corpus = id(new PHUIObjectBoxView()) 313 314 ->setHeader($header) ··· 320 321 PhabricatorActionListView $view, 321 322 DiffusionRequest $drequest, 322 323 $show_blame, 323 - $show_color, 324 - $binary_uri) { 324 + $show_color) { 325 325 326 326 $viewer = $this->getRequest()->getUser(); 327 327 $base_uri = $this->getRequest()->getRequestURI(); ··· 396 396 ->setIcon('warning') 397 397 ->setDisabled(!$href)); 398 398 399 - if ($binary_uri) { 400 - $view->addAction( 401 - id(new PhabricatorActionView()) 402 - ->setName(pht('Download Raw File')) 403 - ->setHref($binary_uri) 404 - ->setIcon('download')); 405 - } else { 406 - $view->addAction( 407 - id(new PhabricatorActionView()) 408 - ->setName(pht('View Raw File')) 409 - ->setHref($base_uri->alter('view', 'raw')) 410 - ->setIcon('file')); 411 - } 412 - 413 399 return $view; 414 400 } 415 401 416 - private function createEditButton() { 402 + private function renderEditButton() { 417 403 $request = $this->getRequest(); 418 404 $user = $request->getUser(); 419 405 ··· 438 424 439 425 return $button; 440 426 } 427 + 428 + private function renderFileButton($file_uri = null) { 429 + 430 + $base_uri = $this->getRequest()->getRequestURI(); 431 + 432 + if ($file_uri) { 433 + $text = pht('Download Raw File'); 434 + $href = $file_uri; 435 + $icon = 'download'; 436 + } else { 437 + $text = pht('View Raw File'); 438 + $href = $base_uri->alter('view', 'raw'); 439 + $icon = 'file'; 440 + } 441 + 442 + $iconview = id(new PHUIIconView()) 443 + ->setSpriteSheet(PHUIIconView::SPRITE_ICONS) 444 + ->setSpriteIcon($icon); 445 + $button = id(new PHUIButtonView()) 446 + ->setTag('a') 447 + ->setText($text) 448 + ->setHref($href) 449 + ->setIcon($iconview); 450 + 451 + return $button; 452 + } 453 + 441 454 442 455 private function buildDisplayRows( 443 456 array $text_list, ··· 847 860 'src' => $file_uri, 848 861 ))); 849 862 863 + $file = $this->renderFileButton($file_uri); 864 + $header = id(new PHUIHeaderView()) 865 + ->setHeader(pht('Image')) 866 + ->addActionLink($file); 867 + 850 868 return id(new PHUIObjectBoxView()) 851 - ->setHeaderText(pht('Image')) 869 + ->setHeader($header) 852 870 ->addPropertyList($properties); 853 871 } 854 872