-
Notifications
You must be signed in to change notification settings - Fork 4
/
post.html
122 lines (118 loc) · 5.45 KB
/
post.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{% import "bootstrap/wtf.html" as wtf %}
{% include "header.html" %}
<!-- PAGE HEADER -->
<header class="masthead" style="background-image: url('{{ post.img_url }}')">
<div class="overlay"></div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="post-heading">
<h1>{{ post.title }}</h1>
<h2 class="subheading">{{ post.subtitle }}</h2>
<span class="meta">Posted by {{ post.author }} on {{ post.date }}</span>
</div>
</div>
</div>
</div>
</header>
<!-- POST CONTENT -->
<article>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
{{ post.body|safe }}
<hr>
{% if session.user == post.author %}
<div class="clearfix mb-5">
<button type="button" class="btn btn-outline-danger float-right" data-toggle="modal"
data-target="#delete{{ post._id }}">
Delete Post
</button>
<!-- Modal -->
<div class="modal fade" id="delete{{ post._id }}" tabindex="-1" role="dialog"
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Are you sure you want to
delete this post?
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close
</button>
<a class="btn btn-outline-danger btn-sm"
href="{{ url_for('delete_post', post_id=post._id) }}">Delete Post
</a>
</div>
</div>
</div>
</div>
<a class="btn btn-outline-secondary float-left"
href="{{ url_for('edit_post', post_id=post._id) }}">Edit Post</a>
</div>
{% endif %}
<!-- COMMENTS AREA -->
{% if session.user %}
{{ ckeditor.load() }}
{{ ckeditor.config(name='comment_text') }}
{{ wtf.quick_form(form, novalidate=True, button_map={"submit": "success"}) }}
{% endif %}
<div class="col-lg-8 col-md-10 mx-auto comment">
{% for comment in comments: %}
<ul class="commentList">
<li>
<div class="commenterImage">
<i class="far fa-user"></i>
</div>
<div class="commentText">
{{comment.text|safe}}
<span class="date sub-text">Posted by {{comment.comment_author}}</span>
{% if session.user == comment.comment_author %}
<button type="button" class="btn btn-outline-danger" data-toggle="modal"
data-target="#deletecomment{{ post._id }}">
Delete Comment
</button>
<!-- MODAL -->
<div class="modal fade" id="deletecomment{{ post._id }}" tabindex="-1" role="dialog"
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampModalLongTitle">Are you sure you want
to
delete this comment?
</h5>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<a class="btn btn-outline-danger"
href="{{ url_for('delete_comment', comment_id=comment._id, post_id=post._id) }}">Delete
Comment
</a>
</div>
</div>
</div>
</div>
{% endif %}
</div>
</li>
</ul>
{% endfor %}
</div>
</div>
</div>
</div>
</article>
<br>
<hr>
{% include "footer.html" %}