app/views/pg_bouncer_hero/home/index.html.haml in pgbouncerhero-0.1.1 vs app/views/pg_bouncer_hero/home/index.html.haml in pgbouncerhero-1.0.0

- old
+ new

@@ -5,11 +5,11 @@ .ui.grid - @groups.each do |_, group| .sixteen.wide.row .sixteen.wide.column %h3.ui.dividing.header{style: 'margin-bottom: 10px;'}= group.name - = render partial: "card", collection: group.databases, as: :database, locals: {partial: 'card_loading_content'} + = render partial: "card", collection: group.databases, as: :database, locals: {partial: 'card_loading_content', lazy: true} :javascript document.addEventListener("DOMContentLoaded", function(event) { // First $("[id^='segment_href']").each(function(idx, el) { @@ -20,12 +20,15 @@ $("[id^='segment_href']").each(function(idx, el) { var el = $(el) var id = el.attr('id'); var href = el.data('href'); var refreshed_id = id.replace('href', 'refreshed_span'); - document.getElementById(refreshed_id).innerHTML = 'Refreshing...'; - $.get(href, function(data) { - document.getElementById(refreshed_id).innerHTML = 'Last refresh: ' + new Date().toTimeString(); - }); + var refreshed_div = document.getElementById(refreshed_id); + if (refreshed_div) { + refreshed_div.innerHTML = 'Refreshing...'; + $.get(href, function(data) { + refreshed_div.innerHTML = 'Last refresh: ' + new Date().toTimeString(); + }); + } }); }, 60 * 1000) });