summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-29 03:23:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-29 03:23:17 -0400
commit62dac858807da8fb62ce55adbed84cfe582367b2 (patch)
treeca84c8b1eac3a35c576e9ff7117b53c1ffd5c2e0 /templates
parente96107caf3745d658a36e0ad7716dd07a57657a2 (diff)
update the sidebar by long polling
Needs to use a different NotificationBroadcaster, and not replace the whole sidebar div, but instead add in new content. However, it's 3:30 am.
Diffstat (limited to 'templates')
-rw-r--r--templates/longpolling.julius8
-rw-r--r--templates/page.hamlet21
-rw-r--r--templates/sidebar.hamlet18
-rw-r--r--templates/transfers.hamlet53
4 files changed, 49 insertions, 51 deletions
diff --git a/templates/longpolling.julius b/templates/longpolling.julius
index 926249a35..95425d615 100644
--- a/templates/longpolling.julius
+++ b/templates/longpolling.julius
@@ -9,7 +9,7 @@
numerrs=0;
-$.LongPoll = (function() {
+$.LongPoll#{ident} = (function() {
return {
send : function() {
$.ajax({
@@ -17,7 +17,7 @@ $.LongPoll = (function() {
'dataType': 'html',
'success': function(data, status, jqxhr) {
$('##{ident}').replaceWith(data);
- setTimeout($.LongPoll.send, #{show delay});
+ setTimeout($.LongPoll#{ident}.send, #{show delay});
numerrs=0;
},
'error': function(jqxhr, msg, e) {
@@ -26,7 +26,7 @@ $.LongPoll = (function() {
window.close();
}
else {
- setTimeout($.LongPoll.send, #{show delay});
+ setTimeout($.LongPoll#{ident}.send, #{show delay});
}
},
});
@@ -35,7 +35,7 @@ $.LongPoll = (function() {
}());
$(document).bind('ready.app', function() {
- setTimeout($.LongPoll.send, #{show startdelay});
+ setTimeout($.LongPoll#{ident}.send, #{show startdelay});
});
})( jQuery );
diff --git a/templates/page.hamlet b/templates/page.hamlet
index ae80bb05d..c397d248c 100644
--- a/templates/page.hamlet
+++ b/templates/page.hamlet
@@ -20,23 +20,4 @@
<div .container-fluid>
<div .row-fluid>
- <div .span3>
- <div .sidebar-nav>
- <div .alert .alert-info>
- <a .close data-dismiss="alert" href="#">&times;</a>
- <b>This is just a demo.</b> If this were not just a demo,
- I'd not be filling this sidebar with silly alerts.
- <div .alert .alert-success>
- <a .close data-dismiss="alert" href="#">&times;</a>
- <b>Well done!</b>
- You successfully read this important alert message.
- <div .alert .alert-error>
- <a .close data-dismiss="alert" href="#">&times;</a>
- <b>Whoops!</b>
- Unable to connect to blah blah..
- <div .span9>
- $maybe msg <- mmsg
- <div .alert .alert-info>
- <a .close data-dismiss="alert" href="#">&times;</a>
- #{msg}
- ^{widget}
+ ^{content}
diff --git a/templates/sidebar.hamlet b/templates/sidebar.hamlet
new file mode 100644
index 000000000..3b5048151
--- /dev/null
+++ b/templates/sidebar.hamlet
@@ -0,0 +1,18 @@
+<div .span3 ##{ident}>
+ <div .sidebar-nav>
+ $maybe msg <- mmsg
+ <div .alert .alert-info>
+ <a .close data-dismiss="alert" href="#">&times;</a>
+ #{msg}
+ <div .alert .alert-info>
+ <a .close data-dismiss="alert" href="#">&times;</a>
+ <b>This is just a demo.</b> If this were not just a demo,
+ I'd not be filling this sidebar with silly alerts.
+ <div .alert .alert-success>
+ <a .close data-dismiss="alert" href="#">&times;</a>
+ <b>Well done!</b>
+ You successfully read this important alert message.
+ <div .alert .alert-error>
+ <a .close data-dismiss="alert" href="#">&times;</a>
+ <b>Whoops!</b>
+ Unable to connect to blah blah.. #{date}
diff --git a/templates/transfers.hamlet b/templates/transfers.hamlet
index 417ba3d62..bc69d7f87 100644
--- a/templates/transfers.hamlet
+++ b/templates/transfers.hamlet
@@ -1,30 +1,29 @@
-<span ##{ident}>
- <div .span9>
- $if null transfers
- <h2>No current transfers
- $else
- <h2>Transfers
- $forall (transfer, info) <- transfers
- $with percent <- maybe "unknown" (showPercentage 0) $ percentComplete transfer info
- <div .row-fluid>
- <h3>
- $maybe file <- associatedFile info
- #{file}
- $nothing
- #{show $ transferKey transfer}
- $case transferDirection transfer
- $of Upload
- &rarr;
- $of Download
- &larr;
- <small>#{maybe "unknown" Remote.name $ transferRemote info}</small>
- $with size <- maybe "unknown" (roughSize dataUnits True) $ keySize $ transferKey transfer
- $if isJust $ startedTime info
- <small .pull-right><b>#{percent} of #{size}</b></small>
- $else
- <small .pull-right>queued (#{size})</small>
- <div .progress .progress-striped>
- <div .bar style="width: #{percent};">
+<div .span9 ##{ident}>
+ $if null transfers
+ <h2>No current transfers
+ $else
+ <h2>Transfers
+ $forall (transfer, info) <- transfers
+ $with percent <- maybe "unknown" (showPercentage 0) $ percentComplete transfer info
+ <div .row-fluid>
+ <h3>
+ $maybe file <- associatedFile info
+ #{file}
+ $nothing
+ #{show $ transferKey transfer}
+ $case transferDirection transfer
+ $of Upload
+ &rarr;
+ $of Download
+ &larr;
+ <small>#{maybe "unknown" Remote.name $ transferRemote info}</small>
+ $with size <- maybe "unknown" (roughSize dataUnits True) $ keySize $ transferKey transfer
+ $if isJust $ startedTime info
+ <small .pull-right><b>#{percent} of #{size}</b></small>
+ $else
+ <small .pull-right>queued (#{size})</small>
+ <div .progress .progress-striped>
+ <div .bar style="width: #{percent};">
$if warnNoScript
<noscript>
<div .navbar .navbar-fixed-bottom>