Added all conversation messages

This commit is contained in:
Pierre HUBERT 2019-01-15 07:32:07 +01:00
parent f9c1f37ac6
commit 4d775494c0
4 changed files with 70 additions and 1 deletions

View File

@ -196,8 +196,28 @@
</div>
<!-- Entire list of conversation messages -->
<div id="all-conversations-message" class="category container">
Loading all conversation messages
<h1>All your conversation messages</h1>
<table id="all-conversation-messages-table">
<thead>
<tr>
<th>Number</th>
<th>Date</th>
<th>Message</th>
<th>Image</th>
</tr>
</thead>
<tbody>
<!-- Conversation messages will go here -->
</tbody>
</table>
</div>
<div id="conversations" class="category container">
@ -217,6 +237,7 @@
<script src="assets/js/categories/likes.js"></script>
<script src="assets/js/categories/survey.js"></script>
<script src="assets/js/categories/movies.js"></script>
<script src="assets/js/categories/allConversationMessages.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>

View File

@ -99,4 +99,13 @@ h1 {
#all-comments-table .comment-img {
width: 100%;
max-width: 350px;
}
/**
* All conversation messages rules
*/
#all-conversation-messages-table .conversation-img {
width: 100%;
max-width: 300px;
}

View File

@ -0,0 +1,38 @@
/**
* All conversation messages category
*
* @author Pierre HUBERT
*/
/**
* Apply the entire list of conversation messages of the user
*/
function ApplyAllConversationMessages(){
let target = document.querySelector("#all-conversation-messages-table tbody");
data.all_conversation_messages.forEach(message => {
let messageEl = createElem2({
appendTo: target,
type: "tr",
innerHTML:
"<td>" + message.ID + "</td>" +
"<td>" + timeToStr(message.time_insert) + "</td>" +
"<td>" + message.message + "</td>"
});
//Add conversation image (if any)
if(message.image_path != null){
let imageElem = createElem2({
appendTo: messageEl,
type: "img",
class: "conversation-img"
});
applyURLToImage(imageElem, message.image_path);
}
});
}

View File

@ -80,6 +80,7 @@ xhr.onload = function(){
ApplyUserLikes();
ApplySurveyResponses();
ApplyMovies();
ApplyAllConversationMessages();
}
xhr.send(null);