diff --git a/app.py b/app.py index acd4ac9..222a40b 100644 --- a/app.py +++ b/app.py @@ -66,20 +66,7 @@ def wrapper(*args, **kwargs): @app.route("/") @app.route("/home") def home(): - return render_template( - "home.html", homepage=True, projects=get_projects_from_db(False) - ) - # hompeage is used to determine whether to show the long about me or not - - -@app.route("/aboutme") -def about_me(): - return render_template("aboutmepage.html", homepage=False) - - -@app.route("/projects") -def projects(): - return render_template("projectspage.html", projects=get_projects_from_db(False)) + return render_template("home.html", projects=get_projects_from_db(False)) @app.route("/projects/smallprojects") @@ -308,30 +295,37 @@ def add_photo( dog: bool = False, ): if ( + # pre=checks check_password_hash(password, request.form["password"]) and "photo" in request.files and request.files["photo"].filename != "" ): photo = request.files["photo"] + # only allow png, jpg, jpeg files if not photo.filename.endswith((".png", ".jpg", ".jpeg")): return "

Invalid file type

" + # get filename and extension file_name, ext = path.splitext(secure_filename(photo.filename)) if dog: file_name = "bear" + # split path base_path = path.join(getcwd(), upload_folder[1:], file_name) file_path = base_path + ext + # create directory if it doesn't exist if not path.exists(path.dirname(file_path)): makedirs(path.dirname(file_path)) + # stop duplicate file names i = 1 while path.exists(file_path) or (dog and i == 1): file_path = f"{base_path}{i}{ext}" i += 1 + # save photo photo.save(file_path) info(f"{request.remote_addr} uploaded photo {file_name} to {file_path}") @@ -350,19 +344,10 @@ def dog(): return send_from_directory("static/img/dog", dog_image) -@app.route("/dog/") -def specific_dog(dog_id: int): - # get specific dog image from /static/img/dog/ folder - dog_images = listdir("static/img/dog") - if dog_id < 0 or dog_id >= len(dog_images): - return "

Invalid dog id

" - dog_image = dog_images[dog_id] - return send_from_directory("static/img/dog", dog_image) - - @app.route(DOG_URL, methods=["GET", "POST"]) @login_required def add_dog(): + # add a dog if request.method == "POST": return add_photo(request, f"{app.config['UPLOAD_FOLDER']}dog/", True) return render_template("uploadphoto.html", action=DOG_URL) diff --git a/static/css/aboutme.css b/static/css/aboutme.css index 58b0aee..41cb484 100644 --- a/static/css/aboutme.css +++ b/static/css/aboutme.css @@ -1,16 +1,8 @@ .aboutmecontainer { - height: 92vh; + height: 192vh; width: 100%; } -.aboutmefull { - height: 100%; - width: 100%; - display: flex; - justify-content: space-between; - align-items: center; -} - .aboutme { height: 90%; width: 100%; @@ -22,21 +14,28 @@ .aboutmelogocontainer { height: 100%; width: 50%; + margin-top: 8vh; display: flex; justify-content: center; - align-items: center; - overflow: hidden; + align-items: flex-start; } .aboutmelogo { - height: auto; width: 80%; border-radius: 10%; } +.aboutmetextcontainer { + height: 192vh; + width: 50%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: stretch; +} + .aboutmetext { height: 100%; - width: 50%; display: flex; flex-direction: column; justify-content: center; @@ -64,6 +63,7 @@ display: flex; justify-content: center; align-items: center; + transform: translateY(-100vh); } .downarrow { @@ -74,23 +74,40 @@ @media screen and (max-width: 500px) { - .aboutme, - .aboutmefull { + .aboutme { flex-direction: column; } + .aboutmecontainer { + height: auto; + } + .aboutmelogocontainer { height: auto; margin-top: 10vh; overflow: visible; } + .aboutmetextcontainer { + width: 100%; + height: 100%; + } + .aboutmetext { width: 100%; } + .aboutmedescription:nth-child(1) { + height: auto; + font-size: 2vh; + } + .aboutmename { text-align: center; font-size: 15vw; } + + .downarrowcontainer { + display: none; + } } \ No newline at end of file diff --git a/templates/aboutme.html b/templates/aboutme.html deleted file mode 100644 index 1ffb1d5..0000000 --- a/templates/aboutme.html +++ /dev/null @@ -1,30 +0,0 @@ -
-
-
- -
-
- {% if homepage %} -

Hi, I'm Joel

-

A computer science student at the University of Warwick

- {% else %} -

Hi, I'm Joel, a Computer Science student at the University of Warwick. My - passion - for computer science started in 2015 with my first proper computer science lessons at secondary school. - As a - tech officer at UWCS, I help maintain various - projects - such as servers, discord bots, and websites (such as this one).

- {% endif %} -
-
- {% if homepage %} -
- - - - -
- {% endif %} -
\ No newline at end of file diff --git a/templates/aboutmepage.html b/templates/aboutmepage.html deleted file mode 100644 index 3257dcc..0000000 --- a/templates/aboutmepage.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} - -{% block title %} About Joel {% endblock %} -{% block description %} About Joel Coulon {% endblock %} -{% block head %} - - - -{% endblock %} - -{% block content %} -{% with homepage=homepage %} -{% include 'aboutme.html' %} -{% endwith %} -{% endblock %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index da3d43c..cf93df4 100644 --- a/templates/base.html +++ b/templates/base.html @@ -22,27 +22,21 @@