From 5c4e5b9e4612b5374640c4dee5f4cc14669058d8 Mon Sep 17 00:00:00 2001 From: Xevion Date: Sat, 21 Dec 2019 00:35:01 -0600 Subject: [PATCH] added 404, removing profile, updated index with google analytics --- app/routes.py | 27 ++++++++++++++++++--- app/templates/404.html | 17 +++++++++++++ app/templates/base.html | 13 ++++++---- app/templates/index.html | 28 ++-------------------- app/templates/profile.html | 49 +++++++++++++++++++++++++++++++++++++- 5 files changed, 100 insertions(+), 34 deletions(-) create mode 100644 app/templates/404.html diff --git a/app/routes.py b/app/routes.py index f70a2f9..b9e39b7 100644 --- a/app/routes.py +++ b/app/routes.py @@ -107,8 +107,19 @@ def create_panzer(string): @app.route('/profile/') @login_required -def profile(): - return render_template('profile.html') +def default_profile(): + return profile(current_user.username) + +@app.route('/profile/') +@login_required +def profile(username): + user = User.query.filter_by(username=username).first_or_404() + return render_template('profile.html', user=user) + +@app.errorhandler(404) +def page_not_found(e): + # note that we set the 404 status explicitly + return render_template('404.html'), 404 @app.route('/userinfo/') @login_required @@ -127,8 +138,18 @@ def user_info(): } return jsonify(prepare) + + @app.route('/') def index(): + jobs = [ + 'Student Photographer', + 'Highschool Student', + 'Web Developer', + 'Python Developer', + 'Software Engineer', + ] + # content = [{'text': fake.paragraph(nb_sentences=15), # 'seed': random.randint(0, 1000), # 'title': fake.word().title()} @@ -137,7 +158,7 @@ def index(): 'seed': random.randint(0, 1000), 'text': 'This portion of my website is still a work in progress. I don\'t know if and when it\'ll be done, or how it will turn out in the end. - Xevion @ (Jul-11-2019)'} for _ in range(1)] - return render_template('index.html', content=content) + return render_template('index.html', content=content, job=random.choice(jobs)) @app.route('/register/', methods=['GET', 'POST']) def register(): diff --git a/app/templates/404.html b/app/templates/404.html new file mode 100644 index 0000000..61f4eda --- /dev/null +++ b/app/templates/404.html @@ -0,0 +1,17 @@ +{% extends 'base.html' %} +{% block body %} + +
+
+
+

+ 404 +

+

+ Content Not Found... Go home? +

+
+
+
+ +{% endblock body %} \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index b4b7e0e..bbe9681 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -28,6 +28,15 @@ Color = Bulma Color Type of the Message Box {% endif %} {% endblock %} {% block head %} + + + @@ -102,10 +111,6 @@ Color = Bulma Color Type of the Message Box @@ -38,7 +38,7 @@
- GitHub Actviity + GitHub Activity
@@ -49,30 +49,6 @@
- - {% for card in content %} -
- -
-
-
- {{ card.title }} -
-
-
-
- Picsum Picture -
-
-
-
- {{ card.text }} -
-
-
- -
- {% endfor %} {% endif %} diff --git a/app/templates/profile.html b/app/templates/profile.html index 769ecce..0cba42d 100644 --- a/app/templates/profile.html +++ b/app/templates/profile.html @@ -9,10 +9,57 @@
- {{ username }}'s Profile + {{ user.username }}'s Profile
+ +
+
+ +
+
+ + +
+
+ + {% if user.show_email or current_user.has_role('hidden') %} +
+
+ + +
+
+ {% endif %} + +
+
+ + +
+
+
+ +
+ +
+
+ +
+