consolidated some pages
This commit is contained in:
parent
8d49357074
commit
724e0ac3d9
48
app/app.py
48
app/app.py
@ -139,7 +139,7 @@ def index():
|
|||||||
# Setup Comment Form
|
# Setup Comment Form
|
||||||
form = comment.CommentForm()
|
form = comment.CommentForm()
|
||||||
|
|
||||||
return flask.render_template('index.html', posts=posts_and_comments, status=status, form=form, user=user)
|
return flask.render_template('index.html', posts=posts_and_comments, status=status, form=form, user=user, title='0x01fe.net')
|
||||||
|
|
||||||
# Posts
|
# Posts
|
||||||
@app.route('/post/<string:post_name>')
|
@app.route('/post/<string:post_name>')
|
||||||
@ -157,25 +157,41 @@ def post(post_name: str):
|
|||||||
# Setup Comment Form
|
# Setup Comment Form
|
||||||
form = comment.CommentForm()
|
form = comment.CommentForm()
|
||||||
|
|
||||||
return flask.render_template('index.html', posts=[[{'body': post.body, 'title': post.title}, comments]], status=get_status(), form=form, user=user)
|
return flask.render_template('index.html', posts=[[{'body': post.body, 'title': post.title}, comments]], status=get_status(), form=form, user=user, title='0x01fe.net')
|
||||||
|
|
||||||
flask.abort(404)
|
flask.abort(404)
|
||||||
|
|
||||||
# Games Page
|
# Games Page
|
||||||
@app.route('/games/')
|
@app.route('/category/<string:category>/')
|
||||||
def games():
|
def category_filter(category: str):
|
||||||
|
|
||||||
# Get posts
|
# Get posts
|
||||||
posts = get_posts(category_filter="games")
|
posts = get_posts(category_filter=category)
|
||||||
|
|
||||||
post_bodies = []
|
if 'username' in flask.session:
|
||||||
|
user = flask.session['username']
|
||||||
|
else:
|
||||||
|
user = 'Anon'
|
||||||
|
|
||||||
|
# Get Comments
|
||||||
|
posts_and_comments = []
|
||||||
for post in posts:
|
for post in posts:
|
||||||
post_bodies.append(post.body)
|
|
||||||
|
comments = comment.get_comments(post.title)
|
||||||
|
posts_and_comments.append(({
|
||||||
|
"body" : post.body,
|
||||||
|
"title" : post.title,
|
||||||
|
"date" : post.get_date()
|
||||||
|
},
|
||||||
|
comments))
|
||||||
|
|
||||||
# Get status
|
# Get status
|
||||||
status = get_status()
|
status = get_status()
|
||||||
|
|
||||||
return flask.render_template('games.html', posts=post_bodies, status=status)
|
# Setup Comment Form
|
||||||
|
form = comment.CommentForm()
|
||||||
|
|
||||||
|
return flask.render_template('index.html', posts=posts_and_comments, status=status, form=form, user=user, title=category.replace('-', ' '))
|
||||||
|
|
||||||
# Music Page
|
# Music Page
|
||||||
@app.route('/music/')
|
@app.route('/music/')
|
||||||
@ -211,22 +227,6 @@ def music():
|
|||||||
|
|
||||||
return flask.render_template('music.html', posts=post_bodies, status=status, top_albums=top_albums)
|
return flask.render_template('music.html', posts=post_bodies, status=status, top_albums=top_albums)
|
||||||
|
|
||||||
# Motion Pictures Page
|
|
||||||
@app.route('/motion-pictures/')
|
|
||||||
def motion_pictures():
|
|
||||||
|
|
||||||
# Get posts
|
|
||||||
posts = get_posts(category_filter="motion-pictures")
|
|
||||||
|
|
||||||
post_bodies = []
|
|
||||||
for post in posts:
|
|
||||||
post_bodies.append(post.body)
|
|
||||||
|
|
||||||
# Get status
|
|
||||||
status = get_status()
|
|
||||||
|
|
||||||
return flask.render_template('motion-pictures.html', posts=post_bodies, status=status)
|
|
||||||
|
|
||||||
# Programming Page
|
# Programming Page
|
||||||
@app.route('/programming/')
|
@app.route('/programming/')
|
||||||
def programming():
|
def programming():
|
||||||
|
|||||||
@ -13,13 +13,13 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Sidebar -->
|
<!-- Sidebar -->
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<a href="/">Home</a><br>
|
<a href="/"><u>Home</u></a><br>
|
||||||
<a href="/games/">Games</a><br>
|
<a href="/category/games/">Games</a><br>
|
||||||
<a href="/music/">Music</a><br>
|
<a href="/music/">Music</a><br>
|
||||||
<a href="/motion-pictures/">Motion Picture</a><br>
|
<a href="/category/motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="/programming/">Programming</a><br>
|
<a href="/programming/">Programming</a><br>
|
||||||
<a href="/writing/">Writing</a><br>
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="."><u>About</u></a><br>
|
<a href="/about/">About</a><br>
|
||||||
<a href="/login/">Login</a>
|
<a href="/login/">Login</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,35 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<header>
|
|
||||||
<link rel="shortcut icon" href="index_favicon.ico">
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
|
||||||
<title>0x01fe.net - Games</title>
|
|
||||||
</header>
|
|
||||||
<body>
|
|
||||||
<div class="header">
|
|
||||||
<h1>Games</h1>
|
|
||||||
{{ status|safe }}
|
|
||||||
</div>
|
|
||||||
<div class="container">
|
|
||||||
<!-- Sidebar -->
|
|
||||||
<div class="sidebar">
|
|
||||||
<a href="/">Home</a><br>
|
|
||||||
<a href="."><u>Games</u></a><br>
|
|
||||||
<a href="/music/">Music</a><br>
|
|
||||||
<a href="/motion-pictures/">Motion Picture</a><br>
|
|
||||||
<a href="/programming/">Programming</a><br>
|
|
||||||
<a href="/writing/">Writing</a><br>
|
|
||||||
<a href="/about/">About</a><br>
|
|
||||||
<a href="/login/">Login</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Main Page -->
|
|
||||||
<!-- Get it? D-Log? Like digital log? -->
|
|
||||||
<div class="dlog">
|
|
||||||
{% for post in posts %}
|
|
||||||
<div class="post">{{ post|safe }}</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -3,20 +3,20 @@
|
|||||||
<header>
|
<header>
|
||||||
<link rel="shortcut icon" href="index_favicon.ico">
|
<link rel="shortcut icon" href="index_favicon.ico">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
<title>0x01fe.net</title>
|
<title>0x01fe.net - {{ title }}</title>
|
||||||
</header>
|
</header>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>0x01fe.net</h1>
|
<h1>{{ title }}</h1>
|
||||||
{{ status|safe }}
|
{{ status|safe }}
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Sidebar -->
|
<!-- Sidebar -->
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<a href="/"><u>Home</u></a><br>
|
<a href="/"><u>Home</u></a><br>
|
||||||
<a href="/games/">Games</a><br>
|
<a href="/category/games/">Games</a><br>
|
||||||
<a href="/music/">Music</a><br>
|
<a href="/music/">Music</a><br>
|
||||||
<a href="/motion-pictures/">Motion Picture</a><br>
|
<a href="/category/motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="/programming/">Programming</a><br>
|
<a href="/programming/">Programming</a><br>
|
||||||
<a href="/writing/">Writing</a><br>
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="/about/">About</a><br>
|
<a href="/about/">About</a><br>
|
||||||
|
|||||||
@ -1,35 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<header>
|
|
||||||
<link rel="shortcut icon" href="index_favicon.ico">
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
|
||||||
<title>0x01fe.net - Motion Pictures</title>
|
|
||||||
</header>
|
|
||||||
<body>
|
|
||||||
<div class="header">
|
|
||||||
<h1>Motion Pictures</h1>
|
|
||||||
{{ status|safe }}
|
|
||||||
</div>
|
|
||||||
<div class="container">
|
|
||||||
<!-- Sidebar -->
|
|
||||||
<div class="sidebar">
|
|
||||||
<a href="/">Home</a><br>
|
|
||||||
<a href="/games/">Games</a><br>
|
|
||||||
<a href="/music/">Music</a><br>
|
|
||||||
<a href="."><u>Motion Picture</u></a><br>
|
|
||||||
<a href="/programming/">Programming</a><br>
|
|
||||||
<a href="/writing/">Writing</a><br>
|
|
||||||
<a href="/about/">About</a><br>
|
|
||||||
<a href="/login/">Login</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Main Page -->
|
|
||||||
<!-- Get it? D-Log? Like digital log? -->
|
|
||||||
<div class="dlog">
|
|
||||||
{% for post in posts %}
|
|
||||||
<div class="post">{{ post|safe }}</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -13,10 +13,10 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Sidebar -->
|
<!-- Sidebar -->
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<a href="/">Home</a><br>
|
<a href="/"><u>Home</u></a><br>
|
||||||
<a href="/games/">Games</a><br>
|
<a href="/category/games/">Games</a><br>
|
||||||
<a href="."><u>Music</u></a><br>
|
<a href="/music/">Music</a><br>
|
||||||
<a href="/motion-pictures/">Motion Picture</a><br>
|
<a href="/category/motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="/programming/">Programming</a><br>
|
<a href="/programming/">Programming</a><br>
|
||||||
<a href="/writing/">Writing</a><br>
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="/about/">About</a><br>
|
<a href="/about/">About</a><br>
|
||||||
@ -27,7 +27,31 @@
|
|||||||
<!-- Get it? D-Log? Like digital log? -->
|
<!-- Get it? D-Log? Like digital log? -->
|
||||||
<div class="dlog">
|
<div class="dlog">
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
<div class="post">{{ post|safe }}</div>
|
<div class="post">
|
||||||
|
<div class="post-date">
|
||||||
|
{{ post[0].date }}
|
||||||
|
</div>
|
||||||
|
{{ post[0].body|safe }}
|
||||||
|
<div class="comment-container">
|
||||||
|
<h2>Comments</h2>
|
||||||
|
{% for comment in post[1] %}
|
||||||
|
<div class="comment">
|
||||||
|
<h4>{{ comment.username }}</h4>
|
||||||
|
<p>{{ comment.content }}</p>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% if user %}
|
||||||
|
<div class="comment-editor">
|
||||||
|
<h4>{{ user }}</h4>
|
||||||
|
<form method="post" action="/comment/{{ post[0].title }}">
|
||||||
|
{{ form.hidden_tag() }}
|
||||||
|
{{ form.textbox }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -13,11 +13,11 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Sidebar -->
|
<!-- Sidebar -->
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<a href="/">Home</a><br>
|
<a href="/"><u>Home</u></a><br>
|
||||||
<a href="/games/">Games</a><br>
|
<a href="/category/games/">Games</a><br>
|
||||||
<a href="/music/">Music</a><br>
|
<a href="/music/">Music</a><br>
|
||||||
<a href="/motion-pictures/">Motion Picture</a><br>
|
<a href="/category/motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="."><u>Programming</u></a><br>
|
<a href="/programming/">Programming</a><br>
|
||||||
<a href="/writing/">Writing</a><br>
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="/about/">About</a><br>
|
<a href="/about/">About</a><br>
|
||||||
<a href="/login/">Login</a>
|
<a href="/login/">Login</a>
|
||||||
@ -27,7 +27,31 @@
|
|||||||
<!-- Get it? D-Log? Like digital log? -->
|
<!-- Get it? D-Log? Like digital log? -->
|
||||||
<div class="dlog">
|
<div class="dlog">
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
<div class="post">{{ post|safe }}</div>
|
<div class="post">
|
||||||
|
<div class="post-date">
|
||||||
|
{{ post[0].date }}
|
||||||
|
</div>
|
||||||
|
{{ post[0].body|safe }}
|
||||||
|
<div class="comment-container">
|
||||||
|
<h2>Comments</h2>
|
||||||
|
{% for comment in post[1] %}
|
||||||
|
<div class="comment">
|
||||||
|
<h4>{{ comment.username }}</h4>
|
||||||
|
<p>{{ comment.content }}</p>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% if user %}
|
||||||
|
<div class="comment-editor">
|
||||||
|
<h4>{{ user }}</h4>
|
||||||
|
<form method="post" action="/comment/{{ post[0].title }}">
|
||||||
|
{{ form.hidden_tag() }}
|
||||||
|
{{ form.textbox }}
|
||||||
|
<input type="submit" value="Save">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user