add function for update page page automatically

This commit is contained in:
Vokhmin Alexey V 2012-11-09 17:31:35 +04:00
parent b39ccea0d5
commit 1db2115fb0
1 changed files with 25 additions and 2 deletions

View File

@ -6,6 +6,13 @@
- platform = product.platform
%h3= t("layout.product_build_lists.main_data")
.both
%div.reloader
= label_tag :autoreload do
= check_box_tag :autoreload, true, true
= t("layout.autoreload_page")
.both
.leftlist= t("activerecord.attributes.product_build_list.id")
.rightlist= pbl.id
@ -41,7 +48,7 @@
- if @logs.present?
%h3= t("layout.product_build_lists.logs")
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
%table#logs.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th= '#'
@ -73,4 +80,20 @@
:javascript
$('article .all').addClass('bigpadding');
$(function(){
$('article .all').addClass('bigpadding');
var reloadChange = function() {
if ($(this).is(':checked')) {
//reload page every 1 minute
t = setTimeout(function() {
window.location.reload();
}, 10000);
} else {
clearTimeout(t);
}
}
$('#autoreload').on('change', reloadChange)
.trigger('change');
});