improve changeset errors

This commit is contained in:
shibao 2022-02-15 18:22:58 -05:00 committed by oliviasculley
parent 23b60e032d
commit c918dbe4bf
2 changed files with 7 additions and 7 deletions

View File

@ -5,7 +5,7 @@
<%= form_for @changeset, Routes.user_registration_path(@conn, :create), <%= form_for @changeset, Routes.user_registration_path(@conn, :create),
[class: "flex flex-col justify-center items-center space-y-4"], fn f -> %> [class: "flex flex-col justify-center items-center space-y-4"], fn f -> %>
<%= if @changeset.action do %> <%= if @changeset.action && not(@changeset.valid?) do %>
<div class="alert alert-danger"> <div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p> <p>Oops, something went wrong! Please check the errors below.</p>
</div> </div>
@ -24,7 +24,7 @@
<%= error_tag f, :password %> <%= error_tag f, :password %>
<%= submit "Register", class: "btn btn-primary" %> <%= submit "Register", class: "btn btn-primary" %>
<hr class="hr"> <hr class="hr">
<div class="flex flex-row justify-center items-center space-x-4"> <div class="flex flex-row justify-center items-center space-x-4">
@ -34,4 +34,4 @@
class: "btn btn-primary" %> class: "btn btn-primary" %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@ -5,7 +5,7 @@
<%= form_for @changeset, Routes.user_reset_password_path(@conn, :update, @token), <%= form_for @changeset, Routes.user_reset_password_path(@conn, :update, @token),
[class: "flex flex-col justify-center items-center space-y-4"], fn f -> %> [class: "flex flex-col justify-center items-center space-y-4"], fn f -> %>
<%= if @changeset.action do %> <%= if @changeset.action && not(@changeset.valid?) do %>
<div class="alert alert-danger"> <div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p> <p>Oops, something went wrong! Please check the errors below.</p>
</div> </div>
@ -24,9 +24,9 @@
<%= error_tag f, :password_confirmation %> <%= error_tag f, :password_confirmation %>
<%= submit "Reset password", class: "btn btn-primary" %> <%= submit "Reset password", class: "btn btn-primary" %>
<hr class="hr"> <hr class="hr">
<div class="flex flex-row justify-center items-center space-x-4"> <div class="flex flex-row justify-center items-center space-x-4">
<%= link "Register", to: Routes.user_registration_path(@conn, :new), <%= link "Register", to: Routes.user_registration_path(@conn, :new),
class: "btn btn-primary" %> class: "btn btn-primary" %>
@ -34,4 +34,4 @@
class: "btn btn-primary" %> class: "btn btn-primary" %>
</div> </div>
<% end %> <% end %>
</div> </div>