update to liveview 0.18 and use elixir 1.14
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -5,24 +5,25 @@
|
||||
|
||||
<div class="flex flex-wrap justify-center items-center">
|
||||
<%= for tag <- @container.tags do %>
|
||||
<%= link to: "#",
|
||||
class: "mx-2 my-1 px-4 py-2 rounded-lg title text-xl",
|
||||
style: "color: #{tag.text_color}; background-color: #{tag.bg_color}",
|
||||
phx_click: "delete",
|
||||
phx_value_tag_id: tag.id,
|
||||
phx_target: @myself,
|
||||
data: [
|
||||
confirm:
|
||||
dgettext(
|
||||
"prompts",
|
||||
"Are you sure you want to remove the %{tag_name} tag from %{container_name}?",
|
||||
tag_name: tag.name,
|
||||
container_name: @container.name
|
||||
)
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="mx-2 my-1 px-4 py-2 rounded-lg title text-xl"
|
||||
style={"color: #{tag.text_color}; background-color: #{tag.bg_color}"}
|
||||
phx-click="delete"
|
||||
phx-value-tag-id={tag.id}
|
||||
phx-target={@myself}
|
||||
data-confirm={
|
||||
dgettext(
|
||||
"prompts",
|
||||
"Are you sure you want to remove the %{tag_name} tag from %{container_name}?",
|
||||
tag_name: tag.name,
|
||||
container_name: @container.name
|
||||
)
|
||||
}
|
||||
>
|
||||
<%= tag.name %>
|
||||
<i class="fa-fw fa-sm fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
<% end %>
|
||||
|
||||
<%= if @container.tags |> Enum.empty?() do %>
|
||||
@ -37,7 +38,7 @@
|
||||
<hr class="hr" />
|
||||
|
||||
<.form
|
||||
let={f}
|
||||
:let={f}
|
||||
for={:tag}
|
||||
id="add-tag-to-container-form"
|
||||
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
||||
|
@ -65,7 +65,7 @@ defmodule CanneryWeb.ContainerLive.FormComponent do
|
||||
case Containers.update_container(container, current_user, container_params) do
|
||||
{:ok, %{name: container_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} updated successfully", name: container_name)
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(:changeset, changeset)
|
||||
@ -83,7 +83,7 @@ defmodule CanneryWeb.ContainerLive.FormComponent do
|
||||
case Containers.create_container(container_params, current_user) do
|
||||
{:ok, %{name: container_name}} ->
|
||||
prompt = dgettext("prompts", "%{name} created successfully", name: container_name)
|
||||
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
|
||||
socket |> put_flash(:info, prompt) |> push_navigate(to: return_to)
|
||||
|
||||
{:error, %Changeset{} = changeset} ->
|
||||
socket |> assign(changeset: changeset)
|
||||
|
@ -3,7 +3,7 @@
|
||||
<%= @title %>
|
||||
</h2>
|
||||
<.form
|
||||
let={f}
|
||||
:let={f}
|
||||
for={@changeset}
|
||||
id="container-form"
|
||||
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
|
||||
|
@ -9,15 +9,13 @@
|
||||
<%= display_emoji("😔") %>
|
||||
</h2>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Add your first container!"),
|
||||
to: Routes.container_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "Add your first container!") %>
|
||||
</.link>
|
||||
<% else %>
|
||||
<%= live_patch(dgettext("actions", "New Container"),
|
||||
to: Routes.container_index_path(Endpoint, :new),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary">
|
||||
<%= dgettext("actions", "New Container") %>
|
||||
</.link>
|
||||
<% end %>
|
||||
|
||||
<div class="max-w-full flex flex-row flex-wrap justify-center items-center">
|
||||
@ -25,29 +23,34 @@
|
||||
<.container_card container={container}>
|
||||
<:tag_actions>
|
||||
<div class="mx-4 my-2">
|
||||
<%= live_patch to: Routes.container_index_path(Endpoint, :edit_tags, container),
|
||||
class: "text-primary-600 link" do %>
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
|
||||
class="text-primary-600 link"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-tags"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
</:tag_actions>
|
||||
<%= live_patch to: Routes.container_index_path(Endpoint, :edit, container),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "edit-#{container.id}"] do %>
|
||||
<.link
|
||||
patch={Routes.container_index_path(Endpoint, :edit, container)}
|
||||
class="text-primary-600 link"
|
||||
data-qa={"edit-#{container.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-edit"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= link to: "#",
|
||||
class: "text-primary-600 link",
|
||||
phx_click: "delete",
|
||||
phx_value_id: container.id,
|
||||
data: [
|
||||
confirm:
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name),
|
||||
qa: "delete-#{container.id}"
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-600 link"
|
||||
phx-click="delete"
|
||||
phx-value-id={container.id}
|
||||
data-confirm={
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name)
|
||||
}
|
||||
data-qa={"delete-#{container.id}"}
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</.container_card>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -62,7 +62,7 @@ defmodule CanneryWeb.ContainerLive.Show do
|
||||
|
||||
socket
|
||||
|> put_flash(:info, prompt)
|
||||
|> push_redirect(to: Routes.container_index_path(socket, :index))
|
||||
|> push_navigate(to: Routes.container_index_path(socket, :index))
|
||||
|
||||
{:error, %{action: :delete, errors: [ammo_groups: _error], valid?: false} = changeset} ->
|
||||
ammo_groups_error = changeset |> changeset_errors(:ammo_groups) |> Enum.join(", ")
|
||||
|
@ -35,22 +35,25 @@
|
||||
<% end %>
|
||||
|
||||
<div class="flex space-x-4 justify-center items-center text-primary-600">
|
||||
<%= live_patch to: Routes.container_show_path(Endpoint, :edit, @container),
|
||||
class: "text-primary-600 link",
|
||||
data: [qa: "edit"] do %>
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit, @container)}
|
||||
class="text-primary-600 link"
|
||||
data-qa="edit"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-edit"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
|
||||
<%= link to: "#",
|
||||
class: "text-primary-600 link",
|
||||
phx_click: "delete_container",
|
||||
data: [
|
||||
confirm:
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name),
|
||||
qa: "delete"
|
||||
] do %>
|
||||
<.link
|
||||
href="#"
|
||||
class="text-primary-600 link"
|
||||
phx-click="delete_container"
|
||||
data-confirm={
|
||||
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name)
|
||||
}
|
||||
data-qa="delete"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-trash"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<hr class="mb-4 hr" />
|
||||
@ -62,10 +65,12 @@
|
||||
<%= display_emoji("😔") %>
|
||||
</h2>
|
||||
|
||||
<%= live_patch(dgettext("actions", "Why not add one?"),
|
||||
to: Routes.container_show_path(Endpoint, :edit_tags, @container),
|
||||
class: "btn btn-primary"
|
||||
) %>
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<%= dgettext("actions", "Why not add one?") %>
|
||||
</.link>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="flex flex-wrap justify-center items-center">
|
||||
@ -74,10 +79,12 @@
|
||||
<% end %>
|
||||
|
||||
<div class="mx-4 my-2">
|
||||
<%= live_patch to: Routes.container_show_path(Endpoint, :edit_tags, @container),
|
||||
class: "text-primary-600 link" do %>
|
||||
<.link
|
||||
patch={Routes.container_show_path(Endpoint, :edit_tags, @container)}
|
||||
class="text-primary-600 link"
|
||||
>
|
||||
<i class="fa-fw fa-lg fas fa-tags"></i>
|
||||
<% end %>
|
||||
</.link>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
Reference in New Issue
Block a user