forked from shibao/cannery
add assign_defaults/2 to liveviews
This commit is contained in:
parent
2db21c8b69
commit
e9ababa7e1
@ -5,8 +5,8 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
|
|||||||
alias Cannery.Ammo.AmmoGroup
|
alias Cannery.Ammo.AmmoGroup
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, session, socket) do
|
||||||
{:ok, socket |> assign(:ammo_groups, list_ammo_groups())}
|
{:ok, socket |> assign_defaults(session) |> assign(:ammo_groups, list_ammo_groups())}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
@ -4,8 +4,8 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
|
|||||||
alias Cannery.Ammo
|
alias Cannery.Ammo
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, session, socket) do
|
||||||
{:ok, socket}
|
{:ok, socket |> assign_defaults(session)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
@ -5,8 +5,8 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
|
|||||||
alias Cannery.Ammo.AmmoType
|
alias Cannery.Ammo.AmmoType
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, session, socket) do
|
||||||
{:ok, socket |> assign(:ammo_types, list_ammo_types())}
|
{:ok, socket |> assign_defaults(session) |> assign(:ammo_types, list_ammo_types())}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
@ -4,8 +4,8 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
|
|||||||
alias Cannery.Ammo
|
alias Cannery.Ammo
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, session, socket) do
|
||||||
{:ok, socket}
|
{:ok, socket |> assign_defaults(session)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
@ -5,8 +5,8 @@ defmodule CanneryWeb.ContainerLive.Index do
|
|||||||
alias Cannery.Containers.Container
|
alias Cannery.Containers.Container
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, session, socket) do
|
||||||
{:ok, socket |> assign(:containers, list_containers())}
|
{:ok, socket |> assign_defaults(session) |> assign(:containers, list_containers())}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
@ -4,8 +4,8 @@ defmodule CanneryWeb.ContainerLive.Show do
|
|||||||
alias Cannery.Containers
|
alias Cannery.Containers
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, session, socket) do
|
||||||
{:ok, socket}
|
{:ok, socket |> assign_defaults(session)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
@ -5,8 +5,8 @@ defmodule CanneryWeb.TagLive.Index do
|
|||||||
alias Cannery.Tags.Tag
|
alias Cannery.Tags.Tag
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, session, socket) do
|
||||||
{:ok, socket |> assign(:tags, list_tags())}
|
{:ok, socket |> assign_defaults(session) |> assign(:tags, list_tags())}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
@ -4,8 +4,8 @@ defmodule CanneryWeb.TagLive.Show do
|
|||||||
alias Cannery.Tags
|
alias Cannery.Tags
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, session, socket) do
|
||||||
{:ok, socket}
|
{:ok, socket |> assign_defaults(session)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
Loading…
Reference in New Issue
Block a user