forked from shibao/cannery
use changeset.valid? for errors
This commit is contained in:
parent
e882330c14
commit
1eda51f1dd
@ -12,7 +12,7 @@
|
||||
phx-submit="save"
|
||||
class="grid grid-cols-3 justify-center items-center space-y-4"
|
||||
>
|
||||
<%= if @changeset.action do %>
|
||||
<%= unless @changeset.valid? do %>
|
||||
<div class="invalid-feedback col-span-3 text-center">
|
||||
<%= changeset_errors(@changeset) %>
|
||||
</div>
|
||||
|
@ -11,7 +11,7 @@
|
||||
phx-submit="save"
|
||||
class="grid grid-cols-3 justify-center items-center space-y-4"
|
||||
>
|
||||
<%= if @changeset.action do %>
|
||||
<%= unless @changeset.valid? do %>
|
||||
<div class="invalid-feedback col-span-3 text-center">
|
||||
<%= changeset_errors(@changeset) %>
|
||||
</div>
|
||||
|
@ -11,7 +11,7 @@
|
||||
phx-change="validate"
|
||||
phx-submit="save"
|
||||
>
|
||||
<%= if @changeset.action do %>
|
||||
<%= unless @changeset.valid? do %>
|
||||
<div class="invalid-feedback col-span-3 text-center">
|
||||
<%= changeset_errors(@changeset) %>
|
||||
</div>
|
||||
|
@ -11,7 +11,7 @@
|
||||
phx-change="validate"
|
||||
phx-submit="save"
|
||||
>
|
||||
<%= if @changeset.action do %>
|
||||
<%= unless @changeset.valid? do %>
|
||||
<div class="invalid-feedback col-span-3 text-center">
|
||||
<%= changeset_errors(@changeset) %>
|
||||
</div>
|
||||
|
@ -41,7 +41,7 @@ defmodule CanneryWeb.TagLive.FormComponent do
|
||||
phx-change="validate"
|
||||
phx-submit="save"
|
||||
>
|
||||
<%= if @changeset.action do %>
|
||||
<%= unless @changeset.valid? do %>
|
||||
<div class="invalid-feedback col-span-3 text-center">
|
||||
<%= changeset_errors(@changeset) %>
|
||||
</div>
|
||||
|
@ -37,9 +37,7 @@ defmodule CanneryWeb.TagLive.Index do
|
||||
@impl true
|
||||
def handle_event("delete", %{"id" => id}, %{assigns: %{current_user: current_user}} = socket) do
|
||||
%{name: tag_name} = Tags.get_tag!(id, current_user) |> Tags.delete_tag!(current_user)
|
||||
|
||||
prompt = dgettext("prompts", "%{name} deleted succesfully", name: tag_name)
|
||||
|
||||
{:noreply, socket |> put_flash(:info, prompt) |> display_tags()}
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
Routes.user_registration_path(@conn, :create),
|
||||
[class: "flex flex-col justify-center items-center space-y-4"],
|
||||
fn f -> %>
|
||||
<%= if @changeset.action do %>
|
||||
<%= unless @changeset.valid? do %>
|
||||
<div class="alert alert-danger">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
|
@ -7,7 +7,7 @@
|
||||
Routes.user_reset_password_path(@conn, :update, @token),
|
||||
[class: "flex flex-col justify-center items-center space-y-4"],
|
||||
fn f -> %>
|
||||
<%= if @changeset.action do %>
|
||||
<%= unless @changeset.valid? do %>
|
||||
<div class="alert alert-danger">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
|
Loading…
Reference in New Issue
Block a user