From 52eeab7042d8ec9fa09b6559a0812ad73ef718de Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen <frederik+gitea@baerentsen.net> Date: Mon, 4 Mar 2024 14:00:57 -0500 Subject: [PATCH] Fixed formatting and added title image on inventory page --- app.py | 4 +--- templates/base.html | 15 +++++++++++++-- templates/bootstrap_table.html | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 4aa3b78..581ba32 100644 --- a/app.py +++ b/app.py @@ -17,7 +17,6 @@ def index(): with open('./static/sets/'+set_num+'/info.json') as info: info_file = json.loads(info.read()) set_list.append(info_file) - print(set_list) return render_template('frontpage.html',set_list=set_list) @app.route('/<tmp>') @@ -28,8 +27,7 @@ def sets(tmp): inventory_file = json.loads(inventory.read()) with open('./info/'+tmp+'.json') as info: json_file = json.loads(info.read()) - pp(json_file['unit'][0]['bricks']['missing']) - return render_template('bootstrap_table.html', tmp=tmp,title=info_file['set_num']+" - "+info_file['name'], + return render_template('bootstrap_table.html', tmp=tmp,title=info_file['name'], info_file=info_file,inventory_file=inventory_file,json_file=json_file) diff --git a/templates/base.html b/templates/base.html index 70cc741..105b82f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -33,6 +33,14 @@ table { text-overflow: ellipsis; } +#data th:nth-child(4), +#data td:nth-child(4) { + max-width: 100px; /* Adjust as needed */ + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + .center-table { } @@ -211,8 +219,11 @@ input[type=number] { <body> <button style="background-color: white;color: black;border: 1px dotted black;width: 98%;margin: 1%;" onclick="goToPage('/')">Home</button> <div class="container"> - <h2 style="margin: 20px 0px 0px 0px;">{{ title }}</h2> - <hr> + <center> + + <h2 style="margin: 0px 0px 0px 0px;"> {{ tmp }}</h2> + <img style='height: 100px; width: auto; object-fit: contain' src="/static/sets/{{ tmp }}/cover.jpg" alt="Image"> + <h2 style="margin: 0px 0px 0px 0px;">{{ title }}</h2></center> {% block content %}{% endblock %} </div> {% block scripts %}{% endblock %} diff --git a/templates/bootstrap_table.html b/templates/bootstrap_table.html index ffd6a0f..4bce6d6 100644 --- a/templates/bootstrap_table.html +++ b/templates/bootstrap_table.html @@ -9,7 +9,7 @@ <th></th> <th style="text-align:center;margin:0px;" class="fixed-width hidden-mobile">ID</th> <th class="fixed-width hidden-mobile">Name</th> - <th>Color</th> + <th class="fixed-width">Color</th> <th style="text-align: center;" class="fixed-width">Qty</th> {% for i in json_file['unit'] %} <th style="text-align: center;" class="fixed-width">Missing ({{ loop.index }})</th>