Sha256: 3199550e504b0ba52088de439c4382f00a5d5b9fbe65481d6143bc8860384532

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

module BugHerdHelper

  def bugherd_tag(options = {})
    key = ENV['BUGHERD_PROJECT_KEY'] || BugHerd.configuration.project_key
    javascript_tag "
      var BugHerdConfig = #{options.to_json};
      (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

  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bugherd-0.0.4 lib/bugherd/helpers/bugherd_helper.rb