Module: Debugbar::TagHelpers

Defined in:
app/helpers/debugbar/tag_helpers.rb

Instance Method Summary collapse

Instance Method Details

#debugbar_body(opt = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/debugbar/tag_helpers.rb', line 8

def debugbar_body(opt = {})
  opt = ActiveSupport::HashWithIndifferentAccess.new(opt)

  # See https://github.com/julienbourdeau/debugbar/issues/8
  if !defined?(ActionCable) && opt[:mode].nil?
    opt[:mode] = 'poll'
  end

  if opt[:active_record].nil?
    opt[:active_record] = { adapter: db_adapter }
  end

  html = "    <div id=\"__debugbar\" data-turbo-permanent></div>\n  HTML\n\n  html += <<-HTML\n    <script type=\"text/javascript\" data-turbo-permanent nonce=\"\#{opt.delete(:nonce)}\">\n      window._debugbarConfigOptions = \#{opt.to_json}\n    </script>\n  HTML\n\n  raw html\nend\n"

#debugbar_headObject



2
3
4
5
6
# File 'app/helpers/debugbar/tag_helpers.rb', line 2

def debugbar_head
  raw "    <script defer src=\"\#{Debugbar.config.prefix}/assets/script\"></script>\n  HTML\nend\n"

#debugbar_javascript(opt = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'app/helpers/debugbar/tag_helpers.rb', line 33

def debugbar_javascript(opt = {})
  errors = [""]
  errors << "debugbar_javascript was removed in 0.3.0."
  errors << "Please use `debugbar_head` inside <head> and `debugbar_body` at the end of <body> instead."
  errors << "It was split to support Turbo Drive."
  errors << "See https://debugbar.dev/changelog/ for more information."
  errors << ""
  raise errors.join("\n")
end