mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Work progress on conversation page
This commit is contained in:
parent
bca2e6449e
commit
bf00a52430
@ -13,3 +13,10 @@
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.big-box-conversation .direct-chat-text .message-img {
|
||||
max-width: 100%;
|
||||
max-height: 200px;
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
@ -177,13 +177,16 @@ ComunicWeb.pages.conversations.conversation = {
|
||||
if(response.error)
|
||||
return notify("Could not get the latest messages of the conversation!", "danger");
|
||||
|
||||
//Check if there are responses to process
|
||||
if(response.length == 0)
|
||||
return; //Do not process messages list (avoid unwanted scrolling)
|
||||
|
||||
//Process the list of messages
|
||||
response.forEach(function(message){
|
||||
ComunicWeb.pages.conversations.conversation.addMessage(message);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@ -268,12 +271,54 @@ ComunicWeb.pages.conversations.conversation = {
|
||||
innerHTML: info.message
|
||||
});
|
||||
|
||||
//Parse message content
|
||||
ComunicWeb.components.textParser.parse({
|
||||
element: messageContent
|
||||
});
|
||||
|
||||
//Message image (if any)
|
||||
if(info.image_path != null){
|
||||
|
||||
//Image link
|
||||
var imageLink = createElem2({
|
||||
appendTo: messageContentContainer,
|
||||
type: "a",
|
||||
href: info.image_path
|
||||
});
|
||||
|
||||
//Apply image
|
||||
createElem2({
|
||||
appendTo: imageLink,
|
||||
type: "img",
|
||||
class: "message-img",
|
||||
src: info.image_path
|
||||
});
|
||||
|
||||
imageLink.onclick = function(){
|
||||
$(this).ekkoLightbox({
|
||||
alwaysShowClose: true,
|
||||
});
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
//Apply user information (if available)
|
||||
if(this._conv_info.users["user-" + info.ID_user]){
|
||||
accountImage.src = this._conv_info.users["user-" + info.ID_user].accountImage;
|
||||
nameContainer = userFullName(this._conv_info.users["user-" + info.ID_user]);
|
||||
nameContainer.innerHTML = userFullName(this._conv_info.users["user-" + info.ID_user]);
|
||||
}
|
||||
|
||||
//Set a timeout to make slimscroll properly work
|
||||
setTimeout(function(){
|
||||
|
||||
//Enable / update slimscroll
|
||||
var target = ComunicWeb.pages.conversations.conversation._conv_info.window.messagesTarget;
|
||||
var scrollBottom = $(target).prop("scrollHeight")+"px";
|
||||
$(target).slimScroll({
|
||||
scrollTo: scrollBottom
|
||||
});
|
||||
|
||||
}, 100);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user