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

@@ -1,35 +1,35 @@
{% extends 'layouts/index.html' %}
{% block content %}
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="notification is-danger">
{% with messages = get_flashed_messages() %}
{% if messages %}
<span class="error-message">
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('auth.login_post') }}" class="login-form">
<div class="field">
<div class="control">
Username
<input class="input is-large" type="text" name="username" placeholder="Username" autofocus="true">
</div>
</span>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('auth.login_post') }}" class="login-form">
<div class="field">
<div class="control">
Username
<input class="input is-large" type="text" name="username" placeholder="Username" autofocus="true">
</div>
</div>
<div class="field">
<div class="control">
Password
<input class="input is-large" type="password" name="password" placeholder="Password">
</div>
<div class="field">
<div class="control">
Password
<input class="input is-large" type="password" name="password" placeholder="Password">
</div>
<div class="field">
<label class="checkbox">
<input type="checkbox">
Remember me
</label>
</div>
<button class="button">Login</button>
</form>
<p class="form-subtext">
Don't have a login? <a href="{{ url_for('main.signup') }}">Sign-up</a> instead!
</p>
</div>
<div class="field">
<label class="checkbox">
<input type="checkbox">
Remember me
</label>
</div>
<button class="button">Login</button>
</form>
<p class="form-subtext">
Don't have a login? <a href="{{ url_for('main.signup') }}">Sign-up</a> instead!
</p>
{% endblock content %}

View File

@@ -1,38 +1,39 @@
{% extends 'layouts/index.html' %}
{% block content %}
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="notification is-danger">
{% with messages = get_flashed_messages() %}
{% if messages %}
<span class="error-message">
{{ messages[0] }}. Go to <a href="{{ url_for('main.login') }}">login page</a>.
</div>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('auth.signup_post') }}" class="login-form">
<div class="field">
<div class="control">
Username
<input class="input is-large" type="text" name="username" placeholder="Username" autofocus>
</div>
</div>
</span>
{% endif %}
{% endwith %}
<div class="field">
<div class="control">
Name
<input class="input is-large" type="text" name="name" placeholder="Name" autofocus>
</div>
<form method="POST" action="{{ url_for('auth.signup_post') }}" class="login-form">
<div class="field">
<div class="control">
Username
<input class="input is-large" type="text" name="username" placeholder="Username" autofocus>
</div>
</div>
<div class="field">
<div class="control">
Password
<input class="input is-large" type="password" name="password" placeholder="Password">
</div>
<div class="field">
<div class="control">
Name
<input class="input is-large" type="text" name="name" placeholder="Name" autofocus>
</div>
<button>Sign Up</button>
</form>
</div>
<p class="form-subtext">
Already have a login? <a href="{{ url_for('main.login') }}">Login</a> instead!
</p>
<div class="field">
<div class="control">
Password
<input class="input is-large" type="password" name="password" placeholder="Password">
</div>
</div>
<button>Sign Up</button>
</form>
<p class="form-subtext">
Already have a login? <a href="{{ url_for('main.login') }}">Login</a> instead!
</p>
{% endblock content %}

View File

@@ -2,20 +2,20 @@
{% block content %}
{% 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">
<label>
<textarea type="text" name="text" placeholder="Write a post between 15 and 1000 characters. Express yourself."></textarea>
</label>
<button class="button">Create Post</button>
</form>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="notification is-danger">
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
{% endif %}
{% for post, author in posts_and_authors %}

View File

@@ -9,6 +9,14 @@
</div>
<div class="post-comments">
{% 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">
<form method="POST" action="{{ url_for('forms.add_comment', post_id=post.id) }}">
<label>

View File

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