mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 13:59:23 +00:00
Renamed discussions to conversations
This commit is contained in:
parent
ee02b522bf
commit
07c6fc4be7
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Discussions manager stylesheet
|
||||
* Conversations manager stylesheet
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
#discussionsElem {
|
||||
#conversationsElem {
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
text-align: right;
|
||||
@ -13,7 +13,7 @@
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
#discussionsElem .open-discussion-button {
|
||||
#conversationsElem .open-conversation-button {
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-left-radius: 0px;
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Discussions windows
|
||||
* Conversations windows
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
#discussionsElem .box {
|
||||
#conversationsElem .box {
|
||||
width: 250px;
|
||||
height: 350px;
|
||||
max-width: 100%;
|
@ -488,32 +488,32 @@ var ComunicWeb = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Discussions
|
||||
* Conversations
|
||||
*/
|
||||
discussions:{
|
||||
conversations:{
|
||||
/**
|
||||
* Discussions manager
|
||||
* Conversations manager
|
||||
*/
|
||||
manager:{
|
||||
//TODO : implement
|
||||
},
|
||||
|
||||
/**
|
||||
* Discussions list windo
|
||||
* Conversations list windo
|
||||
*/
|
||||
list:{
|
||||
//TODO : implement
|
||||
},
|
||||
|
||||
/**
|
||||
* Discussiosn windows manager
|
||||
* Conversations windows manager
|
||||
*/
|
||||
windows:{
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Interface between discussion UI and the API
|
||||
* Interface between conversation UI and the API
|
||||
*/
|
||||
interface:{},
|
||||
},
|
||||
|
@ -194,8 +194,8 @@ ComunicWeb.common.page = {
|
||||
//We load friends list (if user is logged in)
|
||||
ComunicWeb.components.friends.bar.display();
|
||||
|
||||
//We load discussions manager (login required)
|
||||
ComunicWeb.components.discussions.manager.display();
|
||||
//We load conversations manager (login required)
|
||||
ComunicWeb.components.conversations.manager.display();
|
||||
}
|
||||
}
|
||||
|
||||
|
15
assets/js/components/conversations/interface.js
Normal file
15
assets/js/components/conversations/interface.js
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Interface between the graphical conversation system and the API
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.conversations.interface = {
|
||||
/**
|
||||
* Create a conversation
|
||||
*
|
||||
* @param {Object} infos Informations about the conversation to create
|
||||
* @param {Function} afterCreate What to do once the conversation is created
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Discussions list window
|
||||
* Conversations list window
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.discussions.list = {
|
||||
ComunicWeb.components.conversations.list = {
|
||||
/**
|
||||
* Display discussions list window
|
||||
* Display conversations list window
|
||||
*
|
||||
* @param {HTMLElement} nodeBefore The node before the destination
|
||||
* @return {Boolean} True for a success
|
||||
@ -17,10 +17,10 @@ ComunicWeb.components.discussions.list = {
|
||||
ComunicWeb.debug.logMessage("INFO : initialize conversation list box.");
|
||||
|
||||
//Create a window
|
||||
var listBox = ComunicWeb.components.discussions.windows.create(nodeBefore);
|
||||
var listBox = ComunicWeb.components.conversations.windows.create(nodeBefore);
|
||||
|
||||
//Change box title
|
||||
listBox.boxTitle.innerHTML = "Discussions";
|
||||
listBox.boxTitle.innerHTML = "Conversations";
|
||||
|
||||
//Remove footer
|
||||
listBox.boxFooter.remove();
|
||||
@ -30,7 +30,7 @@ ComunicWeb.components.discussions.list = {
|
||||
listBox.boxTools.insertBefore(createButton, listBox.boxTools.children[0]);
|
||||
createButton.className = "btn btn-box-tool";
|
||||
createButton.onclick = function(){
|
||||
ComunicWeb.components.discussions.list.displayCreateForm(listBox);
|
||||
ComunicWeb.components.conversations.list.displayCreateForm(listBox);
|
||||
}
|
||||
|
||||
//Button icon
|
||||
@ -45,7 +45,7 @@ ComunicWeb.components.discussions.list = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Display the form to create a new discussion
|
||||
* Display the form to create a new conversation
|
||||
*
|
||||
* @param {Object} listBox Informations about the listbox target
|
||||
* @return {Boolean} True for a success
|
||||
@ -53,7 +53,7 @@ ComunicWeb.components.discussions.list = {
|
||||
displayCreateForm: function(listBox){
|
||||
|
||||
//Log action
|
||||
ComunicWeb.debug.logMessage("INFO : initialize create discussion form");
|
||||
ComunicWeb.debug.logMessage("INFO : initialize create conversation form");
|
||||
|
||||
//Hide boxy body contents
|
||||
var boxBodyElem = listBox.boxBody.children;
|
||||
@ -63,9 +63,9 @@ ComunicWeb.components.discussions.list = {
|
||||
}
|
||||
|
||||
//Change box title
|
||||
listBox.boxTitle.innerHTML = "New discussion";
|
||||
listBox.boxTitle.innerHTML = "New conversation";
|
||||
|
||||
//Create and display discussion creation form
|
||||
//Create and display conversation creation form
|
||||
var createForm = createElem("div", listBox.boxBody);
|
||||
|
||||
//Choose users
|
||||
@ -81,17 +81,17 @@ ComunicWeb.components.discussions.list = {
|
||||
ComunicWeb.components.userSelect.init(usersElement);
|
||||
|
||||
|
||||
//Discussion name
|
||||
var discussionNameInput = createFormGroup({
|
||||
//Conversation name
|
||||
var conversationNameInput = createFormGroup({
|
||||
target: createForm,
|
||||
label: "Discussion name",
|
||||
label: "Conversation name",
|
||||
placeholder: "Optionnal",
|
||||
type: "text"});
|
||||
|
||||
//Follow disucssion
|
||||
var followDiscussionInput = createFormGroup({
|
||||
var followConversationInput = createFormGroup({
|
||||
target: createForm,
|
||||
label: "Follow discussion",
|
||||
label: "Follow conversation",
|
||||
checked: true,
|
||||
type: "checkbox"});
|
||||
|
||||
@ -99,19 +99,19 @@ ComunicWeb.components.discussions.list = {
|
||||
var createButton = createElem("button", createForm);
|
||||
createButton.className = "btn btn-primary";
|
||||
createButton.style.width = "100%";
|
||||
createButton.innerHTML = "Create discussion";
|
||||
createButton.innerHTML = "Create conversation";
|
||||
|
||||
//Generate a summary object about all the informations we have got
|
||||
var infos = {
|
||||
listBox: listBox,
|
||||
usersElement: usersElement,
|
||||
discussionNameInput: discussionNameInput,
|
||||
followDiscussionInput: followDiscussionInput,
|
||||
conversationNameInput: conversationNameInput,
|
||||
followConversationInput: followConversationInput,
|
||||
};
|
||||
|
||||
//Make button lives
|
||||
createButton.onclick = function(){
|
||||
ComunicWeb.components.discussions.list.submitCreateDiscussionForm(infos);
|
||||
ComunicWeb.components.conversations.list.submitCreateConversationForm(infos);
|
||||
};
|
||||
|
||||
//Success
|
||||
@ -119,16 +119,16 @@ ComunicWeb.components.discussions.list = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Submit a create a discussion form
|
||||
* Submit a create a conversation form
|
||||
*
|
||||
* @param {Object} infos Data to pass to the function
|
||||
* * @info {Object} listBox Informations about the listbox creating the discussion
|
||||
* * @info {Object} listBox Informations about the listbox creating the conversation
|
||||
* * @info {HTMLElement} usersElement Pointer on userElement
|
||||
* * @info {HTMLElement} discussionNameInput Pointer on the input of the form of the discussion
|
||||
* * @info {HTMLElement} followDiscussionInput Pointer on the "follow discussion" checkbox
|
||||
* * @info {HTMLElement} conversationNameInput Pointer on the input of the form of the conversation
|
||||
* * @info {HTMLElement} followConversationInput Pointer on the "follow conversation" checkbox
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
submitCreateDiscussionForm: function(infos){
|
||||
submitCreateConversationForm: function(infos){
|
||||
|
||||
//First, get the list of users
|
||||
var selectedUsers = ComunicWeb.components.userSelect.getResults(infos.usersElement);
|
||||
@ -146,10 +146,10 @@ ComunicWeb.components.discussions.list = {
|
||||
|
||||
//Prepare the creation of the conversation
|
||||
//Get all required informations
|
||||
var discussionInformations = {
|
||||
var conversationInformations = {
|
||||
users: selectedUsers,
|
||||
follow: infos.followDiscussionInput.checked,
|
||||
discussionName: (infos.discussionNameInput.value == "" ? false : infos.discussionNameInput.value),
|
||||
follow: infos.followConversationInput.checked,
|
||||
conversationName: (infos.conversationNameInput.value == "" ? false : infos.conversationNameInput.value),
|
||||
};
|
||||
|
||||
//Change box body style
|
82
assets/js/components/conversations/manager.js
Normal file
82
assets/js/components/conversations/manager.js
Normal file
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Conversations manager
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.conversations.manager = {
|
||||
/**
|
||||
* Display conversations manager
|
||||
*
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
display: function(){
|
||||
|
||||
//Try to get conversation manager
|
||||
var conversationsContainerElem = byId("conversationsElem");
|
||||
|
||||
//Check if element exists or not
|
||||
if(conversationsContainerElem){
|
||||
ComunicWeb.debug.logMessage("NOTICE : couldn't initializate conversation manager because a conversation manager is already on the page");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Else inform user and create conversation manager
|
||||
ComunicWeb.debug.logMessage("INFO : initializate conversation manager");
|
||||
|
||||
//Create conversations manager element
|
||||
var conversationsContainerElem = createElem("div");
|
||||
conversationsContainerElem.id = "conversationsElem";
|
||||
|
||||
//Insert the element at the right place
|
||||
var pageTarget = byId("pageTarget");
|
||||
if(pageTarget){
|
||||
//Insert disucssion element before it
|
||||
byId("wrapper").insertBefore(conversationsContainerElem, pageTarget);
|
||||
}
|
||||
else{
|
||||
//Just apply the element
|
||||
byId("wrapper").appendChild(conversationsContainerElem);
|
||||
}
|
||||
|
||||
//Initializate conversation element
|
||||
this.init(conversationsContainerElem);
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializate conversations element
|
||||
*
|
||||
* @param {HTMLElement} conversationsContainerElem The container of the conversation element
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
init: function(conversationsContainerElem){
|
||||
|
||||
//First, add the "open a conversation" new
|
||||
this.addOpenConversationButton(conversationsContainerElem);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Add the "open conversation" button
|
||||
*
|
||||
* @param {HTMLElement} targetElem The target of the button
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
addOpenConversationButton: function(targetElem){
|
||||
|
||||
//Create the button
|
||||
var addButton = createElem("button", targetElem);
|
||||
addButton.className = "btn btn-primary open-conversation-button";
|
||||
addButton.innerHTML = "Open a conversation";
|
||||
|
||||
|
||||
//Temporary behavior
|
||||
addButton.onclick = function(){
|
||||
ComunicWeb.components.conversations.list.display(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Discussions windows manager
|
||||
* Conversations windows manager
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.discussions.windows = {
|
||||
ComunicWeb.components.conversations.windows = {
|
||||
|
||||
/**
|
||||
* Create a new conversation window
|
||||
@ -14,16 +14,16 @@ ComunicWeb.components.discussions.windows = {
|
||||
*/
|
||||
create: function(nodeBefore){
|
||||
//Create listbox element
|
||||
var discussionBox = createElem("div", nodeBefore.parentNode);
|
||||
discussionBox.className = "box box-primary";
|
||||
var conversationBox = createElem("div", nodeBefore.parentNode);
|
||||
conversationBox.className = "box box-primary";
|
||||
|
||||
//Create close box function
|
||||
var closeBox = function(){
|
||||
discussionBox.remove();
|
||||
conversationBox.remove();
|
||||
}
|
||||
|
||||
//Create box header
|
||||
var boxHeader = createElem("div", discussionBox);
|
||||
var boxHeader = createElem("div", conversationBox);
|
||||
boxHeader.className = "box-header with-border";
|
||||
|
||||
//Add box title
|
||||
@ -45,16 +45,16 @@ ComunicWeb.components.discussions.windows = {
|
||||
closeIcon.className = "fa fa-times";
|
||||
|
||||
//Box body
|
||||
var boxBody = createElem("div", discussionBox);
|
||||
var boxBody = createElem("div", conversationBox);
|
||||
boxBody.className = "box-body";
|
||||
|
||||
//Box footer
|
||||
var boxFooter = createElem("div", discussionBox);
|
||||
var boxFooter = createElem("div", conversationBox);
|
||||
boxFooter.className = "box-footer";
|
||||
|
||||
//Prepare return
|
||||
var boxElements ={
|
||||
rootElem: discussionBox,
|
||||
rootElem: conversationBox,
|
||||
closeFunction: closeBox,
|
||||
boxTitle: boxTitle,
|
||||
boxTools: boxTools,
|
@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Interface between the graphical discussion system and the API
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.discussions.interface = {
|
||||
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/**
|
||||
* Discussions manager
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.discussions.manager = {
|
||||
/**
|
||||
* Display discussions manager
|
||||
*
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
display: function(){
|
||||
|
||||
//Try to get discussion manager
|
||||
var discussionsContainerElem = byId("discussionsElem");
|
||||
|
||||
//Check if element exists or not
|
||||
if(discussionsContainerElem){
|
||||
ComunicWeb.debug.logMessage("NOTICE : couldn't initializate discussion manager because a discussion manager is already on the page");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Else inform user and create discussion manager
|
||||
ComunicWeb.debug.logMessage("INFO : initializate discussion manager");
|
||||
|
||||
//Create discussions manager element
|
||||
var discussionsContainerElem = createElem("div");
|
||||
discussionsContainerElem.id = "discussionsElem";
|
||||
|
||||
//Insert the element at the right place
|
||||
var pageTarget = byId("pageTarget");
|
||||
if(pageTarget){
|
||||
//Insert disucssion element before it
|
||||
byId("wrapper").insertBefore(discussionsContainerElem, pageTarget);
|
||||
}
|
||||
else{
|
||||
//Just apply the element
|
||||
byId("wrapper").appendChild(discussionsContainerElem);
|
||||
}
|
||||
|
||||
//Initializate discussion element
|
||||
this.init(discussionsContainerElem);
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializate discussions element
|
||||
*
|
||||
* @param {HTMLElement} discussionsContainerElem The container of the discussion element
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
init: function(discussionsContainerElem){
|
||||
|
||||
//First, add the "open a discussion" new
|
||||
this.addOpenDiscussionButton(discussionsContainerElem);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Add the "open discussion" button
|
||||
*
|
||||
* @param {HTMLElement} targetElem The target of the button
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
addOpenDiscussionButton: function(targetElem){
|
||||
|
||||
//Create the button
|
||||
var addButton = createElem("button", targetElem);
|
||||
addButton.className = "btn btn-primary open-discussion-button";
|
||||
addButton.innerHTML = "Open a discussion";
|
||||
|
||||
|
||||
//Temporary behavior
|
||||
addButton.onclick = function(){
|
||||
ComunicWeb.components.discussions.list.display(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -29,8 +29,8 @@ $config['CSSfiles'] = array(
|
||||
"%PATH_ASSETS%css/components/menuBar.css",
|
||||
"%PATH_ASSETS%css/components/searchForm.css",
|
||||
"%PATH_ASSETS%css/components/friends/friendsBar.css",
|
||||
"%PATH_ASSETS%css/components/discussions/manager.css",
|
||||
"%PATH_ASSETS%css/components/discussions/windows.css",
|
||||
"%PATH_ASSETS%css/components/conversations/manager.css",
|
||||
"%PATH_ASSETS%css/components/conversations/windows.css",
|
||||
"%PATH_ASSETS%css/components/userSelect/userSelect.css",
|
||||
);
|
||||
|
||||
@ -79,10 +79,10 @@ $config['JSfiles'] = array(
|
||||
"%PATH_ASSETS%js/components/menuBar/authenticated.js",
|
||||
"%PATH_ASSETS%js/components/friends/friendsList.js",
|
||||
"%PATH_ASSETS%js/components/friends/friendsBar.js",
|
||||
"%PATH_ASSETS%js/components/discussions/manager.js",
|
||||
"%PATH_ASSETS%js/components/discussions/list.js",
|
||||
"%PATH_ASSETS%js/components/discussions/windows.js",
|
||||
"%PATH_ASSETS%js/components/discussions/interface.js",
|
||||
"%PATH_ASSETS%js/components/conversations/manager.js",
|
||||
"%PATH_ASSETS%js/components/conversations/list.js",
|
||||
"%PATH_ASSETS%js/components/conversations/windows.js",
|
||||
"%PATH_ASSETS%js/components/conversations/interface.js",
|
||||
"%PATH_ASSETS%js/components/userSelect/userSelect.js",
|
||||
|
||||
//User scripts
|
||||
|
Loading…
Reference in New Issue
Block a user