Page MenuHomePhorge

D25301.1736978887.diff
No OneTemporary

D25301.1736978887.diff

diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php
--- a/src/applications/diffusion/controller/DiffusionBrowseController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseController.php
@@ -193,6 +193,7 @@
$corpus = $engine->newDocumentView($ref);
$this->corpusButtons[] = $this->renderFileButton();
+ $this->corpusButtons[] = $this->renderPermalinkButton($drequest);
}
}
@@ -599,6 +600,39 @@
return $button;
}
+ /**
+ * Render a button that points to the Permalink version of this file.
+ *
+ * @param DiffusionRequest $drequest
+ * @return PHUIButtonView
+ */
+ private function renderPermalinkButton(DiffusionRequest $drequest) {
+
+ $text = pht('Permalink');
+ $icon = 'fa-link';
+
+ $href = (string)$drequest->generateURI(
+ array(
+ 'action' => 'browse',
+ 'stable' => 'true',
+ ));
+
+ $selected = $drequest->getSymbolicCommit() === $drequest->getStableCommit();
+
+ $button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText($text)
+ ->setHref($href)
+ ->setIcon($icon)
+ ->setSelected($selected)
+ ->setColor(PHUIButtonView::GREY);
+
+ // TODO: Somehow change the URL of the page without reloading the page.
+ // Similar dark magic is probably in the "Hide Blame" button.
+
+ return $button;
+ }
+
private function renderGitLFSButton() {
$viewer = $this->getViewer();

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 15, 22:08 (2 d, 3 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1116241
Default Alt Text
D25301.1736978887.diff (1 KB)

Event Timeline