Add PDF export functionality and favicon support

- Introduced a new script for exporting the dashboard as a PDF using html2canvas and jsPDF.
- Added a favicon.ico file and linked it in the base template.
- Updated the base template to include the new PDF export script and modified the button for PDF export functionality.
- Enhanced the index template to include an ID for the dashboard content for PDF generation.
This commit is contained in:
2026-02-07 13:46:50 +03:00
parent 6836e0535b
commit 9f3946a0bc
8 changed files with 527 additions and 3 deletions

View File

@@ -5,10 +5,13 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}SWatcher{% endblock %}</title>
<link rel="icon" href="{% static 'favicon.ico' %}" type="image/x-icon">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/output.css' %}">
<script src="{% static 'js/html2canvas-pro.min.js' %}"></script>
<script src="{% static 'js/jspdf.umd.min.js' %}"></script>
{% block imports %}
{% endblock %}
{% block css %}
@@ -22,7 +25,7 @@
</div>
<div class="navbar-end">
<div class="px-1 flex items-center gap-3 pr-10">
<button type="button" class="btn btn-ghost btn-sm no-print" onclick="window.print()" title="Save as PDF" aria-label="Save as PDF">
<button type="button" id="pdf-export-btn" class="btn btn-ghost btn-sm no-print" onclick="exportDashboardToPdf()" title="Save as PDF" aria-label="Save as PDF">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
@@ -70,6 +73,7 @@
localStorage.setItem('theme', newTheme);
});
</script>
<script src="{% static 'js/export-pdf.js' %}"></script>
{% block script %}
{% endblock %}
</body>