2021-03-05 19:23:32 -05:00
|
|
|
defmodule Shift73kWeb.LayoutView do
|
|
|
|
use Shift73kWeb, :view
|
2021-02-25 18:21:43 -05:00
|
|
|
|
2021-03-05 19:23:32 -05:00
|
|
|
alias Shift73k.Accounts.User
|
|
|
|
alias Shift73kWeb.Roles
|
2021-03-04 22:03:27 -05:00
|
|
|
|
2022-08-13 07:32:36 -04:00
|
|
|
# With a Vite.js-based workflow, we will import different asset files in development
|
|
|
|
# and in production builds. Therefore, we will need a way to conditionally render
|
|
|
|
# <script> tags based on Mix environment. However, since Mix is not available in
|
|
|
|
# releases, we need to cache the Mix environment at compile time. To this end:
|
|
|
|
@env Mix.env() # remember value at compile time
|
|
|
|
def dev_env?, do: @env == :dev
|
|
|
|
|
2021-02-25 18:21:43 -05:00
|
|
|
def nav_link_opts(conn, opts) do
|
|
|
|
case Keyword.get(opts, :to) == Phoenix.Controller.current_path(conn) do
|
|
|
|
false -> opts
|
|
|
|
true -> Keyword.update(opts, :class, "active", fn c -> "#{c} active" end)
|
|
|
|
end
|
|
|
|
end
|
2021-02-26 12:07:33 -05:00
|
|
|
|
|
|
|
def alert_kinds do
|
|
|
|
[
|
2021-03-03 16:52:26 -05:00
|
|
|
success: "alert-success",
|
|
|
|
info: "alert-info",
|
|
|
|
error: "alert-danger",
|
|
|
|
warning: "alert-warning",
|
|
|
|
primary: "alert-primary",
|
|
|
|
secondary: "alert-secondary"
|
2021-02-26 12:07:33 -05:00
|
|
|
]
|
|
|
|
end
|
2021-02-24 07:49:39 -05:00
|
|
|
end
|