mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Improved connection between big and small conversation windows
This commit is contained in:
parent
30743601a9
commit
cd8280ae01
3
assets/custom_ts/Utils.d.ts
vendored
3
assets/custom_ts/Utils.d.ts
vendored
@ -24,7 +24,8 @@ declare interface CreateElem2Args {
|
||||
innerHTMLprefix ?: string,
|
||||
disabled ?: boolean,
|
||||
children ?: HTMLElement[],
|
||||
onclick ?: Function
|
||||
onclick ?: Function,
|
||||
ondblclick ?: Function
|
||||
}
|
||||
|
||||
declare function createElem(nodeType : string, appendTo : string) : HTMLElement;
|
||||
|
@ -145,11 +145,16 @@ function log(message){
|
||||
* Open a conversation specified by its ID
|
||||
*
|
||||
* @param {number} id The ID of the conversation to open
|
||||
* @param {bool} fullscreen Specify whether the conversation has to
|
||||
* appear in full screen or not
|
||||
*/
|
||||
function openConversation(id){
|
||||
ComunicWeb.components.conversations.manager.addConversation({
|
||||
conversationID: id
|
||||
});
|
||||
function openConversation(id, fullscreen = false){
|
||||
if(!fullscreen)
|
||||
ComunicWeb.components.conversations.manager.addConversation({
|
||||
conversationID: id
|
||||
});
|
||||
else
|
||||
openPage("conversations/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,6 +45,7 @@ function createElem(nodeType, appendTo){
|
||||
* @info {boolean} disabled Set whether the field should be disabled or not (input only)
|
||||
* @info {HTMLElement[]} children Children for the new object
|
||||
* @info {Function} onclick
|
||||
* @info {Function} ondblclick
|
||||
* @return {HTMLElement} The newly created element
|
||||
*/
|
||||
function createElem2(infos){
|
||||
@ -133,6 +134,9 @@ function createElem2(infos){
|
||||
if(infos.onclick)
|
||||
newElem.addEventListener("click", infos.onclick);
|
||||
|
||||
if(infos.ondblclick)
|
||||
newElem.addEventListener("dblclick", infos.ondblclick);
|
||||
|
||||
//Return newly created element
|
||||
return newElem;
|
||||
}
|
||||
|
@ -386,24 +386,32 @@ ComunicWeb.components.conversations.chatWindows = {
|
||||
* Change the name of the converation at the top of the windows
|
||||
*
|
||||
* @param {String} newName The new name for the conversation window
|
||||
* @param {Ojbect} infos Informations about the conversation window
|
||||
* @param {Ojbect} info Information about the conversation window
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
changeName: function(newName, infos){
|
||||
changeName: function(newName, info){
|
||||
|
||||
//Reduce new name
|
||||
if(newName.length > 18)
|
||||
newName = newName.slice(0, 17) + "...";
|
||||
|
||||
//Empty name field
|
||||
emptyElem(infos.boxTitle);
|
||||
emptyElem(info.boxTitle);
|
||||
|
||||
//Create conversation icon
|
||||
var conversationIcon = createElem("i", infos.boxTitle);
|
||||
conversationIcon.className = "fa fa-comments";
|
||||
createElem2({
|
||||
type: "i",
|
||||
appendTo: info.boxTitle,
|
||||
class: "fa fa-comments",
|
||||
ondblclick: () => {
|
||||
openConversation(info.conversationID, true);
|
||||
info.closeFunction();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Add conversation title
|
||||
var conversationTitle = createElem("span", infos.boxTitle);
|
||||
var conversationTitle = createElem("span", info.boxTitle);
|
||||
conversationTitle.innerHTML = " " + newName;
|
||||
|
||||
//Success
|
||||
|
@ -153,7 +153,7 @@ ComunicWeb.components.conversations.service = {
|
||||
for(i in result){
|
||||
|
||||
//Check if new entries are available
|
||||
if(result[i].length === 0)
|
||||
if(result[i].length === 0 || !this.__serviceCache[i])
|
||||
continue; //Nothing to be done
|
||||
|
||||
//Extract conversation ID
|
||||
|
@ -63,6 +63,15 @@ ComunicWeb.pages.conversations.conversation = {
|
||||
class: "box-header"
|
||||
});
|
||||
|
||||
// Box icon
|
||||
createElem2({
|
||||
appendTo: boxHeader,
|
||||
type: "span",
|
||||
class: "box-title",
|
||||
innerHTML: "<i class='fa fa-comments'></i> ",
|
||||
ondblclick: () => openConversation(convID, false)
|
||||
});
|
||||
|
||||
//Box title
|
||||
var boxTitle = createElem2({
|
||||
appendTo: boxHeader,
|
||||
|
Loading…
Reference in New Issue
Block a user