diff --git a/app.py b/app.py index a2cf3b6..c597d63 100644 --- a/app.py +++ b/app.py @@ -1,7 +1,7 @@ from functools import wraps from logging import INFO, basicConfig, info, warning from os import environ, getenv, path, getcwd, makedirs, listdir -from random import choice +from random import choice, shuffle from flask import ( Flask, @@ -343,6 +343,17 @@ def dog(): return send_from_directory(app.config["UPLOAD_FOLDER"][1:] + "dog/", dog_image) +@app.route("/dog/all/") +def all_dogs(): + # serve all dog images + dog_images = [ + f"{app.config['UPLOAD_FOLDER']}dog/{dog}" + for dog in listdir(app.config["UPLOAD_FOLDER"][1:] + "dog/") + ] + shuffle(dog_images) + return render_template("dog.html", pics=dog_images) + + @app.route(DOG_URL, methods=["GET", "POST"]) @login_required def add_dog(): diff --git a/static/css/dog.css b/static/css/dog.css new file mode 100644 index 0000000..a26a617 --- /dev/null +++ b/static/css/dog.css @@ -0,0 +1,34 @@ +.dogpics { + margin: 1vw; + width: 98vw; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); + grid-template-rows: repeat(auto-fill, minmax(250px, 1fr)); + gap: 1vw; +} + +.dogpic { + border-radius: 10px; + place-self: center; + max-height: 100%; + max-width: 100%; + overflow: hidden; + animation: dogpicfade 0.5s ease-out backwards; +} + +.dogpiclarge { + grid-row: span 2 / auto; + grid-column: span 2 / auto; +} + +@keyframes dogpicfade { + from { + opacity: 0; + transform: scale(0.3); + } + + to { + opacity: 1; + transform: scale(1); + } +} \ No newline at end of file diff --git a/templates/dog.html b/templates/dog.html new file mode 100644 index 0000000..a447552 --- /dev/null +++ b/templates/dog.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} + +{% block title %} Bear {% endblock %} +{% block description %} All pics of Bear {% endblock %} +{% block head %} + +{% endblock %} + +{% block content %} +
+ {% for pic in pics%} + Bear + {% endfor %} +
+{% endblock %} \ No newline at end of file