mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Show call button on conversation of two people when available
This commit is contained in:
parent
feb17e3f13
commit
cd4e6ddcb1
@ -4,6 +4,10 @@
|
|||||||
* @author Pierre HUBERT
|
* @author Pierre HUBERT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main definition
|
||||||
|
*/
|
||||||
#conversationsElem .box {
|
#conversationsElem .box {
|
||||||
width: 250px;
|
width: 250px;
|
||||||
height: 350px;
|
height: 350px;
|
||||||
@ -15,6 +19,10 @@
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#conversationsElem .chat-window .box-title {
|
||||||
|
font-size: 15px !important;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conversations create message form
|
* Conversations create message form
|
||||||
*/
|
*/
|
||||||
|
@ -42,6 +42,29 @@ ComunicWeb.components.calls.controller = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access calls configuration
|
||||||
|
*
|
||||||
|
* @return Cached calls configuration
|
||||||
|
*/
|
||||||
|
getConfig() {
|
||||||
|
return ComunicWeb.components.calls.__config;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the call feature is available or not
|
||||||
|
*/
|
||||||
|
isAvailable: function(){
|
||||||
|
|
||||||
|
//If do not have any call configuration, it is not possible to
|
||||||
|
//make calls
|
||||||
|
if(this.getConfig() == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Read configuration
|
||||||
|
return this.getConfig().enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -56,7 +56,7 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
infosBox.conversationID = infos.conversationID;
|
infosBox.conversationID = infos.conversationID;
|
||||||
|
|
||||||
//Change box root class name
|
//Change box root class name
|
||||||
infosBox.rootElem.className += " direct-chat direct-chat-primary";
|
infosBox.rootElem.className += " chat-window direct-chat direct-chat-primary";
|
||||||
|
|
||||||
//Adapt close button behaviour
|
//Adapt close button behaviour
|
||||||
infosBox.closeFunction = function(){
|
infosBox.closeFunction = function(){
|
||||||
@ -84,18 +84,21 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Add button to get conversation members
|
//Add button to get conversation members
|
||||||
infosBox.membersButton = createElem("button");
|
infosBox.membersButton = createElem2({
|
||||||
infosBox.closeButton.parentNode.insertBefore(infosBox.membersButton, infosBox.closeButton);
|
type: "button",
|
||||||
infosBox.membersButton.type = "button";
|
insertBefore: infosBox.closeButton,
|
||||||
infosBox.membersButton.className = "btn btn-box-tool";
|
elemType: "button",
|
||||||
|
class: "btn btn-box-tool",
|
||||||
|
title: "Conversation members"
|
||||||
|
});
|
||||||
infosBox.membersButton.setAttribute("data-toggle", "tooltip");
|
infosBox.membersButton.setAttribute("data-toggle", "tooltip");
|
||||||
infosBox.membersButton.setAttribute("data-widget", "chat-pane-toggle");
|
infosBox.membersButton.setAttribute("data-widget", "chat-pane-toggle");
|
||||||
infosBox.membersButton.title = "Conversation members";
|
|
||||||
|
|
||||||
//Add button icon
|
//Add button icon
|
||||||
var buttonIcon = createElem("i", infosBox.membersButton);
|
var buttonIcon = createElem("i", infosBox.membersButton);
|
||||||
buttonIcon.className = "fa fa-users";
|
buttonIcon.className = "fa fa-users";
|
||||||
|
|
||||||
|
|
||||||
//Add conversation members pane
|
//Add conversation members pane
|
||||||
var membersPane = createElem("div", infosBox.boxBody);
|
var membersPane = createElem("div", infosBox.boxBody);
|
||||||
membersPane.className = "direct-chat-contacts";
|
membersPane.className = "direct-chat-contacts";
|
||||||
@ -319,6 +322,9 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Add call button (if possible)
|
||||||
|
ComunicWeb.components.conversations.chatWindows.showCallButton(conversationInfos);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -563,16 +569,43 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a call button to the conversation, if possible
|
||||||
|
*
|
||||||
|
* @param {Object} conversation Information about the conversation
|
||||||
|
*/
|
||||||
|
showCallButton: function(conversation){
|
||||||
|
|
||||||
|
//Check if calls are disabled
|
||||||
|
if(!ComunicWeb.components.calls.controller.isAvailable())
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Check if it is a conversation with two members
|
||||||
|
if(conversation.infos.members.length != 2)
|
||||||
|
return; //Currently the call feature is offered just
|
||||||
|
//for conversation of two people
|
||||||
|
|
||||||
|
//Add the call button
|
||||||
|
let button = createElem2({
|
||||||
|
insertBefore: conversation.box.boxTools.firstChild,
|
||||||
|
type: "button",
|
||||||
|
class: "btn btn-box-tool",
|
||||||
|
innerHTML: "<i class='fa fa-phone'></i>"
|
||||||
|
});
|
||||||
|
conversation.box.callButton = button;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process submited update conversation form
|
* Process submited update conversation form
|
||||||
*
|
*
|
||||||
* @param {Object} conversation Informations about the conversation
|
* @param {Object} conversation Information about the conversation
|
||||||
* @return {Boolean} True for a success
|
* @return {Boolean} True for a success
|
||||||
*/
|
*/
|
||||||
submitUpdateForm: function(conversation){
|
submitUpdateForm: function(conversation){
|
||||||
|
|
||||||
//Then, get informations about the input
|
//Then, get information about the input
|
||||||
var newValues = {
|
var newValues = {
|
||||||
conversationID: conversation.infos.ID,
|
conversationID: conversation.infos.ID,
|
||||||
following: conversation.settingsForm.followConversationInput.checked,
|
following: conversation.settingsForm.followConversationInput.checked,
|
||||||
@ -621,7 +654,7 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
/**
|
/**
|
||||||
* Submit a new message form
|
* Submit a new message form
|
||||||
*
|
*
|
||||||
* @param {Object} convInfos Informations about the conversation
|
* @param {Object} convInfos Information about the conversation
|
||||||
* @return {Boolean} True for a success
|
* @return {Boolean} True for a success
|
||||||
*/
|
*/
|
||||||
submitMessageForm: function(convInfos){
|
submitMessageForm: function(convInfos){
|
||||||
@ -673,7 +706,7 @@ ComunicWeb.components.conversations.chatWindows = {
|
|||||||
/**
|
/**
|
||||||
* Reset a create a message form
|
* Reset a create a message form
|
||||||
*
|
*
|
||||||
* @param {Object} infos Informations about the conversation
|
* @param {Object} infos Information about the conversation
|
||||||
* @return {Boolean} True for a success
|
* @return {Boolean} True for a success
|
||||||
*/
|
*/
|
||||||
resetCreateMessageForm: function(infos){
|
resetCreateMessageForm: function(infos){
|
||||||
|
Loading…
Reference in New Issue
Block a user