aboutsummaryrefslogtreecommitdiff
path: root/templates/page.hamlet
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-03 09:44:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-03 10:02:56 -0400
commit1f89712e6b0a601f3a4685cfbcd4cb5d3180c0e5 (patch)
tree8e01c6c89c00c74d23084bb4e00c5a8ff23ffeba /templates/page.hamlet
parent13a7362a1a6264689519a8aa685c908ec5660129 (diff)
add a navbar button that opens the repo in the desktop's native file browser
This should work on linux (xdg-open) and OSX (open). If the program is not in $PATH, it falls back to opening a browser window/tab with file:/// The only tricky bit is the javascript code, that handles clicking on the link. This is to avoid unnecessary page refreshes. Until I added the return false at the end, the <a>'s normal click event also fired, so two file browsers opened. I have not checked portability extensively.
Diffstat (limited to 'templates/page.hamlet')
-rw-r--r--templates/page.hamlet3
1 files changed, 3 insertions, 0 deletions
diff --git a/templates/page.hamlet b/templates/page.hamlet
index 29a091110..6321f7a18 100644
--- a/templates/page.hamlet
+++ b/templates/page.hamlet
@@ -9,6 +9,9 @@
<a href="@{route}">#{name}</a>
$maybe reldir <- relDir webapp
<ul .nav .pull-right>
+ <li>
+ <a href="@{FileBrowserR}" onclick="(function( $ ) { $.post('@{FileBrowserR}'); })( jQuery ); return false;">
+ <i .icon-folder-open .icon-white></i> Files
<li .dropdown #menu1>
<a .dropdown-toggle data-toggle="dropdown" href="#menu1">
Current Repository: #{reldir}