adjust header to work with trash empty button

This commit is contained in:
2025-05-25 20:25:15 +02:00
parent f89c8f4b1a
commit 5135ceca13
3 changed files with 34 additions and 13 deletions

View File

@@ -13,6 +13,16 @@
</div> </div>
{% if button_text and button_url %} {% if button_text and button_url %}
<div> <div>
{% if button_url == "#" %}
<button id="emptyTrashBtn"
class="btn {{ button_class if button_class else '' }}"
style="{{ 'background-color: #16767b; color: white;' if not button_class else '' }}{{ '; ' + button_style if button_style else '' }}">
{% if button_icon %}
<i class="fas {{ button_icon }} me-1"></i>
{% endif %}
{{ button_text }}
</button>
{% else %}
<button onclick="window.location.href='{{ button_url }}'" <button onclick="window.location.href='{{ button_url }}'"
class="btn {{ button_class if button_class else '' }}" class="btn {{ button_class if button_class else '' }}"
style="{{ 'background-color: #16767b; color: white;' if not button_class else '' }}{{ '; ' + button_style if button_style else '' }}"> style="{{ 'background-color: #16767b; color: white;' if not button_class else '' }}{{ '; ' + button_style if button_style else '' }}">
@@ -21,6 +31,7 @@
{% endif %} {% endif %}
{{ button_text }} {{ button_text }}
</button> </button>
{% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@@ -18,7 +18,6 @@
<form method="POST" enctype="multipart/form-data" class="bg-white rounded-lg shadow overflow-hidden"> <form method="POST" enctype="multipart/form-data" class="bg-white rounded-lg shadow overflow-hidden">
<!-- Profile Picture Section --> <!-- Profile Picture Section -->
<div class="p-4 border-b border-gray-200"> <div class="p-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900 mb-3">Profile Picture</h2>
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
<div class="relative group flex flex-col items-center"> <div class="relative group flex flex-col items-center">
<label for="profile_picture" class="cursor-pointer"> <label for="profile_picture" class="cursor-pointer">

View File

@@ -32,10 +32,21 @@
{% block extra_js %} {% block extra_js %}
<script src="{{ url_for('static', filename='js/file-grid.js') }}"></script> <script src="{{ url_for('static', filename='js/file-grid.js') }}"></script>
<script> <script>
// Update the empty trash button click handler document.addEventListener('DOMContentLoaded', function() {
document.querySelector('a[href="#"]').addEventListener('click', function(e) { // Add event listener for the empty trash button
const emptyTrashBtn = document.getElementById('emptyTrashBtn');
if (emptyTrashBtn) {
emptyTrashBtn.addEventListener('click', function(e) {
e.preventDefault(); e.preventDefault();
showEmptyTrashModal(); showEmptyTrashModal();
}); });
}
// Add event listener for the confirm empty trash button
const confirmEmptyTrashBtn = document.getElementById('confirmEmptyTrash');
if (confirmEmptyTrashBtn) {
confirmEmptyTrashBtn.addEventListener('click', emptyTrash);
}
});
</script> </script>
{% endblock %} {% endblock %}