Page MenuHomePhabricator

D8302.id19750.diff
No OneTemporary

D8302.id19750.diff

Index: src/applications/diffusion/controller/DiffusionBrowseFileController.php
===================================================================
--- src/applications/diffusion/controller/DiffusionBrowseFileController.php
+++ src/applications/diffusion/controller/DiffusionBrowseFileController.php
@@ -104,8 +104,7 @@
$view,
$drequest,
$show_blame,
- $show_color,
- $binary_uri);
+ $show_color);
$properties = $this->buildPropertyView($drequest, $action_list);
$object_box = id(new PHUIObjectBoxView())
@@ -304,10 +303,12 @@
Javelin::initBehavior('load-blame', array('id' => $id));
}
- $button = $this->createEditButton();
+ $edit = $this->renderEditButton();
+ $file = $this->renderFileButton();
$header = id(new PHUIHeaderView())
->setHeader(pht('File Contents'))
- ->addActionLink($button);
+ ->addActionLink($edit)
+ ->addActionLink($file);
$corpus = id(new PHUIObjectBoxView())
->setHeader($header)
@@ -320,8 +321,7 @@
PhabricatorActionListView $view,
DiffusionRequest $drequest,
$show_blame,
- $show_color,
- $binary_uri) {
+ $show_color) {
$viewer = $this->getRequest()->getUser();
$base_uri = $this->getRequest()->getRequestURI();
@@ -396,24 +396,10 @@
->setIcon('warning')
->setDisabled(!$href));
- if ($binary_uri) {
- $view->addAction(
- id(new PhabricatorActionView())
- ->setName(pht('Download Raw File'))
- ->setHref($binary_uri)
- ->setIcon('download'));
- } else {
- $view->addAction(
- id(new PhabricatorActionView())
- ->setName(pht('View Raw File'))
- ->setHref($base_uri->alter('view', 'raw'))
- ->setIcon('file'));
- }
-
return $view;
}
- private function createEditButton() {
+ private function renderEditButton() {
$request = $this->getRequest();
$user = $request->getUser();
@@ -439,6 +425,33 @@
return $button;
}
+ private function renderFileButton($file_uri = null) {
+
+ $base_uri = $this->getRequest()->getRequestURI();
+
+ if ($file_uri) {
+ $text = pht('Download Raw File');
+ $href = $file_uri;
+ $icon = 'download';
+ } else {
+ $text = pht('View Raw File');
+ $href = $base_uri->alter('view', 'raw');
+ $icon = 'file';
+ }
+
+ $iconview = id(new PHUIIconView())
+ ->setSpriteSheet(PHUIIconView::SPRITE_ICONS)
+ ->setSpriteIcon($icon);
+ $button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText($text)
+ ->setHref($href)
+ ->setIcon($iconview);
+
+ return $button;
+ }
+
+
private function buildDisplayRows(
array $text_list,
array $rev_list,
@@ -847,8 +860,13 @@
'src' => $file_uri,
)));
+ $file = $this->renderFileButton($file_uri);
+ $header = id(new PHUIHeaderView())
+ ->setHeader(pht('Image'))
+ ->addActionLink($file);
+
return id(new PHUIObjectBoxView())
- ->setHeaderText(pht('Image'))
+ ->setHeader($header)
->addPropertyList($properties);
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 12, 12:09 AM (1 w, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723076
Default Alt Text
D8302.id19750.diff (3 KB)

Event Timeline