Fix minor bugs in forms not showing errors and whatnot
This commit is contained in:
parent
893af13e3c
commit
1c8ce46697
@ -27,10 +27,9 @@
|
|||||||
.alert:empty {
|
.alert:empty {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.invalid-feedback {
|
.error-feedback {
|
||||||
color: #a94442;
|
color: #a94442;
|
||||||
display: block;
|
display: block;
|
||||||
margin: -1rem 0 2rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LiveView specific classes for your customization */
|
/* LiveView specific classes for your customization */
|
||||||
|
@ -21,7 +21,7 @@ defmodule Aggiedit.Rooms.Post do
|
|||||||
def changeset(post, attrs) do
|
def changeset(post, attrs) do
|
||||||
post
|
post
|
||||||
|> cast(attrs, [:title, :body, :score])
|
|> cast(attrs, [:title, :body, :score])
|
||||||
|> validate_required([:title, :body])
|
|> validate_required([:title])
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_user(post, user) do
|
def change_user(post, user) do
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<%= csrf_meta_tag() %>
|
<%= csrf_meta_tag() %>
|
||||||
<%= live_title_tag assigns[:page_title] || "Aggiedit" %>
|
<%= live_title_tag assigns[:page_title] || "Aggiedit" %>
|
||||||
<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/assets/app.css")}/>
|
|
||||||
<script phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/assets/app.js")}></script>
|
|
||||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.0/font/bootstrap-icons.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.0/font/bootstrap-icons.css">
|
||||||
|
|
||||||
|
<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/assets/app.css")}/>
|
||||||
|
<script phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/assets/app.js")}></script>
|
||||||
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-secondary min-vh-100">
|
<body class="bg-secondary min-vh-100">
|
||||||
<header>
|
<header>
|
||||||
|
@ -11,7 +11,7 @@ defmodule AggieditWeb.ErrorHelpers do
|
|||||||
def error_tag(form, field) do
|
def error_tag(form, field) do
|
||||||
Enum.map(Keyword.get_values(form.errors, field), fn error ->
|
Enum.map(Keyword.get_values(form.errors, field), fn error ->
|
||||||
content_tag(:span, translate_error(error),
|
content_tag(:span, translate_error(error),
|
||||||
class: "invalid-feedback",
|
class: "error-feedback", # changed from invalid-feedback because bootstrap 5 has invalid-feedback already defined
|
||||||
phx_feedback_for: input_name(form, field)
|
phx_feedback_for: input_name(form, field)
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user