From 2437a3f26b70775b8dda9282286f02fcbc18ad72 Mon Sep 17 00:00:00 2001 From: Benjamin Sigonneau Date: Thu, 3 Jun 2021 01:05:12 +0200 Subject: [PATCH] Move css to a separate file, serve static files under /static/ route --- balises.py | 8 +++++++- static/balises.css | 19 +++++++++++++++++++ views/search_results.tpl | 22 +--------------------- 3 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 static/balises.css diff --git a/balises.py b/balises.py index 01f7c08..9cc916d 100755 --- a/balises.py +++ b/balises.py @@ -9,12 +9,13 @@ import requests import os import urllib.parse -from bottle import hook, request, route, run, view +from bottle import hook, request, route, run, static_file, view from config import conf import models from models import Song, AirCast, DoesNotExist +project_dir = os.path.dirname(__file__) # ---------------------------------------------------------------------- # Util functions @@ -112,6 +113,11 @@ def results_page(): start_time=time, end_time = '{:0>2}:00'.format(hour+1)) +@route('/static/') +def serve_static_file(filename): + static_root = os.path.join(project_dir, 'static') + return static_file(filename, root=static_root) + @hook('before_request') def set_locale(): """Set the locale for all categories to the first lang in Accept-Language diff --git a/static/balises.css b/static/balises.css new file mode 100644 index 0000000..7a6803e --- /dev/null +++ b/static/balises.css @@ -0,0 +1,19 @@ +#results { + border-colapse: collapse; +} +#results td, #results th { + padding-top: 3px; + padding-bottom: 3px; + padding-right:15px; +} +#results tr:hover { + background-color: #eaeaea; +} +#results a { + text-decoration: none; + color: inherit; +} +#results .fa-youtube { + /*color: #ed4337;*/ + color: crimson; +} diff --git a/views/search_results.tpl b/views/search_results.tpl index 3b23fc1..685e4f8 100644 --- a/views/search_results.tpl +++ b/views/search_results.tpl @@ -2,27 +2,7 @@ Radio Balises - - +