Packages

Live error monitoring to watch your Phoenix app going up in flames in real time! Open source version of error aggregation services. Hooks into Elixir's Logger to provide accurate error reporting all throughout your application.

Current section

Files

Jump to
flames lib flames_web dashboard layout_view.ex
Raw

lib/flames_web/dashboard/layout_view.ex

defmodule Flames.Dashboard.LayoutView do
@moduledoc false
use Flames.Web, :html
embed_templates("layouts/*")
phoenix_path = Application.app_dir(:phoenix, "priv/static/phoenix.js")
phoenix_html_path = Application.app_dir(:phoenix_html, "priv/static/phoenix_html.js")
phoenix_live_view_path =
Application.app_dir(:phoenix_live_view, "priv/static/phoenix_live_view.js")
js_path = Path.join(__DIR__, "../../../priv/static/assets/app.js")
css_path = Path.join(__DIR__, "../../../priv/static/assets/app.css")
@external_resource phoenix_path
@external_resource phoenix_html_path
@external_resource phoenix_live_view_path
@external_resource js_path
@external_resource css_path
@app_js """
#{File.read!(phoenix_html_path) |> String.replace("//# sourceMappingURL=", "// ")}
#{File.read!(phoenix_path) |> String.replace("//# sourceMappingURL=", "// ")}
#{File.read!(phoenix_live_view_path) |> String.replace("//# sourceMappingURL=", "// ")}
#{File.read!(js_path)}
"""
def render("app.js", _), do: @app_js
@app_css File.read!(css_path)
def render("app.css", _), do: @app_css
def render("dashboard.html", assigns), do: dashboard(assigns)
defp csp_nonce(conn, type) when type in [:script, :style, :img] do
csp_nonce_assign_key = conn.private.csp_nonce_assign_key[type]
conn.assigns[csp_nonce_assign_key]
end
def live_socket_path(conn) do
[Enum.map(conn.script_name, &["/" | &1]) | conn.private.live_socket_path]
end
end