Add user-content page
This commit is contained in:
parent
9e0ed8ab5b
commit
18afeed437
|
@ -0,0 +1,33 @@
|
|||
#user-content-wrapper{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
#user-content{
|
||||
min-width: 900px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#user-content h1, #user-content h2{
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
#user-content h2{
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#user-content table{
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#user-content table th, #user-content table td{
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
#user-content .center{
|
||||
text-align: center;
|
||||
}
|
|
@ -23,62 +23,6 @@
|
|||
</form>
|
||||
<button id="host-game-button">Upload</button>
|
||||
</div>
|
||||
|
||||
{% if rooms %}
|
||||
<h4>Your Games:</h4>
|
||||
<table id="host-game-table" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Seed</th>
|
||||
<th>Room</th>
|
||||
<th class="center">Players</th>
|
||||
<th>Created (UTC)</th>
|
||||
<th>Last Activity (UTC)</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for room in rooms %}
|
||||
<tr>
|
||||
<td><a href="{{ url_for("viewSeed", seed=room.seed.id) }}">{{ room.seed.id|suuid }}</a></td>
|
||||
<td><a href="{{ url_for("hostRoom", room=room.id) }}">{{ room.id|suuid }}</a></td>
|
||||
<td
|
||||
class="center"
|
||||
data-tooltip="{{ room.seed.multidata.names[0]|join(", ")|truncate(256, False, " ...") }}"
|
||||
>{{ room.seed.multidata.names[0]|length }}</td>
|
||||
<td>{{ room.creation_time.strftime("%Y-%m-%d %H:%M") }}</td>
|
||||
<td>{{ room.last_activity.strftime("%Y-%m-%d %H:%M") }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% 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>
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
{% extends 'pageWrapper.html' %}
|
||||
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<title>Generate Game</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ static_autoversion("styles/userContent.css") }}" />
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'header/oceanHeader.html' %}
|
||||
<div id="user-content-wrapper">
|
||||
<div id="user-content" class="grass-island">
|
||||
<h1>User Content</h1>
|
||||
Below is a list of all the content you have generated on this site. Rooms and seeds are listed separately.
|
||||
|
||||
<h2>Your Rooms</h2>
|
||||
{% if rooms %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Seed</th>
|
||||
<th>Room</th>
|
||||
<th class="center">Players</th>
|
||||
<th>Created (UTC)</th>
|
||||
<th>Last Activity (UTC)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for room in rooms %}
|
||||
<tr>
|
||||
<td><a href="{{ url_for("viewSeed", seed=room.seed.id) }}">{{ room.seed.id|suuid }}</a></td>
|
||||
<td><a href="{{ url_for("hostRoom", room=room.id) }}">{{ room.id|suuid }}</a></td>
|
||||
<td
|
||||
class="center"
|
||||
data-tooltip="{{ room.seed.multidata.names[0]|join(", ")|truncate(256, False, " ...") }}"
|
||||
>{{ room.seed.multidata.names[0]|length }}</td>
|
||||
<td>{{ room.creation_time.strftime("%Y-%m-%d %H:%M") }}</td>
|
||||
<td>{{ room.last_activity.strftime("%Y-%m-%d %H:%M") }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
You have not created any rooms yet!
|
||||
{% endif %}
|
||||
|
||||
<h2>Your Seeds</h2>
|
||||
{% if seeds %}
|
||||
<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>
|
||||
{% else %}
|
||||
You have no generated any seeds yet!
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% include 'islandFooter.html' %}
|
||||
{% endblock %}
|
|
@ -69,9 +69,14 @@ def uploads():
|
|||
return redirect(url_for("viewSeed", seed=seed.id))
|
||||
else:
|
||||
flash("Not recognized file format. Awaiting a .multidata file.")
|
||||
return render_template("hostGame.html")
|
||||
|
||||
|
||||
@app.route('/user-content', methods=['GET'])
|
||||
def user_content():
|
||||
rooms = select(room for room in Room if room.owner == session["_id"])
|
||||
seeds = select(seed for seed in Seed if seed.owner == session["_id"])
|
||||
return render_template("hostGame.html", rooms=rooms, seeds=seeds)
|
||||
return render_template("userContent.html", rooms=rooms, seeds=seeds)
|
||||
|
||||
|
||||
def allowed_file(filename):
|
||||
|
|
Loading…
Reference in New Issue