ComunicWeb/assets/js/components/conversations/windows.js

69 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-06-05 08:12:38 +00:00
/**
2017-06-07 17:24:48 +00:00
* Conversations windows manager
2017-06-05 08:12:38 +00:00
*
* @author Pierre HUBERT
*/
2017-06-07 17:24:48 +00:00
ComunicWeb.components.conversations.windows = {
2017-06-05 08:12:38 +00:00
/**
* Create a new conversation window
*
* @param {HTMLElement} nodeBefore The node before the destination window
* @return {Object} Differents elements of the window
*/
create: function(nodeBefore){
//Create listbox element
2017-06-07 17:24:48 +00:00
var conversationBox = createElem("div", nodeBefore.parentNode);
conversationBox.className = "box box-primary";
2017-06-05 08:12:38 +00:00
//Create close box function
var closeBox = function(){
2017-06-07 17:24:48 +00:00
conversationBox.remove();
2017-06-05 08:12:38 +00:00
}
//Create box header
2017-06-07 17:24:48 +00:00
var boxHeader = createElem("div", conversationBox);
2017-06-05 08:12:38 +00:00
boxHeader.className = "box-header with-border";
//Add box title
var boxTitle = createElem("h3", boxHeader);
boxTitle.className = "box-title";
//Box tools
var boxTools = createElem("div", boxHeader);
boxTools.className = "box-tools pull-right";
//Close button
var closeButton = createElem("button", boxTools);
closeButton.className = "btn btn-box-tool";
closeButton.onclick = closeBox;
//Close icon
var closeIcon = createElem("i", closeButton);
closeIcon.className = "fa fa-times";
//Box body
2017-06-07 17:24:48 +00:00
var boxBody = createElem("div", conversationBox);
2017-06-05 08:12:38 +00:00
boxBody.className = "box-body";
//Box footer
2017-06-07 17:24:48 +00:00
var boxFooter = createElem("div", conversationBox);
2017-06-05 08:12:38 +00:00
boxFooter.className = "box-footer";
//Prepare return
var boxElements ={
2017-06-07 17:24:48 +00:00
rootElem: conversationBox,
2017-06-05 08:12:38 +00:00
closeFunction: closeBox,
boxTitle: boxTitle,
boxTools: boxTools,
boxBody: boxBody,
boxFooter: boxFooter,
};
//Return elements
return boxElements;
}
}