Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gateway/sds_gateway/templates/allauth/elements/alert.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n %}
{% load allauth %}

<div class="alert alert-error">{% slot message %} {% endslot %}</div>
<div class="alert alert-danger">{% slot message %} {% endslot %}</div>
34 changes: 14 additions & 20 deletions gateway/sds_gateway/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
rel="stylesheet" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" />
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
{% block css %}
<!-- Your stuff: Third-party CSS libraries go here -->
<!-- This file stores project-specific CSS -->
Expand Down Expand Up @@ -141,27 +143,19 @@
</nav>
</header>
<main class="container-fluid" id="main-content" role="main">
{% comment %} system-wide notifications {% endcomment %}
{% if system_notifications %}
{% for notification in system_notifications %}
<div class="alert alert-dismissible alert-{{ notification.level }}">{{ notification.user_message }}</div>
{% endfor %}
{% endif %}
{% comment %} Django messages rendered as toasts {% endcomment %}
{% if messages %}
{% for message in messages %}
{% include "users/components/toast.html" with message=message type=message.level_tag|default:"info" %}
{% endfor %}
{% endif %}
{% block body %}
{% comment %} system-wide notifications {% endcomment %}
{% if system_notifications %}
{% for notification in system_notifications %}
<div class="alert alert-dismissible alert-{{ notification.level }}">{{ notification.user_message }}</div>
{% endfor %}
{% endif %}
{% comment %} Django messages rendered as toasts {% endcomment %}
{% if messages %}
{% for message in messages %}
{% if message.tags == "error" %}
{% include "users/components/toast.html" with message=message type="error" %}
{% elif message.tags == "success" %}
{% include "users/components/toast.html" with message=message type="success" %}
{% elif message.tags == "warning" %}
{% include "users/components/toast.html" with message=message type="warning" %}
{% else %}
{% include "users/components/toast.html" with message=message type="info" %}
{% endif %}
{% endfor %}
{% endif %}
{% block main %}
{% block content %}
<p>
Expand Down
68 changes: 6 additions & 62 deletions gateway/sds_gateway/templates/users/components/toast.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,77 +4,21 @@

Context:
- message: Toast message text
- type: Toast type (success, error, warning, info) - maps to Bootstrap classes
- type: Toast type (success, error/danger, warning, info) - maps to Bootstrap classes
{% endcomment %}
{% comment %} Map type to Bootstrap classes matching showAlert logic {% endcomment %}
{% if type == "success" %}
<div class="toast align-items-center bg-success text-white"
{% with toast_type=type|default:""|lower %}
<div class=" toast align-items-center {% if 'success' in toast_type %} bg-success text-white {% elif 'error' in toast_type or 'danger' in toast_type %} bg-danger text-white {% elif 'warning' in toast_type %} bg-warning text-dark {% else %} bg-info text-white {% endif %} "
role="alert"
aria-live="assertive"
aria-atomic="true"
data-bs-delay="3500">
data-bs-delay="10000">
<div class="d-flex">
<div class="toast-body">{{ message }}</div>
<button type="button"
class="btn-close btn-close-white me-2 m-auto"
class="btn-close {% if 'warning' not in toast_type %}btn-close-white{% endif %} me-2 m-auto"
data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
</div>
{% elif type == "error" %}
<div class="toast align-items-center bg-danger text-white"
role="alert"
aria-live="assertive"
aria-atomic="true"
data-bs-delay="3500">
<div class="d-flex">
<div class="toast-body">{{ message }}</div>
<button type="button"
class="btn-close btn-close-white me-2 m-auto"
data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
</div>
{% elif type == "warning" %}
<div class="toast align-items-center bg-warning text-dark"
role="alert"
aria-live="assertive"
aria-atomic="true"
data-bs-delay="3500">
<div class="d-flex">
<div class="toast-body">{{ message }}</div>
<button type="button"
class="btn-close me-2 m-auto"
data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
</div>
{% elif type == "info" %}
<div class="toast align-items-center bg-info text-white"
role="alert"
aria-live="assertive"
aria-atomic="true"
data-bs-delay="3500">
<div class="d-flex">
<div class="toast-body">{{ message }}</div>
<button type="button"
class="btn-close btn-close-white me-2 m-auto"
data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
</div>
{% else %}
<div class="toast align-items-center bg-info text-white"
role="alert"
aria-live="assertive"
aria-atomic="true"
data-bs-delay="3500">
<div class="d-flex">
<div class="toast-body">{{ message }}</div>
<button type="button"
class="btn-close btn-close-white me-2 m-auto"
data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
</div>
{% endif %}
{% endwith %}
24 changes: 9 additions & 15 deletions gateway/sds_gateway/templates/users/file_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,20 @@
{% endblock bodyclass %}
{% block css %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'css/visualizations/visualization_modal.css' %}" />
<link rel="stylesheet" href="{% static 'css/permission-levels.css' %}" />
{% endblock css %}
{% block body %}
<!-- Add Font Awesome for sort arrows -->
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<!-- Add noUiSlider CSS first -->
<!-- Add file-list.css for upload modal styling -->
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.7.1/nouislider.min.css" />
Comment thread
lucaspar marked this conversation as resolved.
<!-- Add file-list.css for upload modal styling -->
<link rel="stylesheet" href="{% static 'css/file-list.css' %}" />
<!-- Add noUiSlider JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.7.1/nouislider.min.js"></script>
<link rel="stylesheet" href="{% static 'css/visualization_modal.css' %}" />
Comment thread
lucaspar marked this conversation as resolved.
<link rel="stylesheet" href="{% static 'css/permission-levels.css' %}" />
Comment thread
lucaspar marked this conversation as resolved.
<style>
.clear-search-hidden {
display: none;
}
</style>
{% endblock css %}
{% block content %}
<!-- Add noUiSlider JS -->
<!-- CSRF Token for JavaScript -->
{% csrf_token %}
<!-- System-wide notifications -->
Expand Down Expand Up @@ -391,9 +385,7 @@ <h5 class="modal-title" id="uploadResultModalLabel">Upload Result</h5>
{% if VISUALIZATIONS_ENABLED %}
{% include "visualizations/partials/visualization_modal.html" with visualization_compatibility=visualization_compatibility %}
{% endif %}
<!-- Web Download Modal -->
{% include "users/partials/web_download_modal.html" %}
{% endblock body %}
{% endblock content %}
{% block javascript %}
{{ block.super }}
<!-- Action components -->
Expand All @@ -407,6 +399,8 @@ <h5 class="modal-title" id="uploadResultModalLabel">Upload Result</h5>
<!-- Upload Capture Modal JavaScript -->
<!-- Load the WASM library for BLAKE3 hashing -->
<script src="https://cdn.jsdelivr.net/npm/hash-wasm@4.12.0/dist/blake3.umd.min.js"></script>
<!-- Load noUiSlider JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.7.1/nouislider.min.js"></script>
<!-- Upload modal functionality -->
<script src="{% static 'js/file_list_upload_capture_modal.js' %}"></script>
<!-- Pass Django context data to JavaScript -->
Expand Down
1 change: 1 addition & 0 deletions gateway/sds_gateway/users/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def dispatch(self, request, *args, **kwargs) -> HttpResponseRedirect:
"Your account is not approved to use API features. "
"Please contact the administrator.",
),
extra_tags="danger",
)
return redirect(reverse("home"))
return super().dispatch(request, *args, **kwargs)
Expand Down