Upload files to "templates"

This commit is contained in:
2024-11-28 22:47:47 -05:00
parent 50a89e5ddf
commit d99dc3cf8a
5 changed files with 242 additions and 4 deletions

View File

@ -4,7 +4,20 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<link rel="stylesheet" href="/static/styles.css">
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
{% if theme == 'dark' %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/dark_theme.css') }}">
{% elif theme == 'modern' %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/modern_theme.css') }}">
{% elif theme == 'vampire' %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/vampire_theme.css') }}">
{% elif theme == 'nordic' %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/nordic_theme.css') }}">
{% elif theme == 'halloween' %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/halloween_theme.css') }}">
{% else %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/light_theme.css') }}">
{% endif %}
</head>
<body>
<header>
@ -36,19 +49,65 @@
</div>
</div>
<a href="/rule_creation">Rule Creation</a>
<a href="/notebook">Notebook</a>
{% if current_user.is_authenticated %}
<a href="/notebook">Notebook</a>
<a href="/profile">{{ current_user.username }}</a>
{% else %}
<a href="/login">Login</a>
{% endif %}
</nav>
<!-- Theme Toggle Slider -->
<label class="switch">
<input type="checkbox" id="theme-toggle">
<span class="slider"></span>
</label>
</header>
<div class="tip">
{{ random_tip }}
</div>
<main class="main-content">
<main class="{{ theme }}-theme main-content">
{% block content %}{% endblock %}
</main>
<script>
// Theme toggle functionality
const themeToggle = document.getElementById('theme-toggle');
const themeStylesheet = document.getElementById('theme-stylesheet');
const body = document.body;
// Check for stored theme in localStorage
if (localStorage.getItem('theme') === 'light') {
themeToggle.checked = true;
body.classList.add('light-theme');
body.classList.remove('dark-theme');
themeStylesheet.href = '{{ url_for("static", filename="css/light_theme.css") }}';
} else {
themeToggle.checked = false;
body.classList.add('dark-theme');
body.classList.remove('light-theme');
themeStylesheet.href = '{{ url_for("static", filename="css/dark_theme.css") }}';
}
// Event listener for theme toggle
themeToggle.addEventListener('change', function() {
if (this.checked) {
body.classList.remove('dark-theme');
body.classList.add('light-theme');
themeStylesheet.href = '{{ url_for("static", filename="css/light_theme.css") }}';
localStorage.setItem('theme', 'light');
} else {
body.classList.remove('light-theme');
body.classList.add('dark-theme');
themeStylesheet.href = '{{ url_for("static", filename="css/dark_theme.css") }}';
localStorage.setItem('theme', 'dark');
}
});
// Burger menu toggle function for mobile
function toggleMenu() {
const navLinks = document.querySelector('.nav-links');
navLinks.classList.toggle('active');