From 07c6fc4be717c8b964c0b3f2a2f5f7ec222ce94f Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 7 Jun 2017 19:24:48 +0200 Subject: [PATCH] Renamed discussions to conversations --- .../manager.css | 6 +- .../windows.css | 4 +- assets/js/common/functionsSchema.js | 12 +-- assets/js/common/page.js | 4 +- .../js/components/conversations/interface.js | 15 ++++ .../{discussions => conversations}/list.js | 54 ++++++------ assets/js/components/conversations/manager.js | 82 +++++++++++++++++++ .../{discussions => conversations}/windows.js | 18 ++-- assets/js/components/discussions/interface.js | 9 -- assets/js/components/discussions/manager.js | 82 ------------------- corePage/config/dev.config.php | 12 +-- 11 files changed, 152 insertions(+), 146 deletions(-) rename assets/css/components/{discussions => conversations}/manager.css (74%) rename assets/css/components/{discussions => conversations}/windows.css (79%) create mode 100644 assets/js/components/conversations/interface.js rename assets/js/components/{discussions => conversations}/list.js (68%) create mode 100644 assets/js/components/conversations/manager.js rename assets/js/components/{discussions => conversations}/windows.js (74%) delete mode 100644 assets/js/components/discussions/interface.js delete mode 100644 assets/js/components/discussions/manager.js diff --git a/assets/css/components/discussions/manager.css b/assets/css/components/conversations/manager.css similarity index 74% rename from assets/css/components/discussions/manager.css rename to assets/css/components/conversations/manager.css index c00a34a9..39ded65b 100644 --- a/assets/css/components/discussions/manager.css +++ b/assets/css/components/conversations/manager.css @@ -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; diff --git a/assets/css/components/discussions/windows.css b/assets/css/components/conversations/windows.css similarity index 79% rename from assets/css/components/discussions/windows.css rename to assets/css/components/conversations/windows.css index a69b0935..f5930635 100644 --- a/assets/css/components/discussions/windows.css +++ b/assets/css/components/conversations/windows.css @@ -1,10 +1,10 @@ /** - * Discussions windows + * Conversations windows * * @author Pierre HUBERT */ -#discussionsElem .box { +#conversationsElem .box { width: 250px; height: 350px; max-width: 100%; diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 498ecd55..61b19530 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -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:{}, }, diff --git a/assets/js/common/page.js b/assets/js/common/page.js index e3bf3c4f..f8c540d9 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -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(); } } diff --git a/assets/js/components/conversations/interface.js b/assets/js/components/conversations/interface.js new file mode 100644 index 00000000..a1564179 --- /dev/null +++ b/assets/js/components/conversations/interface.js @@ -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 + */ +} \ No newline at end of file diff --git a/assets/js/components/discussions/list.js b/assets/js/components/conversations/list.js similarity index 68% rename from assets/js/components/discussions/list.js rename to assets/js/components/conversations/list.js index b66599e3..de50f5dc 100644 --- a/assets/js/components/discussions/list.js +++ b/assets/js/components/conversations/list.js @@ -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 diff --git a/assets/js/components/conversations/manager.js b/assets/js/components/conversations/manager.js new file mode 100644 index 00000000..d4f84ae9 --- /dev/null +++ b/assets/js/components/conversations/manager.js @@ -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); + } + } +} \ No newline at end of file diff --git a/assets/js/components/discussions/windows.js b/assets/js/components/conversations/windows.js similarity index 74% rename from assets/js/components/discussions/windows.js rename to assets/js/components/conversations/windows.js index 7a0c11fa..3b9a634f 100644 --- a/assets/js/components/discussions/windows.js +++ b/assets/js/components/conversations/windows.js @@ -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, diff --git a/assets/js/components/discussions/interface.js b/assets/js/components/discussions/interface.js deleted file mode 100644 index facba262..00000000 --- a/assets/js/components/discussions/interface.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Interface between the graphical discussion system and the API - * - * @author Pierre HUBERT - */ - -ComunicWeb.components.discussions.interface = { - -} \ No newline at end of file diff --git a/assets/js/components/discussions/manager.js b/assets/js/components/discussions/manager.js deleted file mode 100644 index 5b32a25e..00000000 --- a/assets/js/components/discussions/manager.js +++ /dev/null @@ -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); - } - } -} \ No newline at end of file diff --git a/corePage/config/dev.config.php b/corePage/config/dev.config.php index f98552da..38a91bda 100644 --- a/corePage/config/dev.config.php +++ b/corePage/config/dev.config.php @@ -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