diff --git a/web/server.py b/web/server.py index 7829977..59c11c2 100644 --- a/web/server.py +++ b/web/server.py @@ -503,7 +503,7 @@ def get_counties(): @app.route('/counties') def counties_page(): - return render_template('counties.html') + return render_template('counties.html', current_user=session.get('username')) @app.route('/api/counties', methods=['GET']) def get_counties_api(): @@ -555,7 +555,7 @@ _ensure_exceptions_file() @app.route('/exceptions') def exceptions_page(): - return render_template('exceptions.html') + return render_template('exceptions.html', current_user=session.get('username')) @app.route('/api/exceptions', methods=['GET']) diff --git a/web/templates/counties.html b/web/templates/counties.html index a983751..4d911e4 100644 --- a/web/templates/counties.html +++ b/web/templates/counties.html @@ -181,6 +181,19 @@ .btn-add:hover { background: #c8e6c9; } .btn-save { background: #17a2b8; color: white; } .btn-save:hover { filter: brightness(0.9); } + + .btn-dl { + padding: 7px 12px; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 13px; + font-weight: 600; + background: #e9ecef; + color: #555; + text-decoration: none; + } + .btn-dl:hover { background: #dee2e6; }
@@ -205,6 +218,11 @@ @@ -338,6 +356,22 @@ .catch(err => showStatus(`Error: ${err.message}`, 'error')); } + function uploadConfig(input) { + if (!input.files.length) return; + const formData = new FormData(); + formData.append('file', input.files[0]); + showStatus('Uploading…', 'success'); + fetch('/api/config/counties.yml', { method: 'POST', body: formData }) + .then(r => r.json()) + .then(data => { + if (data.error) { showStatus(`Error: ${data.error}`, 'error'); return; } + showStatus('Uploaded — reloading…', 'success'); + setTimeout(() => window.location.reload(), 800); + }) + .catch(err => showStatus(`Error: ${err.message}`, 'error')) + .finally(() => { input.value = ''; }); + } + // Load on open fetch('/api/counties') .then(r => r.json()) diff --git a/web/templates/exceptions.html b/web/templates/exceptions.html index 080fe36..ccfd1ee 100644 --- a/web/templates/exceptions.html +++ b/web/templates/exceptions.html @@ -180,6 +180,19 @@ .btn-save { background: #17a2b8; color: white; } .btn-save:hover { filter: brightness(0.9); } + + .btn-dl { + padding: 7px 12px; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 13px; + font-weight: 600; + background: #e9ecef; + color: #555; + text-decoration: none; + } + .btn-dl:hover { background: #dee2e6; } @@ -222,6 +235,11 @@ @@ -308,6 +326,22 @@ .catch(err => showStatus(`Error: ${err.message}`, 'error')); } + function uploadConfig(input) { + if (!input.files.length) return; + const formData = new FormData(); + formData.append('file', input.files[0]); + showStatus('Uploading…', 'info'); + fetch('/api/config/exceptions.yml', { method: 'POST', body: formData }) + .then(r => r.json()) + .then(data => { + if (data.error) { showStatus(`Error: ${data.error}`, 'error'); return; } + showStatus('Uploaded — reloading…', 'success'); + setTimeout(() => window.location.reload(), 800); + }) + .catch(err => showStatus(`Error: ${err.message}`, 'error')) + .finally(() => { input.value = ''; }); + } + // Load on page open fetch('/api/exceptions') .then(r => r.json()) diff --git a/web/templates/index.html b/web/templates/index.html index 2e9168d..6706cf6 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -65,26 +65,6 @@ .btn-topbar.purple:hover { background: #5a32a3; } - .btn-topbar-icon { - padding: 5px 8px; - border: none; - border-radius: 5px; - cursor: pointer; - font-size: 12px; - font-weight: 600; - background: #ffffff18; - color: #ddd; - text-decoration: none; - } - - .btn-topbar-icon:hover { background: #ffffff30; } - - .config-group { - display: flex; - align-items: center; - gap: 2px; - } - /* ── Main two-panel layout ── */ .main { flex: 1; @@ -378,17 +358,6 @@ - {% if current_user %} -