From e66b3b48d7cab08eb1f499fe3b00fb773ee7a28f Mon Sep 17 00:00:00 2001 From: "Saravanan, Mukesh (PG/T - Comp Sci & Elec Eng)" <ks01855@surrey.ac.uk> Date: Fri, 5 May 2023 09:42:18 +0000 Subject: [PATCH] Replace post.html --- .../application/templates/forum/post.html | 167 +++++++++--------- 1 file changed, 82 insertions(+), 85 deletions(-) diff --git a/frontend/application/templates/forum/post.html b/frontend/application/templates/forum/post.html index 1a55e31..f845e18 100644 --- a/frontend/application/templates/forum/post.html +++ b/frontend/application/templates/forum/post.html @@ -21,91 +21,7 @@ .tile__author { font-size: 16px; } -</style> - -<title>POST PAGE</title> -<a class="home-btn" href="{{ url_for('frontend.get_posts') }}">Home</a> -{% from 'macros.html' import displayField %} -{% include '_messages.html' %} - -<br> - - <!-- START posts --> -<div class="col-md-8"> - <div class="post-container" style="height: 400px; width: 100%; overflow: auto; - word-wrap: break-word; white-space: normal"> - <div class="tile__author"> - <img class="profile-image" src="images/users/{{ owner_image }}"> - <h2 ><a href="{{ url_for('frontend.display_user', user_id=post.user_id) }}">{{ post['user_name'] }}</a></h2> - </div> - <div class="tile__header"> - {{ post['title'] }} - </div> - <div class="tile__text"> - <p>{{ post['content'] | safe }}</p> - </div> - {% if post['image_url'] != '' %} - <img class="post-image" src="images/{{ post['image_url'] }}"> - {% endif %} - <p class="tile__date">{{ post['date_added'] }}</p> - {% if current_user_id == post['user_id'] %} - <div class="tile__buttons"> - <a class="tile__btn" href="{{ url_for('frontend.delete_post', post_id=post.id) }}">Delete Post</a> - </div> - {% endif %} - </div> - </div> - <!-- END posts --> - - <!-- START comments --> - - <div class="comment-container" style="overflow-y: auto; height: 600px; width: 100%"> - <h3 class="comment__title">COMMENTS</h3> - {% if comments %} - {% for comment, image in comments %} - <div class="comment__box{% if current_user_id == comment['user_id'] %} comment__box--self{% else %} comment__box--other{% endif %}"> - <div class="comment__author"> - <div class="comment__bubble{% if current_user_id == comment['user_id'] %} comment__bubble--self{% endif %}"> - <div class="comment__avatar{% if current_user_id == comment['user_id'] %} comment__avatar--self{% endif %}"> - {% if current_user_id != comment['user_id'] %} - <img class="user-image" src="images/users/{{ image }}"> - {% endif %} - </div> - {% if current_user_id != comment['user_id'] %} - <p class="comment__name">{{ comment['user_name']}}</p> - {% endif %} - <p class="comment__text">{{ comment['content'] | safe }}</p> - <div class="comment__date"> - <span>{{ comment['date_added'] }}</span> - {% if current_user_id == comment['user_id'] %} - <a class="comment__btn" href="{{ url_for('frontend.delete_comment', post_id=post.id, comment_id=comment.id) }}">Delete Comment</a> - {% endif %} - </div> - </div> - </div> - </div> - {% endfor %} - {% endif %} - <div class="comment__form-container"> - <form class="comment__form" action="" method="POST"> - {{ form.csrf_token }} - {{ displayField(form.content, 'Type comment here...') }} - <button class="btn btn--solid post-btn" type="submit">SUBMIT</button> - </form> - {{ ckeditor.load(pkg_type="basic") }} - {{ ckeditor.config(name='content') }} - </div> - </div> - </div> -</div> - -<!-- END comments --> - - - -</div> -<style> - .latest { +.latest { padding: 40px 0; } @@ -230,3 +146,84 @@ font-size: 16px; cursor: pointer; margin-bottom: 20px; +} +</style> + +<title>POST PAGE</title> +<a class="home-btn" href="{{ url_for('frontend.get_posts') }}">Home</a> +{% from 'macros.html' import displayField %} +{% include '_messages.html' %} + +<br> + + <!-- START posts --> +<div class="col-md-8"> + <div class="post-container" style="height: 400px; width: 100%; overflow: auto; + word-wrap: break-word; white-space: normal"> + <div class="tile__author"> + <img class="profile-image" src="images/users/{{ owner_image }}"> + <h2 ><a href="{{ url_for('frontend.display_user', user_id=post.user_id) }}">{{ post['user_name'] }}</a></h2> + </div> + <div class="tile__header"> + {{ post['title'] }} + </div> + <div class="tile__text"> + <p>{{ post['content'] | safe }}</p> + </div> + {% if post['image_url'] != '' %} + <img class="post-image" src="images/{{ post['image_url'] }}"> + {% endif %} + <p class="tile__date">{{ post['date_added'] }}</p> + {% if current_user_id == post['user_id'] %} + <div class="tile__buttons"> + <a class="tile__btn" href="{{ url_for('frontend.delete_post', post_id=post.id) }}">Delete Post</a> + </div> + {% endif %} + </div> + </div> + <!-- END posts --> + + <!-- START comments --> + + <div class="comment-container" style="overflow-y: auto; height: 600px; width: 100%"> + <h3 class="comment__title">COMMENTS</h3> + {% if comments %} + {% for comment, image in comments %} + <div class="comment__box{% if current_user_id == comment['user_id'] %} comment__box--self{% else %} comment__box--other{% endif %}"> + <div class="comment__author"> + <div class="comment__bubble{% if current_user_id == comment['user_id'] %} comment__bubble--self{% endif %}"> + <div class="comment__avatar{% if current_user_id == comment['user_id'] %} comment__avatar--self{% endif %}"> + {% if current_user_id != comment['user_id'] %} + <img class="user-image" src="images/users/{{ image }}"> + {% endif %} + </div> + {% if current_user_id != comment['user_id'] %} + <p class="comment__name">{{ comment['user_name']}}</p> + {% endif %} + <p class="comment__text">{{ comment['content'] | safe }}</p> + <div class="comment__date"> + <span>{{ comment['date_added'] }}</span> + {% if current_user_id == comment['user_id'] %} + <a class="comment__btn" href="{{ url_for('frontend.delete_comment', post_id=post.id, comment_id=comment.id) }}">Delete Comment</a> + {% endif %} + </div> + </div> + </div> + </div> + {% endfor %} + {% endif %} + <div class="comment__form-container"> + <form class="comment__form" action="" method="POST"> + {{ form.csrf_token }} + {{ displayField(form.content, 'Type comment here...') }} + <button class="btn btn--solid post-btn" type="submit">SUBMIT</button> + </form> + {{ ckeditor.load(pkg_type="basic") }} + {{ ckeditor.config(name='content') }} + </div> + </div> + </div> +</div> + + + \ No newline at end of file -- GitLab