mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-02-16 19:02:40 +00:00
Work progress on conversation page
This commit is contained in:
parent
bca2e6449e
commit
bf00a52430
@ -12,4 +12,11 @@
|
|||||||
.big-box-conversation .right .direct-chat-text {
|
.big-box-conversation .right .direct-chat-text {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 10px;
|
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)
|
if(response.error)
|
||||||
return notify("Could not get the latest messages of the conversation!", "danger");
|
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
|
//Process the list of messages
|
||||||
response.forEach(function(message){
|
response.forEach(function(message){
|
||||||
ComunicWeb.pages.conversations.conversation.addMessage(message);
|
ComunicWeb.pages.conversations.conversation.addMessage(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -268,12 +271,54 @@ ComunicWeb.pages.conversations.conversation = {
|
|||||||
innerHTML: info.message
|
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)
|
//Apply user information (if available)
|
||||||
if(this._conv_info.users["user-" + info.ID_user]){
|
if(this._conv_info.users["user-" + info.ID_user]){
|
||||||
accountImage.src = this._conv_info.users["user-" + info.ID_user].accountImage;
|
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…
x
Reference in New Issue
Block a user