From 7351fe300b19b7dd521cf1dd92c31f3f3176e41e Mon Sep 17 00:00:00 2001 From: Brandon Hilkert Date: Mon, 3 Dec 2012 20:00:02 -0500 Subject: [PATCH] Update queues during live poll. --- web/assets/javascripts/application.js | 3 ++- web/views/_queues.slim | 13 +++++++++++++ web/views/poll.slim | 1 + web/views/queues.slim | 18 +----------------- 4 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 web/views/_queues.slim diff --git a/web/assets/javascripts/application.js b/web/assets/javascripts/application.js index 061888fb..1e9a5762 100755 --- a/web/assets/javascripts/application.js +++ b/web/assets/javascripts/application.js @@ -67,6 +67,7 @@ $(function() { $('.summary').replaceWith(responseHtml.find('.summary')); $('.status').html(responseHtml.find('.status').html().toString()); $('.workers').replaceWith(responseHtml.find('.workers')); + $('.queues').replaceWith(responseHtml.find('.queues')); $('time').timeago(); }); var currentTime = new Date(); @@ -76,7 +77,7 @@ $(function() { }); $(function() { - $('[data-confirm]').click(function() { + $(document).on("click", "[data-confirm]", function() { return confirm($(this).attr('data-confirm')); }); }); diff --git a/web/views/_queues.slim b/web/views/_queues.slim new file mode 100644 index 00000000..0e54fbf0 --- /dev/null +++ b/web/views/_queues.slim @@ -0,0 +1,13 @@ +table class="queues table table-hover table-bordered table-striped table-white" + thead + th Queue + th Size + th Actions + - queues.each do |(queue, size)| + tr + td + a href="#{root_path}queues/#{queue}" #{queue} + td= number_with_delimiter(size) + td width="20%" + form action="#{root_path}queues/#{queue}" method="post" + input.btn.btn-danger.btn-small type="submit" name="delete" value="Delete" data-confirm="Are you sure you want to delete the #{queue} queue?" diff --git a/web/views/poll.slim b/web/views/poll.slim index ffdeb4e2..158fb2da 100755 --- a/web/views/poll.slim +++ b/web/views/poll.slim @@ -2,3 +2,4 @@ div == slim :_summary == slim :_workers == slim :_status + == slim :_queues diff --git a/web/views/queues.slim b/web/views/queues.slim index 351acfc1..a2f469c4 100755 --- a/web/views/queues.slim +++ b/web/views/queues.slim @@ -1,19 +1,3 @@ h3 Queues -- if @queues.size > 0 - table class="queues table table-hover table-bordered table-striped table-white" - thead - th Queue - th Size - th Actions - - queues.each do |(queue, size)| - tr - td - a href="#{root_path}queues/#{queue}" #{queue} - td= number_with_delimiter(size) - td width="20%" - form action="#{root_path}queues/#{queue}" method="post" - input.btn.btn-danger.btn-small type="submit" name="delete" value="Delete" data-confirm="Are you sure you want to delete the #{queue} queue?" -- else - p No queues found. - a href="#{root_path}" ← Back +== slim :_queues \ No newline at end of file