From 2f6cc797903db3a3e8860ad0df606d3d6327aee2 Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen <frederik+gitea@baerentsen.net> Date: Sat, 28 Dec 2024 09:34:07 +0100 Subject: [PATCH] Added option for rebrickable links --- app.py | 7 ++++++- templates/index.html | 11 +++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index e09fa36..395d412 100644 --- a/app.py +++ b/app.py @@ -22,6 +22,11 @@ app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1, x_ socketio = SocketIO(app,cors_allowed_origins=os.getenv("DOMAIN_NAME")) count = 0 +if os.getenv("LINKS"): + LINKS = os.getenv("LINKS") +else: + LINKS = False + DIRECTORY = os.path.join(os.getcwd(), 'static', 'instructions') @@ -635,7 +640,7 @@ def index(): #files = [re.match(r'^([\w]+-[\w]+)', f).group() for f in os.listdir(DIRECTORY) if f.endswith('.pdf')] print(files.sort()) - return render_template('index.html',set_list=set_list,themes_list=theme_file,missing_list=missing_list,files=files,minifigs=minifigs) + return render_template('index.html',set_list=set_list,themes_list=theme_file,missing_list=missing_list,files=files,minifigs=minifigs,links=LINKS) if request.method == 'post': set_num = request.form.get('set_num') diff --git a/templates/index.html b/templates/index.html index 4501685..7a10b14 100644 --- a/templates/index.html +++ b/templates/index.html @@ -197,7 +197,6 @@ display: none !important; </div> </nav> - <div class="search-container"> <input class="input"type="text" id="searchInput" onkeyup="searchFunction()" placeholder="Search title or set number..."> <!-- <center hidden="true"> @@ -218,14 +217,17 @@ display: none !important; <!-- Add more buttons for other text values if needed --> </div> <div class="grid-container" id="gridContainer"> - {% for i in set_list %} <div class="grid-item"> <div class="card"> <div class="columns" style=""> <div class="column is-full" style="text-align: left;"> <p class="is-size-5 searchTitle"> - <span style="font-weight: bold;" class="set_id">{{ i[0] }}</span> <span style="font-weight: bold;" class="set_name">{{ i[1] }}</span><br> + {% if links == 'True' %} + <a style="font-weight: bold;" href="https://rebrickable.com/sets/{{ i[0] }}" target="_blank" class="has-text-dark set_id">{{ i[0] }}</a> <span style="font-weight: bold;" class="has-text-dark set_name">{{ i[1] }}</span><br> + {% else %} + <span style="font-weight: bold;" class="has-text-dark set_id">{{ i[0] }}</span> <span style="font-weight: bold;" class="has-text-dark set_name">{{ i[1] }}</span><br> + {% endif %} <a class="is-size-7 set_theme" style="color: #363636;">{{ i[3] }}</a> <a class="is-size-7" style="color: #363636;"> (<span class='set_year'>{{ i[2] }}</span>)</a> <span></span> <a class="is-size-5" style="color: #363636;float:right;"><b>Parts:</b> {{ i[4] }}</a> @@ -342,9 +344,6 @@ display: none !important; <a class="is-size-6" style="color: #363636;" href="/{{ i[0] }}/{{ i[11] }}">Inv.</a> </span> </p> - - - </footer> </div> </div>