mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Display all comments
This commit is contained in:
parent
59e6eb3c30
commit
b48b6db028
@ -88,8 +88,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Full comments list -->
|
||||||
<div id="comments" class="category container">
|
<div id="comments" class="category container">
|
||||||
Loading comments
|
|
||||||
|
<h1>All your comments</h1>
|
||||||
|
|
||||||
|
<table id="all-comments-table">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Number</th>
|
||||||
|
<th>Post ID</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Content</th>
|
||||||
|
<th>Image</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<!-- Comments will go here -->
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="likes" class="category container">
|
<div id="likes" class="category container">
|
||||||
@ -121,6 +142,7 @@
|
|||||||
<script src="assets/js/categories/userInfo.js"></script>
|
<script src="assets/js/categories/userInfo.js"></script>
|
||||||
<script src="assets/js/categories/friends.js"></script>
|
<script src="assets/js/categories/friends.js"></script>
|
||||||
<script src="assets/js/categories/posts.js"></script>
|
<script src="assets/js/categories/posts.js"></script>
|
||||||
|
<script src="assets/js/categories/comments.js"></script>
|
||||||
<script src="assets/js/main.js"></script>
|
<script src="assets/js/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -90,4 +90,13 @@ h1 {
|
|||||||
|
|
||||||
.post .post-end-countdown {
|
.post .post-end-countdown {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comments rules
|
||||||
|
*/
|
||||||
|
#all-comments-table .comment-img {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 350px;
|
||||||
}
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* Comments category
|
||||||
|
*
|
||||||
|
* @author Pierre HUBERT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply full comments list
|
||||||
|
*/
|
||||||
|
function ApplyCommentsList() {
|
||||||
|
|
||||||
|
let target = document.querySelector("#all-comments-table tbody");
|
||||||
|
|
||||||
|
data.comments.forEach(comment => {
|
||||||
|
|
||||||
|
let commentEl = createElem2({
|
||||||
|
appendTo: target,
|
||||||
|
type: "tr",
|
||||||
|
innerHTML:
|
||||||
|
"<td>"+comment.ID+"</td>" +
|
||||||
|
"<td>"+comment.postID+"</td>" +
|
||||||
|
"<td>"+timeToStr(comment.time_sent)+"</td>" +
|
||||||
|
"<td>"+comment.content+"</td>"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if(comment.img_path != null){
|
||||||
|
|
||||||
|
let imageContainer = createElem2({
|
||||||
|
appendTo: commentEl,
|
||||||
|
type: "td"
|
||||||
|
});
|
||||||
|
|
||||||
|
let imageElem = createElem2({
|
||||||
|
appendTo: imageContainer,
|
||||||
|
type: "img",
|
||||||
|
class: "comment-img"
|
||||||
|
});
|
||||||
|
|
||||||
|
applyURLToImage(imageElem, comment.img_url);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
@ -76,6 +76,7 @@ xhr.onload = function(){
|
|||||||
ApplyUserInfo();
|
ApplyUserInfo();
|
||||||
ApplyFriendsList();
|
ApplyFriendsList();
|
||||||
ApplyPosts();
|
ApplyPosts();
|
||||||
|
ApplyCommentsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
xhr.send(null);
|
xhr.send(null);
|
Loading…
Reference in New Issue
Block a user