From 6f44b27342aea6d45839c16d7edcfbe2ddf8efcc Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 7 Jun 2017 15:05:21 +0200 Subject: [PATCH] Created submitCreateDiscussionForm method --- assets/js/common/functionsSchema.js | 5 +++ assets/js/components/discussions/interface.js | 9 +++++ assets/js/components/discussions/list.js | 33 +++++++++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 assets/js/components/discussions/interface.js diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 697ce492..422177f8 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -501,6 +501,11 @@ var ComunicWeb = { windows:{ }, + + /** + * Interface between discussion UI and the API + */ + interface:{}, }, /** diff --git a/assets/js/components/discussions/interface.js b/assets/js/components/discussions/interface.js new file mode 100644 index 00000000..facba262 --- /dev/null +++ b/assets/js/components/discussions/interface.js @@ -0,0 +1,9 @@ +/** + * 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/list.js b/assets/js/components/discussions/list.js index a8dc9857..d8b04bd9 100644 --- a/assets/js/components/discussions/list.js +++ b/assets/js/components/discussions/list.js @@ -70,7 +70,7 @@ ComunicWeb.components.discussions.list = { //Choose users //Create select user element - var selectElement = createFormGroup({ + var usersElement = createFormGroup({ target: createForm, label: "Users", multiple: true, @@ -78,7 +78,7 @@ ComunicWeb.components.discussions.list = { type: "select2"}); //Initialize user selector - ComunicWeb.components.userSelect.init(selectElement); + ComunicWeb.components.userSelect.init(usersElement); //Discussion name @@ -101,7 +101,36 @@ ComunicWeb.components.discussions.list = { createButton.style.width = "100%"; createButton.innerHTML = "Create discussion"; + //Generate a summary object about all the informations we have got + var infos = { + listBox: listBox, + userElement: usersElement, + discussionNameInput: discussionNameInput, + followDiscussionInput: followDiscussionInput, + }; + + //Make button lives + createButton.onclick = function(){ + ComunicWeb.components.discussions.list.submitCreateDiscussionForm(infos); + }; + //Success return true; + }, + + /** + * Submit a create a discussion form + * + * @param {Object} infos Data to pass to the function + * * @info {Object} listBox Informations about the listbox creating the discussion + * * @info {HTMLElement} userElement 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 + * @return {Boolean} True for a success + */ + submitCreateDiscussionForm: function(infos){ + + //First, get the list of users + console.log("hello from list.js"); } } \ No newline at end of file