Skip to content

Commit

Permalink
Rough out polling.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarnette committed Sep 12, 2010
1 parent f815b97 commit 366908f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion config/templates/index.html.erb
Expand Up @@ -4,6 +4,7 @@
<link href="screen.css" media="screen" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<title>Fortress Joe</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<div class="site">
Expand All @@ -17,7 +18,7 @@
<div id="home">
<ul class="posts">
<% @projects.each do |p| %>
<li>
<li class="project" id="<%= p %>">
<a href="/<%= p %>"><%= p %></a>
</li>
<% end %>
Expand Down Expand Up @@ -49,4 +50,27 @@
</div>
</div>
</body>

<script type="text/javascript">
$(function() {
setInterval(function() {
$(".project").each(function() {
var li = $(this);

$.ajax({
url: "/" + this.id + "/ping",

success: function(data, textStatus, xhr) {
$(li).removeClass("building failed").addClass("worked");
},

error: function(xhr, textStatus, errorThrown) {
/* FIX: depends on contents */
$(li).removeClass("building worked").addClass("failed");
}
});
});
}, 3000);
});
</script>
</html>

0 comments on commit 366908f

Please sign in to comment.