mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +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:
parent
a7da4fad88
commit
9f51f1933f
1 changed files with 27 additions and 22 deletions
|
@ -744,36 +744,41 @@ final class DiffusionBrowseFileController extends DiffusionController {
|
|||
}
|
||||
|
||||
private function buildImageCorpus($file_uri) {
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Image');
|
||||
$panel->addButton($this->renderEditButton());
|
||||
$panel->appendChild(
|
||||
$properties = new PhabricatorPropertyListView();
|
||||
|
||||
$properties->addProperty(
|
||||
pht('Image'),
|
||||
phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'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) {
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Binary File');
|
||||
$panel->addButton($this->renderEditButton());
|
||||
$panel->appendChild(
|
||||
'<p>'.
|
||||
'This is a binary file. '.
|
||||
'It is '.number_format(strlen($data)).' bytes in length.'.
|
||||
'</p>');
|
||||
$panel->addButton(
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $file_uri,
|
||||
'class' => 'button green',
|
||||
),
|
||||
'Download Binary File...'));
|
||||
return $panel;
|
||||
$properties = new PhabricatorPropertyListView();
|
||||
|
||||
$properties->addTextContent(
|
||||
pht('This is a binary file. It is %d bytes in length.',
|
||||
number_format(strlen($data)))
|
||||
);
|
||||
|
||||
$actions = id(new PhabricatorActionListView())
|
||||
->setUser($this->getRequest()->getUser())
|
||||
->addAction($this->createEditAction())
|
||||
->addAction(id(new PhabricatorActionView())
|
||||
->setName(pht('Download Binary File...'))
|
||||
->setIcon('download')
|
||||
->setHref($file_uri));
|
||||
|
||||
return array($actions, $properties);
|
||||
|
||||
}
|
||||
|
||||
private function buildBeforeResponse($before) {
|
||||
|
|
Loading…
Reference in a new issue