Module: NPlusInsight::Overlay

Defined in:
lib/n_plus_insight/overlay.rb

Class Method Summary collapse

Class Method Details

.render(detections) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/n_plus_insight/overlay.rb', line 4

def render(detections)
  payload = Base64.strict_encode64(JSON.generate(detections.map { |detection| serialize(detection) }))
  mount_path = NPlusInsight.configuration.mount_path.chomp("/")

  <<~HTML
    <div id="n1v-root" data-payload="#{payload}"></div>
    <link rel="stylesheet" href="#{mount_path}/assets/overlay.css">
    <script src="#{mount_path}/assets/overlay.js" defer></script>
  HTML
end