summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-08 17:07:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-08 17:07:38 -0400
commit09449792fa50686e2fb9af6c392b8644dddae5d6 (patch)
tree52c706411d5f4d8ec4e28081dacabf83353059bb /templates
parent94fcd0cf59f94dd29ab171f0875bd25af65fd527 (diff)
factor out onclick javascript
Diffstat (limited to 'templates')
-rw-r--r--templates/actionbutton.hamlet2
-rw-r--r--templates/dashboard/transfers.hamlet9
-rw-r--r--templates/page.hamlet3
-rw-r--r--templates/sidebar/alert.hamlet4
4 files changed, 8 insertions, 10 deletions
diff --git a/templates/actionbutton.hamlet b/templates/actionbutton.hamlet
new file mode 100644
index 000000000..03abe5c11
--- /dev/null
+++ b/templates/actionbutton.hamlet
@@ -0,0 +1,2 @@
+<a class="#{buttonclass}" href="@{route}" onclick="(function( $ ) { $.post('@{route}'); })( jQuery ); return false;">
+ <i class="#{iconclass}"></i> #{fromMaybe "" label}
diff --git a/templates/dashboard/transfers.hamlet b/templates/dashboard/transfers.hamlet
index 150dcc296..6ace2ae84 100644
--- a/templates/dashboard/transfers.hamlet
+++ b/templates/dashboard/transfers.hamlet
@@ -28,10 +28,7 @@
<div .bar style="width: #{percent};">
<div .btn-group .span2>
$if isNothing (startedTime info)
- <a .btn href="@{StartTransferR transfer}" onclick="(function( $ ) { $.post('@{StartTransferR transfer}'); })( jQuery ); return false;">
- <i .icon-play title="start"></i>
+ ^{actionButton (StartTransferR transfer) Nothing "btn" "icon-play"}
$else
- <a .btn href="@{PauseTransferR transfer}" onclick="(function( $ ) { $.post('@{PauseTransferR transfer}'); })( jQuery ); return false;">
- <i .icon-pause title="pause"></i>
- <a .btn href="@{CancelTransferR transfer}" onclick="(function( $ ) { $.post('@{CancelTransferR transfer}'); })( jQuery ); return false;">
- <i .icon-remove title="cancel"></i>
+ ^{actionButton (PauseTransferR transfer) Nothing "btn" "icon-pause"}
+ ^{actionButton (CancelTransferR transfer) Nothing "btn" "icon-remove"}
diff --git a/templates/page.hamlet b/templates/page.hamlet
index 2d33e9561..0c07c9130 100644
--- a/templates/page.hamlet
+++ b/templates/page.hamlet
@@ -10,8 +10,7 @@
$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
+ ^{actionButton FileBrowserR (Just "Files") "" "icon-folder-open icon-white"}
<li .dropdown #menu1>
<a .dropdown-toggle data-toggle="dropdown" href="#menu1">
Current Repository: #{reldir}
diff --git a/templates/sidebar/alert.hamlet b/templates/sidebar/alert.hamlet
index 4275931a9..85ff58482 100644
--- a/templates/sidebar/alert.hamlet
+++ b/templates/sidebar/alert.hamlet
@@ -1,6 +1,6 @@
-<div .alert .fade .in .#{divclass} :block:.alert-block ##{alertid} :closable:onclick="(function( $ ) { $.get('@{closealert}') })( jQuery );">
+<div .alert .fade .in .#{divclass} :block:.alert-block ##{alertid} :closable:onclick="(function( $ ) { $.get('@{CloseAlert i}') })( jQuery );">
$if closable
- <a .close data-dismiss="alert">&times;</a>
+ <a .close>&times;</a>
$maybe h <- heading
$if block
<h4 .alert-heading>