mix format

This commit is contained in:
2022-01-22 17:21:10 -05:00
parent 421badbb90
commit 16018ae111
15 changed files with 122 additions and 127 deletions

View File

@ -31,9 +31,13 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do
def render(assigns) do
~H"""
<div>
<h2><%= @title %></h2>
<.form let={f} for={@changeset},
<h2>
<%= @title %>
</h2>
<.form
let={f}
for={@changeset}
,
id="ammo_group-form"
phx-target={@myself}
phx-change="validate"

View File

@ -31,9 +31,12 @@ defmodule CanneryWeb.AmmoTypeLive.FormComponent do
def render(assigns) do
~H"""
<div>
<h2><%= @title %></h2>
<.form let={f} for={@changeset}
<h2>
<%= @title %>
</h2>
<.form
let={f}
for={@changeset}
id="ammo_type-form"
phx-target={@myself}
phx-change="validate"

View File

@ -31,9 +31,12 @@ defmodule CanneryWeb.ContainerLive.FormComponent do
def render(assigns) do
~H"""
<div>
<h2><%= @title %></h2>
<.form let={f} for={@changeset}
<h2>
<%= @title %>
</h2>
<.form
let={f}
for={@changeset}
id="container-form"
phx-target={@myself}
phx-change="validate"

View File

@ -34,8 +34,9 @@ defmodule CanneryWeb.InviteLive.FormComponent do
<h2 class="title text-xl text-primary-500">
<%= @title %>
</h2>
<.form let={f} for={@changeset}
<.form
let={f}
for={@changeset}
id="invite-form"
class="grid grid-cols-3 justify-center items-center space-y-4"
phx-target={@myself}
@ -45,17 +46,17 @@ defmodule CanneryWeb.InviteLive.FormComponent do
<%= label f, :name, class: "title text-lg text-primary-500" %>
<%= text_input f, :name, class: "input input-primary col-span-2" %>
<span class="col-span-3">
<%= error_tag f, :name %>
<%= error_tag(f, :name) %>
</span>
<%= label f, :uses_left, class: "title text-lg text-primary-500" %>
<%= number_input f, :uses_left, min: 0, class: "input input-primary col-span-2" %>
<%= label(f, :uses_left, class: "title text-lg text-primary-500") %>
<%= number_input(f, :uses_left, min: 0, class: "input input-primary col-span-2") %>
<span class="col-span-3">
<%= error_tag f, :uses_left %>
<%= error_tag(f, :uses_left) %>
</span>
<%= submit "Save", class: "mx-auto btn btn-primary col-span-3",
phx_disable_with: "Saving..." %>
<%= submit("Save",
class: "mx-auto btn btn-primary col-span-3",
phx_disable_with: "Saving..."
) %>
</.form>
</div>
"""
@ -71,7 +72,7 @@ defmodule CanneryWeb.InviteLive.FormComponent do
{:error, %Ecto.Changeset{} = changeset} ->
{:noreply, assign(socket, :changeset, changeset)}
end
end
end
defp save_invite(socket, :new, invite_params) do

View File

@ -29,7 +29,7 @@ defmodule CanneryWeb.LiveHelpers do
Accounts.get_user_by_session_token(user_token)
end)
end
def assign_defaults(socket, _session) do
socket
end

View File

@ -4,7 +4,9 @@ defmodule CanneryWeb.ModalComponent do
@impl true
def render(assigns) do
~H"""
<div id={@id} class="fixed z-10 left-0 top-0
<div
id={@id}
class="fixed z-10 left-0 top-0
w-full h-full overflow-hidden
p-8 flex flex-col justify-center items-center"
style="opacity: 1 !important; background-color: rgba(0,0,0,0.4);"
@ -12,21 +14,19 @@ defmodule CanneryWeb.ModalComponent do
phx-window-keydown="close"
phx-key="escape"
phx-target={"#{@id}"}
phx-page-loading>
phx-page-loading
>
<div class="w-full max-w-4xl relative
p-8 flex flex-col justify-start items-center
bg-white border-2 rounded-lg">
<%# close button %>
<%= live_patch to: @return_to,
class: "absolute top-8 right-10 text-gray-500 hover:text-gray-800
transition-all duration-500 ease-in-out" do %>
<i class="fa-fw fa-lg fas fa-times"></i>
class:
"absolute top-8 right-10 text-gray-500 hover:text-gray-800 transition-all duration-500 ease-in-out" do %>
<i class="fa-fw fa-lg fas fa-times">
</i>
<% end %>
<%# modal content %>
<div class="w-full flex flex-col space-y-4 justify-center items-center">
<%= live_component @component, @opts %>
<%= live_component(@component, @opts) %>
</div>
</div>
</div>

View File

@ -37,8 +37,9 @@ defmodule CanneryWeb.TagLive.FormComponent do
<h2 class="title text-xl text-primary-500">
<%= @title %>
</h2>
<.form let={f} for={@changeset}
<.form
let={f}
for={@changeset}
id="tag-form"
class="grid grid-cols-3 justify-center items-center space-y-4"
phx-target={@myself}
@ -48,27 +49,26 @@ defmodule CanneryWeb.TagLive.FormComponent do
<%= label f, :name, class: "title text-lg text-primary-500" %>
<%= text_input f, :name, class: "input input-primary col-span-2" %>
<span class="col-span-3">
<%= error_tag f, :name %>
<%= error_tag(f, :name) %>
</span>
<%= label f, :bg_color, class: "title text-lg text-primary-500" %>
<%= label(f, :bg_color, class: "title text-lg text-primary-500") %>
<span class="mx-auto col-span-2" phx-update="ignore">
<%= color_input f, :bg_color, value: random_color() %>
<%= color_input(f, :bg_color, value: random_color()) %>
</span>
<span class="col-span-3">
<%= error_tag f, :bg_color %>
<%= error_tag(f, :bg_color) %>
</span>
<%= label f, :text_color, class: "title text-lg text-primary-500" %>
<%= label(f, :text_color, class: "title text-lg text-primary-500") %>
<span class="mx-auto col-span-2" phx-update="ignore">
<%= color_input f, :text_color, value: "#ffffff" %>
<%= color_input(f, :text_color, value: "#ffffff") %>
</span>
<span class="col-span-3">
<%= error_tag f, :text_color %>
<%= error_tag(f, :text_color) %>
</span>
<%= submit "Save", class: "mx-auto btn btn-primary col-span-3",
phx_disable_with: "Saving..." %>
<%= submit("Save",
class: "mx-auto btn btn-primary col-span-3",
phx_disable_with: "Saving..."
) %>
</.form>
</div>
"""