Skip to content

Commit

Permalink
Fix a bug with toast stacking on top - no hide
Browse files Browse the repository at this point in the history
  • Loading branch information
tomik-z-cech committed Mar 2, 2024
1 parent 437ab4f commit 6db5a0a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
44 changes: 22 additions & 22 deletions items/templates/items/item_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% block nav_name %}Shop{% endblock %}

{% block extra_css %}
<link rel="stylesheet" href="{% static 'css/items.css' %}">
<link rel="stylesheet" href="{% static 'css/items.css' %}">
{% endblock %}

{% block content %}
Expand Down Expand Up @@ -168,30 +168,30 @@ <h3>
</div>
</div>
<!-- Only for logged in users -->
<div class="w-100 p-3 comments-background add-shadow mt-3">
<!-- If no comment submitted yet, display form -->
{% if user.is_authenticated %}
{% if can_comment %}
<div class="col-12 d-flex justify-content-start mb-3">
<strong>Commenting as {{ user.username }} :</strong>
<div class="w-100 p-3 comments-background add-shadow mt-3">
<!-- If no comment submitted yet, display form -->
{% if user.is_authenticated %}
{% if can_comment %}
<div class="col-12 d-flex justify-content-start mb-3">
<strong>Commenting as {{ user.username }} :</strong>
</div>
<form method="POST" id="commentForm" action="{% url 'submit-comment' item_pk=item.pk %}">
{{ item_comment_form | crispy }}
{% csrf_token %}
<div class="col-12 d-flex justify-content-end mt-3">
<button type="Submit" class="custom-button button-shadow mt-2 short-button" name="comment">Comment</button>
</div>
<form method="POST" id="commentForm" action="{% url 'submit-comment' item_pk=item.pk %}">
{{ item_comment_form | crispy }}
{% csrf_token %}
<div class="col-12 d-flex justify-content-end mt-3">
<button type="Submit" class="custom-button button-shadow mt-2 short-button" name="comment">Comment</button>
</div>
</form>
<!-- If form submitted, display message -->
{% else %}
Hold on tight, your comment is being approved !
{% endif %}
</form>
<!-- If form submitted, display message -->
{% else %}
<div class="col-12 d-flex justify-content-center align-items-center">
<strong>Please Log In to comment ;)</strong>
</div>
Hold on tight, your comment is being approved !
{% endif %}
</div>
{% else %}
<div class="col-12 d-flex justify-content-center align-items-center">
<strong>Please Log In to comment ;)</strong>
</div>
{% endif %}
</div>
<div class="w-100 p-3 add-shadow mt-3 comments-background">
{% if comments|length == 0%}
Be first to comment ;)
Expand Down
3 changes: 2 additions & 1 deletion static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ input[type="radio"] {
border: 1px solid var(--dark-background)!important;
font-family: var(--main-font);
max-height: 40vh;
overflow: scroll;
overflow-x: hidden;
overflow-y: auto;
}

.toast-header {
Expand Down
4 changes: 2 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{% include 'footer.html' %}
<!-- Toasts -->
{% if messages %}
<div class="message-container">
<div class="message-container" aria-live="polite" aria-atomic="true" >
{% for message in messages %}
{% with message.level as level %}
{% if level == 40 %}
Expand All @@ -73,7 +73,7 @@
</div>
<!-- Block for extra JS scripts -->
{% block extra_js %}
<!-- Toasts -->
<!-- Toasts JS logic -->
<script type="text/javascript">
$(document).ready(function() {
if ($('.toast').length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion templates/toasts/toast_vault.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load static %}

<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="true">
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="true" data-bs-delay="3000">
<div class="toast-header">
<strong class="me-auto">
<i class="bi bi-safe"></i>
Expand Down

0 comments on commit 6db5a0a

Please sign in to comment.