diff --git a/.gitignore b/.gitignore index 9fe92d2..8b502d0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ __pycache__ docker-compose.yaml *.sh +*.ini # Ignore images in posts *.jpg diff --git a/app/app.py b/app/app.py index 3492a78..c5509d4 100644 --- a/app/app.py +++ b/app/app.py @@ -3,13 +3,19 @@ import configparser import random import flask +import flask_wtf.csrf +import flask_session import waitress import markdown from post import Post +import comment app = flask.Flask(__name__, static_url_path='', static_folder='static') +csrf = flask_wtf.csrf.CSRFProtect() +csrf.init_app(app) + CONFIG_PATH = "./config.ini" config = configparser.ConfigParser() config.read(CONFIG_PATH) @@ -66,14 +72,20 @@ def index(): # Get posts posts = get_posts() - post_bodies = [] + # Get Comments + comments = [] + + posts_and_comments = [] for post in posts: - post_bodies.append(post.body) + posts_and_comments.append((post.body, comments)) # Get status status = get_status() - return flask.render_template('index.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) # Games Page @app.route('/games/') diff --git a/app/comment.py b/app/comment.py new file mode 100644 index 0000000..9b5d3b1 --- /dev/null +++ b/app/comment.py @@ -0,0 +1,14 @@ +import flask +import flask_session +import flask_wtf +import wtforms + + + + +class CommentForm(flask_wtf.FlaskForm): + textbox = wtforms.TextAreaField() + + + + diff --git a/app/config.ini b/app/config.ini deleted file mode 100644 index 8d00b71..0000000 --- a/app/config.ini +++ /dev/null @@ -1,9 +0,0 @@ -[POSTS] -posts_folder=./posts - -[STATUS] -status_file=./resources/status.text - -[NETWORK] -PORT=1111 -DEV=0 diff --git a/app/static/style.css b/app/static/style.css index 3ba8574..3d83e15 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -172,3 +172,26 @@ a:hover { line-height: 2.25; text-indent: 3em; } + +.comment-container { + background-color: var(--primary40); + border-style: var(--borders-style); + border-radius: var(--border-radius); + + padding: 1em; + margin: 1em; +} + +.comment-editor input { + width: 100%; + padding: 3em 0; + line-height: 140%; + + border-style: solid; + /* border-color: var(--secondary50); */ + border-radius: var(--border-radius); +} + +.comment-editor input:focus { + border: 3px solid var(--accent); +} diff --git a/app/templates/index.html b/app/templates/index.html index a5bfb0c..21daca3 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -25,7 +25,24 @@
{{ user }}
+ +