dark mode
This commit is contained in:
parent
e5b787213d
commit
d684c331bd
2
app.py
2
app.py
@ -771,7 +771,7 @@ def advanced_schedule():
|
||||
|
||||
@app.route('/toggle_dark_mode')
|
||||
def toggle_dark_mode():
|
||||
current_mode = session.get('dark_mode', False)
|
||||
current_mode = session.get('dark_mode', True)
|
||||
session['dark_mode'] = not current_mode
|
||||
return redirect(request.referrer or url_for('index'))
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl" class="{% if session.dark_mode %}dark-mode{% endif %}">
|
||||
<html lang="pl" class="{% if session.get('dark_mode', True) %}dark-mode{% endif %}">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Backup RouterOS App</title>
|
||||
@ -7,49 +7,135 @@
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
|
||||
|
||||
<style>
|
||||
/* Ogólne style trybu ciemnego */
|
||||
.dark-mode body {
|
||||
background-color: #222;
|
||||
background-color: #111111;
|
||||
color: #ffffff;
|
||||
}
|
||||
.dark-mode a, .dark-mode a:hover {
|
||||
.dark-mode a,
|
||||
.dark-mode a:hover {
|
||||
color: #ddd;
|
||||
}
|
||||
.dark-mode .navbar, .dark-mode .table {
|
||||
|
||||
/* Nawigacja i menu */
|
||||
.dark-mode .navbar,
|
||||
.dark-mode .navbar-nav,
|
||||
.dark-mode .dropdown-menu {
|
||||
background-color: #333 !important;
|
||||
color: #fff;
|
||||
}
|
||||
.dark-mode .navbar-nav .nav-link {
|
||||
color: #ddd !important;
|
||||
}
|
||||
.dark-mode .navbar-nav .nav-link:hover {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
/* Tabele */
|
||||
.dark-mode .table {
|
||||
background-color: #333 !important;
|
||||
border-color: #444;
|
||||
}
|
||||
.dark-mode .table thead th {
|
||||
background-color: #444;
|
||||
color: #fff;
|
||||
border: 1px solid #555;
|
||||
}
|
||||
.dark-mode .table tbody td {
|
||||
color: #ddd;
|
||||
border: 1px solid #555;
|
||||
}
|
||||
|
||||
/* Pola formularzy */
|
||||
.dark-mode input,
|
||||
.dark-mode textarea,
|
||||
.dark-mode select {
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
border: 1px solid #555;
|
||||
}
|
||||
.dark-mode ::placeholder {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
/* Przyciski - poprawiony kontrast dla btn-warning */
|
||||
.dark-mode .btn-warning {
|
||||
background-color: #d39e00;
|
||||
border-color: #b38600;
|
||||
color: #fff;
|
||||
}
|
||||
.dark-mode .btn-secondary {
|
||||
background-color: #444;
|
||||
border-color: #555;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Bloki (np. zawartość kontenera, karty) */
|
||||
.dark-mode .block, .dark-mode .card {
|
||||
background-color: #171717;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Stopka */
|
||||
.dark-mode footer {
|
||||
background-color: #333 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
|
||||
/* Alerty – pozostają bez zmian */
|
||||
.diff-add { color: green; }
|
||||
.diff-rem { color: red; }
|
||||
</style>
|
||||
|
||||
<!-- Blok head umożliwiający dołączenie dodatkowych stylów -->
|
||||
{% block head %}{% endblock %}
|
||||
/* Dodatkowe nadpisanie styli diff2html w trybie ciemnym */
|
||||
.dark-mode .d2h-wrapper,
|
||||
.dark-mode .d2h-file-header,
|
||||
.dark-mode .d2h-file-info,
|
||||
.dark-mode .d2h-file-diff,
|
||||
.dark-mode .d2h-diff-table,
|
||||
.dark-mode .d2h-code-line,
|
||||
.dark-mode .d2h-code-line-ctn,
|
||||
.dark-mode .d2h-code-side-linenumber {
|
||||
background-color: #333 !important;
|
||||
color: #ddd !important;
|
||||
border-color: #444 !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<!-- Blok head umożliwiający dołączenie dodatkowych stylów -->
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand navbar-dark bg-dark mb-4">
|
||||
<div class="container-fluid">
|
||||
<a href="{{ url_for('index') }}" class="navbar-brand">RouterOS Backup</a>
|
||||
<div>
|
||||
<div class="d-flex align-items-center">
|
||||
{% if session.user_id %}
|
||||
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary me-2">Dashboard</a>
|
||||
<a href="{{ url_for('routers_list') }}" class="btn btn-secondary me-2">Urządzenia</a>
|
||||
<a href="{{ url_for('diff_selector') }}" class="btn btn-secondary me-2">Diff selector</a>
|
||||
<a href="{{ url_for('all_files') }}" class="btn btn-secondary me-2">Wszystkie pliki</a>
|
||||
<a href="{{ url_for('logs_page') }}" class="btn btn-secondary me-2">Logi</a>
|
||||
|
||||
<a href="{{ url_for('settings_view') }}" class="btn btn-secondary me-2">Ustawienia</a>
|
||||
<a href="{{ url_for('advanced_schedule') }}" class="btn btn-secondary me-2">Harmonogram</a>
|
||||
|
||||
<a href="{{ url_for('advanced_schedule') }}" class="btn btn-secondary me-2">Harmonogram</a>
|
||||
<a href="{{ url_for('change_password') }}" class="btn btn-secondary me-2">Zmiana hasła</a>
|
||||
<a href="{{ url_for('toggle_dark_mode') }}" class="btn btn-warning me-2">
|
||||
{% if session.get('dark_mode', True) %}Jasny tryb{% else %}Ciemny tryb{% endif %}
|
||||
</a>
|
||||
<a href="{{ url_for('logout') }}" class="btn btn-secondary me-2">Wyloguj</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('login') }}" class="btn btn-secondary me-2">Zaloguj</a>
|
||||
<a href="{{ url_for('register') }}" class="btn btn-secondary me-2">Utwórz konto</a>
|
||||
<a href="{{ url_for('toggle_dark_mode') }}" class="btn btn-warning me-2">
|
||||
{% if session.get('dark_mode', True) %}Jasny tryb{% else %}Ciemny tryb{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
<!--<a href="{{ url_for('toggle_dark_mode') }}" class="btn btn-warning">Toggle Dark Mode</a>-->
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
@ -64,27 +150,26 @@
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Modal Test Połączenia -->
|
||||
<div class="modal fade" id="testConnectionModal" tabindex="-1" aria-labelledby="testConnectionModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="testConnectionModalLabel">Test Połączenia</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Zamknij"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="testConnectionModalBody">
|
||||
<!-- Zawartość zostanie załadowana przez AJAX -->
|
||||
<div class="modal fade" id="testConnectionModal" tabindex="-1" aria-labelledby="testConnectionModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="testConnectionModalLabel">Test Połączenia</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Zamknij"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="testConnectionModalBody">
|
||||
<!-- Zawartość zostanie załadowana przez AJAX -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer bg-light py-3 mt-auto">
|
||||
<div class="container text-center">
|
||||
<span class="text-muted">© 2025 RouterOS Backup</span>
|
||||
</div>
|
||||
</footer>
|
||||
<footer class="footer py-3 mt-auto">
|
||||
<div class="container text-center">
|
||||
<span>© 2025 Mateusz Gruszczyński, linuxiarz.pl</span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
@ -97,7 +182,6 @@
|
||||
.then(data => {
|
||||
if(data.status === "success"){
|
||||
alert("Eksport wykonany: " + data.message);
|
||||
// Możesz też zaktualizować część strony dynamicznie
|
||||
} else {
|
||||
alert("Błąd eksportu: " + data.message);
|
||||
}
|
||||
@ -107,22 +191,22 @@
|
||||
alert("Wystąpił błąd.");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function openTestConnectionModal(routerId) {
|
||||
fetch('/router/' + routerId + '/test_connection?modal=1')
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
document.getElementById('testConnectionModalBody').innerHTML = html;
|
||||
var myModal = new bootstrap.Modal(document.getElementById('testConnectionModal'));
|
||||
myModal.show();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Błąd ładowania modalu: ", error);
|
||||
alert("Wystąpił błąd podczas ładowania danych.");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
<script>
|
||||
function openTestConnectionModal(routerId) {
|
||||
fetch('/router/' + routerId + '/test_connection?modal=1')
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
document.getElementById('testConnectionModalBody').innerHTML = html;
|
||||
var myModal = new bootstrap.Modal(document.getElementById('testConnectionModal'));
|
||||
myModal.show();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Błąd ładowania modalu: ", error);
|
||||
alert("Wystąpił błąd podczas ładowania danych.");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<!-- Blok scripts umożliwiający dołączenie dodatkowych skryptów -->
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
|
@ -26,3 +26,4 @@
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
GET | 200 | 45 ms
|
Loading…
x
Reference in New Issue
Block a user