diff --git a/WebHostLib/static/styles/userContent.css b/WebHostLib/static/styles/userContent.css new file mode 100644 index 00000000..40fdc7da --- /dev/null +++ b/WebHostLib/static/styles/userContent.css @@ -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; +} diff --git a/WebHostLib/templates/hostGame.html b/WebHostLib/templates/hostGame.html index 59bd55c0..9e4eff80 100644 --- a/WebHostLib/templates/hostGame.html +++ b/WebHostLib/templates/hostGame.html @@ -23,62 +23,6 @@ - - {% if rooms %} -

Your Games:

- - - - - - - - - - - - - {% for room in rooms %} - - - - - - - - {% endfor %} - -
SeedRoomPlayersCreated (UTC)Last Activity (UTC)
{{ room.seed.id|suuid }}{{ room.id|suuid }}{{ room.seed.multidata.names[0]|length }}{{ room.creation_time.strftime("%Y-%m-%d %H:%M") }}{{ room.last_activity.strftime("%Y-%m-%d %H:%M") }}
- {% endif %} - {% if seeds %} -

Your Games:

- - - - - - - - - - {% for seed in seeds %} - - - - - - {% endfor %} - -
SeedPlayersCreated (UTC)
{{ seed.id|suuid }}{% if seed.multidata %}{{ seed.multidata.names[0]|length }}{% else %}1{% endif %} - {{ seed.creation_time.strftime("%Y-%m-%d %H:%M") }}
- {% endif %} diff --git a/WebHostLib/templates/userContent.html b/WebHostLib/templates/userContent.html new file mode 100644 index 00000000..811300c9 --- /dev/null +++ b/WebHostLib/templates/userContent.html @@ -0,0 +1,78 @@ +{% extends 'pageWrapper.html' %} + +{% block head %} + {{ super() }} + Generate Game + +{% endblock %} + +{% block body %} + {% include 'header/oceanHeader.html' %} +
+
+

User Content

+ Below is a list of all the content you have generated on this site. Rooms and seeds are listed separately. + +

Your Rooms

+ {% if rooms %} + + + + + + + + + + + + {% for room in rooms %} + + + + + + + + {% endfor %} + +
SeedRoomPlayersCreated (UTC)Last Activity (UTC)
{{ room.seed.id|suuid }}{{ room.id|suuid }}{{ room.seed.multidata.names[0]|length }}{{ room.creation_time.strftime("%Y-%m-%d %H:%M") }}{{ room.last_activity.strftime("%Y-%m-%d %H:%M") }}
+ {% else %} + You have not created any rooms yet! + {% endif %} + +

Your Seeds

+ {% if seeds %} + + + + + + + + + + {% for seed in seeds %} + + + + + + {% endfor %} + +
SeedPlayersCreated (UTC)
{{ seed.id|suuid }}{% if seed.multidata %}{{ seed.multidata.names[0]|length }}{% else %}1{% endif %} + {{ seed.creation_time.strftime("%Y-%m-%d %H:%M") }}
+ {% else %} + You have no generated any seeds yet! + {% endif %} +
+
+ {% include 'islandFooter.html' %} +{% endblock %} diff --git a/WebHostLib/upload.py b/WebHostLib/upload.py index 6f1fe619..3e329e4e 100644 --- a/WebHostLib/upload.py +++ b/WebHostLib/upload.py @@ -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):