{{ title }}
+ {% for category, msg in get_flashed_messages(True) %} +{{ msg }}
+ {% endfor %} {% block content %}{% endblock %}diff --git a/main.py b/main.py index 9532faa..eacc23a 100644 --- a/main.py +++ b/main.py @@ -46,9 +46,13 @@ def comment(comment_id): user_id = session.get('user_id') thread_id, parent_id, title, comments = db.get_subcomments(comment_id) comments = create_comment_tree(comments) + reply_comment, = comments + comments = reply_comment.children + reply_comment.children = [] return render_template( 'comments.html', title = title, + reply_comment = reply_comment, comments = comments, parent_id = parent_id, thread_id = thread_id, diff --git a/static/theme.css b/static/theme.css new file mode 100644 index 0000000..f76324d --- /dev/null +++ b/static/theme.css @@ -0,0 +1,91 @@ +body { + margin: 0; + font-family: sans-serif; + background-color: #f2f2e2; + margin-bottom: 30px; +} + +body > * { + padding-left: 1em; + padding-right: 1em; +} + +nav { + padding: 0; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + overflow-x: auto; + background-color: #ffca4b; +} + +nav > * { + margin-top: auto; + margin-bottom: auto; + padding: 20px; + color: black; +} + +main { + width: 80%; + margin: auto; +} + +a { + text-decoration: none; +} + +table { + border-collapse: collapse; + width: 100%; +} + +tr:not(:last-child) { + border-bottom: 1px solid; +} + +th, td { + padding: 5px; + text-align: left; +} + +textarea { + width: 50em; + height: 15em; + font-size: 1em; +} + +input[type=text] { + width: 50em; + font-family: monospace; + font-size: 1em; +} + +.logo { + margin: 0; + padding: 5px; + padding-left: 15px; + font-size: 3em; + font-weight: bold; +} + +table.form { + border-collapse: unset; + width: auto; +} + +table.form > * > tr > td, th { + vertical-align: top; +} + +.comment { + margin-left: 20px; + padding-left: 10px; + border-left: 1px dotted; +} + +.flash.success { + background-color: #ff4646; + border-radius: 5px; + padding: 8px; +} diff --git a/templates/base.html b/templates/base.html index 618d6b1..f444d8b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,23 +1,27 @@
{{ category}}: {{ msg }}
- {% endfor %}{{ msg }}
+ {% endfor %} {% block content %}{% endblock %}{{ comment.author }}
+{% macro render_comment_pre(comment) %} +reply +{{ render_comment_post(comment) }} +{% endmacro %} + {% macro reply() %} {% if 'user_id' in session %} {% endif %} {% endmacro %} diff --git a/templates/comments.html b/templates/comments.html index 731b2e6..9642482 100644 --- a/templates/comments.html +++ b/templates/comments.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% from 'comment.html' import render_comment, reply %} +{% from 'comment.html' import render_comment, render_comment_pre, render_comment_post, reply %} {% block content %} thread @@ -7,9 +7,14 @@ parent {% endif %} +{{ render_comment_pre(reply_comment) }} + {{ reply() }} {% for c in comments %} {{ render_comment(c) }} {% endfor %} + +{{ render_comment_post(reply_comment) }} + {% endblock %} diff --git a/templates/confirm_delete_thread.html b/templates/confirm_delete_thread.html index fc78442..47f69b3 100644 --- a/templates/confirm_delete_thread.html +++ b/templates/confirm_delete_thread.html @@ -2,10 +2,12 @@ {% block content %}Are you sure you want to delete "{{ thread_title }}"?
- - ++
+ + {% endblock %} diff --git a/templates/index.html b/templates/index.html index 962e8bc..71ad5c8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,9 +1,14 @@ {% extends 'base.html' %} {% block content %} -| Forum | +
|---|
| {{ name }} - {{ description }} | +
{{ description }}
-Create thread -| Topic | +
|---|
| {{ title }} | +
{{ author }} - rjgoire
+{{ author }}{{ text }}
{{ reply() }} diff --git a/templates/user_edit.html b/templates/user_edit.html index f32fd7d..73079d9 100644 --- a/templates/user_edit.html +++ b/templates/user_edit.html @@ -3,7 +3,7 @@ {% block content %} {% endblock %}
{{ comment.author }}
{{ comment.text }}
- reply +{% endmacro %} + +{% macro render_comment_post(comment) %} {% for c in comment.children %} {{ render_comment(c) }} {% endfor %}