lib/bugherd/helpers/bugherd_helper.rb in bugherd-0.0.3 vs lib/bugherd/helpers/bugherd_helper.rb in bugherd-0.0.4

- old
+ new

@@ -11,6 +11,24 @@ s.parentNode.insertBefore(bh, s); })(document, 'script'); " end + def bugherd_turbolinks_tag(options = {}) + key = ENV['BUGHERD_PROJECT_KEY'] || BugHerd.configuration.project_key + javascript_tag " + var BugHerdConfig = #{options.to_json}; + $(function() { + if (window._bugHerd) { + window._bugHerd.loadingComplete = false; + } + (function (d, t) { + var bh = d.createElement(t), s = d.getElementsByTagName(t)[0]; + bh.type = 'text/javascript'; + bh.src = '//www.bugherd.com/sidebarv2.js?apikey=#{key}'; + s.parentNode.insertBefore(bh, s); + })(document, 'script'); + }); + " + end + end