added 404, removing profile, updated index with google analytics

This commit is contained in:
Xevion
2019-12-21 00:35:01 -06:00
parent 39d8eaf8d8
commit 5c4e5b9e46
5 changed files with 100 additions and 34 deletions

View File

@@ -107,8 +107,19 @@ def create_panzer(string):
@app.route('/profile/') @app.route('/profile/')
@login_required @login_required
def profile(): def default_profile():
return render_template('profile.html') return profile(current_user.username)
@app.route('/profile/<username>')
@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/') @app.route('/userinfo/')
@login_required @login_required
@@ -127,8 +138,18 @@ def user_info():
} }
return jsonify(prepare) return jsonify(prepare)
@app.route('/') @app.route('/')
def index(): def index():
jobs = [
'Student Photographer',
'Highschool Student',
'Web Developer',
'Python Developer',
'Software Engineer',
]
# content = [{'text': fake.paragraph(nb_sentences=15), # content = [{'text': fake.paragraph(nb_sentences=15),
# 'seed': random.randint(0, 1000), # 'seed': random.randint(0, 1000),
# 'title': fake.word().title()} # 'title': fake.word().title()}
@@ -137,7 +158,7 @@ def index():
'seed': random.randint(0, 1000), '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)'} '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)] 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']) @app.route('/register/', methods=['GET', 'POST'])
def register(): def register():

17
app/templates/404.html Normal file
View File

@@ -0,0 +1,17 @@
{% extends 'base.html' %}
{% block body %}
<!-- Hero Section -->
<section class="hero is-fullheight-with-navbar is-danger">
<div class="hero-body">
<div class="container has-text-centered">
<p class="title">
404
</p>
<p class="subtitle">
Content Not Found... <a href="{{ url_for('index') }}">Go home?</a>
</p>
</div>
</div>
</section>
<!-- End Hero Section -->
{% endblock body %}

View File

@@ -28,6 +28,15 @@ Color = Bulma Color Type of the Message Box
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block head %} {% block head %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-68895812-4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-68895812-4');
</script>
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}"> <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
@@ -102,10 +111,6 @@ Color = Bulma Color Type of the Message Box
<div class="navbar-dropdown"> <div class="navbar-dropdown">
{% if current_user.is_authenticated %} {% if current_user.is_authenticated %}
<a class="navbar-item" href="{{ url_for('profile') }}">
<span class="navbar-fa-icon fas fa-user"></span>
<div class="navbar-text">Profile</div>
</a>
<a class="navbar-item" href="{{ url_for('dashboard') }}"> <a class="navbar-item" href="{{ url_for('dashboard') }}">
<span class="navbar-fa-icon fas fa-chart-line"></span> <span class="navbar-fa-icon fas fa-chart-line"></span>
<div class="navbar-text">Dashboard</div> <div class="navbar-text">Dashboard</div>

View File

@@ -16,7 +16,7 @@
Xevion Xevion
</p> </p>
<p class="subtitle"> <p class="subtitle">
Python Developer {{ job }}
</p> </p>
</div> </div>
</div> </div>
@@ -38,7 +38,7 @@
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="card-header-title"> <div class="card-header-title">
GitHub Actviity GitHub Activity
</div> </div>
</div> </div>
<div class="card-content"> <div class="card-content">
@@ -49,30 +49,6 @@
</div> </div>
</div> </div>
<!-- End GitHub Activity Feed --> <!-- End GitHub Activity Feed -->
{% for card in content %}
<div class="column is-5">
<!-- Card -->
<div class="card">
<div class="card-header">
<div class="card-header-title">
{{ card.title }}
</div>
</div>
<div class="card-image">
<figure class="image">
<img src="https://picsum.photos/600/400/?random={{ card.seed }}" alt="Picsum Picture">
</figure>
</div>
<div class="card-content">
<div class="content word-break">
{{ card.text }}
</div>
</div>
</div>
<!-- Card End -->
</div>
{% endfor %}
</div> </div>
{% endif %} {% endif %}
</div> </section> </div> </section>

View File

@@ -9,10 +9,57 @@
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="card-header-title"> <div class="card-header-title">
{{ username }}'s Profile {{ user.username }}'s Profile
</div> </div>
</div> </div>
<div class="card-content"> <div class="card-content">
<div class="row align-items-center" style="margin-left: 0px; ">
<div class="form-group">
<!-- Username -->
<div class="row mt-4">
<div class="col-auto">
<label class="mb-1" style="width: 80px;">
Username
</label>
<label style="font-weight: bold;">
{{ user.username }}
</label>
</div>
</div>
{% if user.show_email or current_user.has_role('hidden') %}
<div class="row mt-3">
<div class="col-auto">
<label class="mb-1" style="width: 80px;">
Email
</label>
<label style="font-weight: bold;">
{{ user.email or '-' }}
</label>
</div>
</div>
{% endif %}
<div class="row mt-3">
<div class="col-auto">
<label class="mb-1" style="width: 80px;">
Phone
</label>
<label style="font-weight: bold;">
{{ user.phone_number or '-' }}
</label>
</div>
</div>
</div>
</div>
<div class="row align-items-center" style="margin-left: -10px; ">
<div class="col-auto">
</div>
</div>
</div> </div>
</div> </div>
</div> </div>