Improve/add error messages to look better visually

- Have not tested everywhere, but should work okayish
This commit is contained in:
Xevion
2022-03-28 18:54:17 -05:00
parent 2973f3ca81
commit 040e505561
8 changed files with 105 additions and 71 deletions

View File

@@ -124,12 +124,12 @@ nav .links li:not(:last-child)::after, footer .links li:not(:last-child)::after
} }
form { form {
margin: 0 auto; margin: 1em auto;
width: fit-content; width: fit-content;
} }
form.login-form { form.login-form {
border: 1px solid darkblue; border: 1px solid darkblue;
padding: 10px; padding: 0.7em;
} }
form .field { form .field {
padding: 4px; padding: 4px;
@@ -262,6 +262,7 @@ form button {
} }
.post-box .post-author { .post-box .post-author {
margin-top: 1em; margin-top: 1em;
margin-bottom: 0.5em;
font-size: 0.8em; font-size: 0.8em;
border-bottom: 1px solid grey; border-bottom: 1px solid grey;
padding-bottom: 0.8em; padding-bottom: 0.8em;
@@ -312,4 +313,14 @@ form button {
margin: 1em; margin: 1em;
} }
span.error-message {
margin: 0.5em;
border: 1px solid red;
padding: 0.3em;
}
span.error-message.center-message {
margin: 0 auto;
display: table;
}
/*# sourceMappingURL=styles.css.map */ /*# sourceMappingURL=styles.css.map */

View File

@@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["styles.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;AAEA;EAOE;;AALA;EAEE;;;AASJ;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;;;AAKJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;AACA;EACE;EACA;;AAIJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAKN;EACE;EACA;EACA;EACA;;AAEA;EACE;;;AAIJ;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAIA;EACE;EACA;;AAEA;EACE;;AAEA;EACE;;;AAMR;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAIA;EACE;EACA;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;AAGF;EACE;;AAEA;EACE;;AAIJ;EACE;EACA;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;;;AAIJ;EACE;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;EACA;;;AAMF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;;AAKF;EACE;EACA;EACA;EACA;;;AAMR;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EACE;EACA;;AAIJ;EAEE;EACA;EACA;;;AAMR;EACE;;AACA;EACE;EACA;EACA;EACA;;AAEA;EACE;;;AAKN;EACE;EACA","file":"styles.css"} {"version":3,"sourceRoot":"","sources":["styles.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;AAEA;EAOE;;AALA;EAEE;;;AASJ;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;;;AAKJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAKN;EACE;EACA;EACA;EACA;;AAEA;EACE;;;AAIJ;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAIA;EACE;EACA;;AAEA;EACE;;AAEA;EACE;;;AAMR;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAIA;EACE;EACA;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;AAGF;EACE;;AAEA;EACE;;AAIJ;EACE;EACA;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;;;AAIJ;EACE;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;EACA;;;AAMF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;;AAKF;EACE;EACA;EACA;EACA;;;AAMR;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EACE;EACA;;AAIJ;EAEE;EACA;EACA;;;AAMR;EACE;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;;;AAKN;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA","file":"styles.css"}

View File

@@ -59,6 +59,7 @@ body, html {
#img-logo { #img-logo {
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
img { img {
max-width: 100%; max-width: 100%;
max-height: 80px; max-height: 80px;
@@ -145,12 +146,12 @@ nav, footer {
} }
form { form {
margin: 0 auto; margin: 1em auto;
width: fit-content; width: fit-content;
&.login-form { &.login-form {
border: 1px solid darkblue; border: 1px solid darkblue;
padding: 10px padding: 0.7em;
} }
.field { .field {
@@ -308,6 +309,7 @@ form {
.post-author { .post-author {
margin-top: 1em; margin-top: 1em;
margin-bottom: 0.5em;
font-size: 0.8em; font-size: 0.8em;
border-bottom: 1px solid grey; border-bottom: 1px solid grey;
padding-bottom: 0.8em; padding-bottom: 0.8em;
@@ -350,6 +352,7 @@ form {
.new-users, .statistics { .new-users, .statistics {
margin-top: 0 !important; margin-top: 0 !important;
> div { > div {
border: 1px solid grey; border: 1px solid grey;
padding: 0.2em; padding: 0.2em;
@@ -366,3 +369,14 @@ form {
min-height: 235px; min-height: 235px;
margin: 1em; margin: 1em;
} }
span.error-message {
margin: 0.5em;
border: 1px solid red;
padding: 0.3em;
&.center-message {
margin: 0 auto;
display: table;
}
}

View File

@@ -2,9 +2,9 @@
{% block content %} {% block content %}
{% with messages = get_flashed_messages() %} {% with messages = get_flashed_messages() %}
{% if messages %} {% if messages %}
<div class="notification is-danger"> <span class="error-message">
{{ messages[0] }} {{ messages[0] }}
</div> </span>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<form method="POST" action="{{ url_for('auth.login_post') }}" class="login-form"> <form method="POST" action="{{ url_for('auth.login_post') }}" class="login-form">

View File

@@ -3,11 +3,12 @@
{% block content %} {% block content %}
{% with messages = get_flashed_messages() %} {% with messages = get_flashed_messages() %}
{% if messages %} {% if messages %}
<div class="notification is-danger"> <span class="error-message">
{{ messages[0] }}. Go to <a href="{{ url_for('main.login') }}">login page</a>. {{ messages[0] }}. Go to <a href="{{ url_for('main.login') }}">login page</a>.
</div> </span>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<form method="POST" action="{{ url_for('auth.signup_post') }}" class="login-form"> <form method="POST" action="{{ url_for('auth.signup_post') }}" class="login-form">
<div class="field"> <div class="field">
<div class="control"> <div class="control">

View File

@@ -2,20 +2,20 @@
{% block content %} {% block content %}
{% if current_user.is_authenticated %} {% if current_user.is_authenticated %}
{% with messages = get_flashed_messages() %}
{% if messages or true %}
<span class="error-message center-message">
{{ messages[0] }}
</span>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('forms.new_post') }}" class="profile-form"> <form method="POST" action="{{ url_for('forms.new_post') }}" class="profile-form">
<label> <label>
<textarea type="text" name="text" placeholder="Write a post between 15 and 1000 characters. Express yourself."></textarea> <textarea type="text" name="text" placeholder="Write a post between 15 and 1000 characters. Express yourself."></textarea>
</label> </label>
<button class="button">Create Post</button> <button class="button">Create Post</button>
</form> </form>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="notification is-danger">
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
{% endif %} {% endif %}
{% for post, author in posts_and_authors %} {% for post, author in posts_and_authors %}

View File

@@ -9,6 +9,14 @@
</div> </div>
<div class="post-comments"> <div class="post-comments">
{% if current_user.is_authenticated %} {% if current_user.is_authenticated %}
{% with messages = get_flashed_messages() %}
{% if messages %}
<span class="error-message">
{{ messages[0] }}
</span>
{% endif %}
{% endwith %}
<div class="post-comment add-comment"> <div class="post-comment add-comment">
<form method="POST" action="{{ url_for('forms.add_comment', post_id=post.id) }}"> <form method="POST" action="{{ url_for('forms.add_comment', post_id=post.id) }}">
<label> <label>

View File

@@ -15,9 +15,9 @@
</form> </form>
{% with messages = get_flashed_messages() %} {% with messages = get_flashed_messages() %}
{% if messages %} {% if messages %}
<div class="notification is-danger"> <span class="error-message">
{{ messages[0] }} {{ messages[0] }}
</div> </span>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% endblock %} {% endblock %}