mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 18:08:50 +00:00
Display conversations in the sidebar
This commit is contained in:
parent
b07ae2ee39
commit
20cd132e90
@ -85,6 +85,24 @@ body.sidebar-collapse .sidebar-menu {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Conversations entries
|
||||
*/
|
||||
|
||||
.main-sidebar .memberships-list .conversation_memberhsip a {
|
||||
padding: 5px 5px 5px 15px;
|
||||
}
|
||||
|
||||
.main-sidebar .memberships-list .conversation_memberhsip span {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.main-sidebar .memberships-list .conversation_memberhsip .subinfo {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
|
||||
body.sidebar-collapse .main-sidebar .memberships-list .subinfo {
|
||||
display: none;
|
||||
}
|
||||
@ -102,7 +120,6 @@ body.sidebar-collapse .main-sidebar .memberships-list li:hover .subinfo {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Conversations
|
||||
*/
|
||||
|
@ -322,7 +322,7 @@ ComunicWeb.components.sideBar.main = {
|
||||
* @param {*} memberships
|
||||
* @param {*} users
|
||||
* @param {*} groups
|
||||
* @param {*} convs
|
||||
* @param {Map<number, String>} convs
|
||||
*/
|
||||
applyMemberships: function(target, memberships, users, groups, convs) {
|
||||
|
||||
@ -342,6 +342,9 @@ ComunicWeb.components.sideBar.main = {
|
||||
|
||||
if(e.type == "group")
|
||||
this.applyGroup(friendsTarget, groups.get(e.id), e.last_activity);
|
||||
|
||||
if(e.type == "conversation")
|
||||
this.applyConversation(friendsTarget, e.conv, convs.get(e.conv.ID));
|
||||
});
|
||||
|
||||
createElem2({
|
||||
@ -512,4 +515,48 @@ ComunicWeb.components.sideBar.main = {
|
||||
subInfoEl.innerHTML = timeDiffToStr(lastactive);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Apply a conversation
|
||||
*
|
||||
* @param {HTMLElement} target
|
||||
* @param {Array<any>} conv
|
||||
* @param {String} name
|
||||
*/
|
||||
applyConversation: function(target, conv, name) {
|
||||
|
||||
let li = createElem2({
|
||||
appendTo: target,
|
||||
type: "li",
|
||||
class: "conversation_memberhsip"
|
||||
});
|
||||
|
||||
let a = createElem2({
|
||||
appendTo: li,
|
||||
type: "a",
|
||||
onclick: () => alert("implement me") // TODO implement
|
||||
});
|
||||
|
||||
// Icon
|
||||
createElem2({
|
||||
appendTo: a,
|
||||
type: "i",
|
||||
class: "fa fa-comments"
|
||||
});
|
||||
|
||||
// Conversation name
|
||||
createElem2({
|
||||
appendTo: a,
|
||||
type: "span",
|
||||
innerHTML: name
|
||||
});
|
||||
|
||||
let subInfoEl = createElem2({
|
||||
appendTo: a,
|
||||
type: "div",
|
||||
class: "subinfo",
|
||||
innerHTML: timeDiffToStr(conv.last_active)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user