Created submitCreateDiscussionForm method

This commit is contained in:
Pierre 2017-06-07 15:05:21 +02:00
parent fa345fd130
commit 6f44b27342
3 changed files with 45 additions and 2 deletions

View File

@ -501,6 +501,11 @@ var ComunicWeb = {
windows:{
},
/**
* Interface between discussion UI and the API
*/
interface:{},
},
/**

View File

@ -0,0 +1,9 @@
/**
* Interface between the graphical discussion system and the API
*
* @author Pierre HUBERT
*/
ComunicWeb.components.discussions.interface = {
}

View File

@ -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");
}
}