+
+
@@ -299,6 +301,12 @@ async function viewTool(toolId) {
function closeDetailModal() {
document.getElementById('detail-modal').classList.add('hidden');
+ // Reset position for next open
+ const modal = document.getElementById('detail-modal-content');
+ modal.style.position = '';
+ modal.style.left = '';
+ modal.style.top = '';
+ modal.style.margin = '';
currentDetailToolId = null;
}
@@ -340,6 +348,12 @@ function rejectTool(toolId) {
function closeRejectModal() {
document.getElementById('reject-modal').classList.add('hidden');
+ // Reset position for next open
+ const modal = document.getElementById('reject-modal-content');
+ modal.style.position = '';
+ modal.style.left = '';
+ modal.style.top = '';
+ modal.style.margin = '';
currentToolId = null;
}
@@ -372,5 +386,58 @@ async function confirmReject() {
alert('Error: ' + (error.message || 'Unknown error occurred'));
}
}
+
+// Draggable modal functionality
+function makeDraggable(modalContentId, headerHandleId) {
+ const modal = document.getElementById(modalContentId);
+ const header = document.getElementById(headerHandleId);
+ if (!modal || !header) return;
+
+ let isDragging = false;
+ let startX, startY, initialX, initialY;
+
+ header.addEventListener('mousedown', (e) => {
+ if (e.target.tagName === 'BUTTON') return; // Don't drag when clicking buttons
+ isDragging = true;
+ startX = e.clientX;
+ startY = e.clientY;
+
+ const rect = modal.getBoundingClientRect();
+ initialX = rect.left;
+ initialY = rect.top;
+
+ // Switch to fixed positioning for dragging
+ modal.style.position = 'fixed';
+ modal.style.left = initialX + 'px';
+ modal.style.top = initialY + 'px';
+ modal.style.margin = '0';
+
+ document.addEventListener('mousemove', onMouseMove);
+ document.addEventListener('mouseup', onMouseUp);
+ });
+
+ function onMouseMove(e) {
+ if (!isDragging) return;
+ e.preventDefault();
+
+ const deltaX = e.clientX - startX;
+ const deltaY = e.clientY - startY;
+
+ modal.style.left = (initialX + deltaX) + 'px';
+ modal.style.top = (initialY + deltaY) + 'px';
+ }
+
+ function onMouseUp() {
+ isDragging = false;
+ document.removeEventListener('mousemove', onMouseMove);
+ document.removeEventListener('mouseup', onMouseUp);
+ }
+}
+
+// Initialize draggable modals
+document.addEventListener('DOMContentLoaded', () => {
+ makeDraggable('detail-modal-content', 'detail-modal-header');
+ makeDraggable('reject-modal-content', 'reject-modal-header');
+});
{% endblock %}