-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathconfig_component.ex
More file actions
38 lines (35 loc) · 1.04 KB
/
config_component.ex
File metadata and controls
38 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
defmodule LiveDebugger.Client.ConfigComponent do
@moduledoc """
Renders the LiveDebugger config meta tag and the browser features script.
It is meant to be injected to the debugged application layout.
"""
use Phoenix.Component
attr(:url, :string, required: true)
attr(:js_url, :string, required: true)
attr(:phoenix_url, :string, required: true)
attr(:browser_features?, :boolean, default: true)
attr(:version, :string, default: nil)
attr(:debug_button?, :boolean, default: true)
attr(:e2e?, :boolean, default: false)
def live_debugger_tags(assigns) do
~H"""
<%= if @e2e? do %>
<meta
name="live-debugger-config"
url={@url}
version={@version}
debug-button={@debug_button?}
e2e="true"
/>
<% else %>
<meta name="live-debugger-config" url={@url} version={@version} debug-button={@debug_button?} />
<% end %>
<%= if @browser_features? do %>
<script src={@js_url}>
</script>
<script src={@phoenix_url}>
</script>
<% end %>
"""
end
end