1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-22 19:49:02 +01:00

Bug fix for diffusion browse views for images and binary files

Summary: D3499 introduced some new hotness but broke these less common cases. add slightly updated ui for this.  Note we need a 'download' icon for this UI to not be horrendous.

Test Plan: viewed a binary file and an image in diffusion browse view

Reviewers: epriestley

Reviewed By: epriestley

CC: nh, aran, Korvin

Maniphest Tasks: T1997

Differential Revision: https://secure.phabricator.com/D3849
This commit is contained in:
Bob Trahan 2012-10-31 11:43:17 -07:00
parent a7da4fad88
commit 9f51f1933f

View file

@ -744,36 +744,41 @@ final class DiffusionBrowseFileController extends DiffusionController {
} }
private function buildImageCorpus($file_uri) { private function buildImageCorpus($file_uri) {
$panel = new AphrontPanelView(); $properties = new PhabricatorPropertyListView();
$panel->setHeader('Image');
$panel->addButton($this->renderEditButton()); $properties->addProperty(
$panel->appendChild( pht('Image'),
phutil_render_tag( phutil_render_tag(
'img', 'img',
array( array(
'src' => $file_uri, 'src' => $file_uri,
))); )));
return $panel;
$actions = id(new PhabricatorActionListView())
->setUser($this->getRequest()->getUser())
->addAction($this->createEditAction());
return array($actions, $properties);
} }
private function buildBinaryCorpus($file_uri, $data) { private function buildBinaryCorpus($file_uri, $data) {
$panel = new AphrontPanelView(); $properties = new PhabricatorPropertyListView();
$panel->setHeader('Binary File');
$panel->addButton($this->renderEditButton()); $properties->addTextContent(
$panel->appendChild( pht('This is a binary file. It is %d bytes in length.',
'<p>'. number_format(strlen($data)))
'This is a binary file. '. );
'It is '.number_format(strlen($data)).' bytes in length.'.
'</p>'); $actions = id(new PhabricatorActionListView())
$panel->addButton( ->setUser($this->getRequest()->getUser())
phutil_render_tag( ->addAction($this->createEditAction())
'a', ->addAction(id(new PhabricatorActionView())
array( ->setName(pht('Download Binary File...'))
'href' => $file_uri, ->setIcon('download')
'class' => 'button green', ->setHref($file_uri));
),
'Download Binary File...')); return array($actions, $properties);
return $panel;
} }
private function buildBeforeResponse($before) { private function buildBeforeResponse($before) {