From deb349adcc939c8cbecb4b7ec31e8026c2df4c10 Mon Sep 17 00:00:00 2001 From: Shiro-Nek0 Date: Fri, 20 Mar 2026 00:05:45 -0300 Subject: [PATCH] prettier navbar + replaced login for index --- app.py | 13 ++++--- static/style.css | 42 ++++++++++++++++++++++ templates/macros/navbar.html | 64 ++++++++++++++++++--------------- templates/worker_dashboard.html | 4 +-- 4 files changed, 88 insertions(+), 35 deletions(-) diff --git a/app.py b/app.py index cf1a571..8eaecd6 100644 --- a/app.py +++ b/app.py @@ -127,7 +127,7 @@ def login_required(f): @wraps(f) def decorated_function(*args, **kwargs): if 'user_id' not in session: - return redirect(url_for('login')) + return redirect(url_for('index')) return f(*args, **kwargs) return decorated_function @@ -136,14 +136,19 @@ def admin_required(f): def decorated_function(*args, **kwargs): if 'user_id' not in session or not session.get('is_admin'): flash("Acceso denegado. Se requieren permisos de administrador.", "danger") - return redirect(url_for('login')) + return redirect(url_for('index')) return f(*args, **kwargs) return decorated_function # --- Routes --- @app.route('/', methods=['GET', 'POST']) -def login(): +def index(): # Cambiado de 'login' a 'index' + if 'user_id' in session: + if session.get('is_admin'): + return redirect(url_for('admin_rendiciones')) + return redirect(url_for('worker_dashboard')) + if request.method == 'POST': raw_rut = request.form['rut'] password = request.form['password'] @@ -174,7 +179,7 @@ def login(): @app.route('/logout') def logout(): session.clear() - return redirect(url_for('login')) + return redirect(url_for('index')) @app.route('/dashboard', methods=['GET', 'POST']) @login_required diff --git a/static/style.css b/static/style.css index 7ccd58a..80d8fba 100644 --- a/static/style.css +++ b/static/style.css @@ -1,4 +1,46 @@ +.navbar { + padding-top: 0.75rem; + padding-bottom: 0.75rem; +} + +.navbar-brand { + font-size: 1.25rem; + letter-spacing: -0.5px; +} + +.nav-link { + transition: color 0.2s ease-in-out; +} + +/* Estilo para los elementos del dropdown al pasar el mouse */ +.dropdown-menu-dark .dropdown-menu-item { + color: #dee2e6; + text-decoration: none; + padding: 0.25rem 1rem; + display: block; + width: 100%; + clear: both; + font-weight: 400; + text-align: inherit; + white-space: nowrap; + background-color: transparent; + border: 0; + transition: background-color 0.15s ease-in-out; +} + +.dropdown-menu-dark .dropdown-menu-item:hover { + color: #fff; + background-color: rgba(255, 255, 255, 0.1); + border-radius: 6px; +} + +/* Separación de iconos en dropdowns */ +.dropdown-menu-item i { + width: 1.25rem; + text-align: center; +} + [data-bs-theme="dark"] .form-control[readonly] { background-color: #1a1d21; /* Un fondo casi negro, más oscuro que el modal */ border-color: #373b3e; /* Un borde sutil */ diff --git a/templates/macros/navbar.html b/templates/macros/navbar.html index f649b7a..abd56db 100644 --- a/templates/macros/navbar.html +++ b/templates/macros/navbar.html @@ -1,7 +1,10 @@ -