Add Seeds Table

This commit is contained in:
Fabian Dill 2020-12-04 23:25:49 +01:00
parent 31a31ac34b
commit 9e0ed8ab5b
2 changed files with 28 additions and 1 deletions

View File

@ -53,6 +53,32 @@
</tbody> </tbody>
</table> </table>
{% endif %} {% endif %}
{% if seeds %}
<h4>Your Games:</h4>
<table id="seed-table" class="table">
<thead>
<tr>
<th>Seed</th>
<th class="center">Players</th>
<th>Created (UTC)</th>
</tr>
</thead>
<tbody>
{% for seed in seeds %}
<tr>
<td><a href="{{ url_for("viewSeed", seed=seed.id) }}">{{ seed.id|suuid }}</a></td>
<td class="center"
{% if seed.multidata %}
data-tooltip="{{ seed.multidata.names[0]|join(", ")|truncate(256, False, " ...") }}"
{% endif %}
>{% if seed.multidata %}{{ seed.multidata.names[0]|length }}{% else %}1{% endif %}
</td>
<td>{{ seed.creation_time.strftime("%Y-%m-%d %H:%M") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div> </div>
</div> </div>

View File

@ -70,7 +70,8 @@ def uploads():
else: else:
flash("Not recognized file format. Awaiting a .multidata file.") flash("Not recognized file format. Awaiting a .multidata file.")
rooms = select(room for room in Room if room.owner == session["_id"]) rooms = select(room for room in Room if room.owner == session["_id"])
return render_template("hostGame.html", rooms=rooms) seeds = select(seed for seed in Seed if seed.owner == session["_id"])
return render_template("hostGame.html", rooms=rooms, seeds=seeds)
def allowed_file(filename): def allowed_file(filename):