add docs, delete unused functions
This commit is contained in:
parent
664913da7d
commit
68eb1c62ad
|
@ -21,6 +21,9 @@ defmodule PokemonCouture.Shops do
|
||||||
Repo.all(Clothes)
|
Repo.all(Clothes)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Returns the list of clothes with owners preloaded.
|
||||||
|
"""
|
||||||
def list_clothes_with_owners do
|
def list_clothes_with_owners do
|
||||||
Repo.all(from c in Clothes, preload: [:users])
|
Repo.all(from c in Clothes, preload: [:users])
|
||||||
end
|
end
|
||||||
|
@ -105,6 +108,9 @@ defmodule PokemonCouture.Shops do
|
||||||
Clothes.changeset(clothes, attrs)
|
Clothes.changeset(clothes, attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Adds a new owner to a piece of clothing.
|
||||||
|
"""
|
||||||
def add_owner(clothes, user) do
|
def add_owner(clothes, user) do
|
||||||
clothes
|
clothes
|
||||||
|> Ecto.Changeset.change()
|
|> Ecto.Changeset.change()
|
||||||
|
@ -112,6 +118,9 @@ defmodule PokemonCouture.Shops do
|
||||||
|> Repo.update!()
|
|> Repo.update!()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Removes an owner from a piece of clothing.
|
||||||
|
"""
|
||||||
def remove_owner(clothes, user) do
|
def remove_owner(clothes, user) do
|
||||||
clothes
|
clothes
|
||||||
|> Ecto.Changeset.change()
|
|> Ecto.Changeset.change()
|
||||||
|
|
|
@ -22,15 +22,4 @@ defmodule PokemonCoutureWeb.ClothesTrackerLive do
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
{:ok, socket}
|
{:ok, socket}
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event("on", _value, socket) do
|
|
||||||
socket =
|
|
||||||
socket
|
|
||||||
|> assign(:light_bulb_status, "on")
|
|
||||||
|> assign(:on_button_status, "disabled")
|
|
||||||
|> assign(:off_button_status, "enabled")
|
|
||||||
|
|
||||||
{:noreply, socket}
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,6 @@ defmodule PokemonCoutureWeb.Components.ClothesComponent do
|
||||||
use Phoenix.LiveComponent
|
use Phoenix.LiveComponent
|
||||||
|
|
||||||
alias PokemonCouture.Shops
|
alias PokemonCouture.Shops
|
||||||
def mount(socket) do
|
|
||||||
{:ok, socket}
|
|
||||||
end
|
|
||||||
|
|
||||||
def render(assigns) do
|
def render(assigns) do
|
||||||
~L"""
|
~L"""
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
<li>
|
<li>
|
||||||
<a href="http://localhost:4000/clothes">Clothes page</a>
|
<a href="http://localhost:4000/clothes">Clothes page</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="http://localhost:4000/tracker">Live clothes tracker</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/SleepyLili/pokemon-couture">Source</a>
|
<a href="https://github.com/SleepyLili/pokemon-couture">Source</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue