From fee6f755a388dce7ed7508cfdf9571e3225f50d8 Mon Sep 17 00:00:00 2001 From: Tanishq Dubey Date: Sun, 20 Oct 2024 15:53:35 -0400 Subject: [PATCH] More styling --- app.py | 8 +- config.py | 3 + templates/admin.html | 166 ++++++++++++++++++++++++++++--------- templates/admin_login.html | 83 +++++++++++++++---- templates/index.html | 16 ++-- 5 files changed, 208 insertions(+), 68 deletions(-) diff --git a/app.py b/app.py index 407abb2..50b7279 100644 --- a/app.py +++ b/app.py @@ -74,7 +74,7 @@ scheduler.add_job(generate_all_thumbnails, 'date', run_date=datetime.now()) # R @app.route('/') def index(): - return render_template('index.html') + return render_template('index.html', accent_color=config['appearance']['accent_color']) @app.route('/api/images') def get_images(): @@ -116,7 +116,7 @@ def admin(): photos = db_session.query(Photo).order_by(Photo.date_taken.desc()).all() db_session.close() - return render_template('admin.html', photos=photos) + return render_template('admin.html', photos=photos, accent_color=config['appearance']['accent_color']) @app.route('/admin/login', methods=['GET', 'POST']) def admin_login(): @@ -126,7 +126,7 @@ def admin_login(): return redirect(url_for('admin')) else: flash('Invalid password') - return render_template('admin_login.html') + return render_template('admin_login.html', accent_color=config['appearance']['accent_color']) @app.route('/admin/upload', methods=['POST']) def admin_upload(): @@ -183,7 +183,7 @@ def admin_upload(): orientation=int(exif.get('Orientation', 1)), width=width, height=height, - highlight_color=get_highlight_color(THUMBNAIL_FOLDER + f"{os.path.splitext(filename)[0]}/256_{filename}") + highlight_color=get_highlight_color(THUMBNAIL_FOLDER + f"/{os.path.splitext(filename)[0]}/256_{filename}") ) db_session.add(new_photo) db_session.commit() diff --git a/config.py b/config.py index b929a5b..0c5b9a7 100644 --- a/config.py +++ b/config.py @@ -14,6 +14,9 @@ def load_or_create_config(): 'directories': { 'upload': 'uploads', 'thumbnail': 'thumbnails' + }, + 'appearance': { + 'accent_color': '{{ accent_color }}' } } with open(CONFIG_FILE, 'w') as f: diff --git a/templates/admin.html b/templates/admin.html index ae11af1..f54bde2 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -3,56 +3,146 @@ - Admin Interface + Admin Interface - Tanishq Dubey Photography + + + -

Admin Interface

- {% with messages = get_flashed_messages() %} - {% if messages %} -