diff --git a/assets/js/components/discussions/list.js b/assets/js/components/discussions/list.js index e334a00e..a8dc9857 100644 --- a/assets/js/components/discussions/list.js +++ b/assets/js/components/discussions/list.js @@ -68,15 +68,35 @@ ComunicWeb.components.discussions.list = { //Create and display discussion creation form var createForm = createElem("div", listBox.boxBody); + //Choose users + //Create select user element + var selectElement = createFormGroup({ + target: createForm, + label: "Users", + multiple: true, + placeholder: "Select users", + type: "select2"}); + + //Initialize user selector + ComunicWeb.components.userSelect.init(selectElement); + + //Discussion name - var discussionNameInput = createFormGroup(createForm, "Discussion name", "Optionnal", "text"); + var discussionNameInput = createFormGroup({ + target: createForm, + label: "Discussion name", + placeholder: "Optionnal", + type: "text"}); //Follow disucssion - var followDiscussionInput = createFormGroup(createForm, "Follow discussion", "true", "checkbox"); - + var followDiscussionInput = createFormGroup({ + target: createForm, + label: "Follow discussion", + checked: true, + type: "checkbox"}); //Create button - var createButton = createElem("butto", createForm); + var createButton = createElem("button", createForm); createButton.className = "btn btn-primary"; createButton.style.width = "100%"; createButton.innerHTML = "Create discussion"; diff --git a/assets/js/pages/home/home.js b/assets/js/pages/home/home.js index bc611ceb..ec740f97 100644 --- a/assets/js/pages/home/home.js +++ b/assets/js/pages/home/home.js @@ -28,21 +28,6 @@ ComunicWeb.pages.home.home = { loginButton.innerHTML="Logout"; targetElement.appendChild(loginButton); - //Create select user element - var formGroup = createElem("div", targetElement); - formGroup.className = "form-group"; - var selectElement = createElem("select", formGroup); - selectElement.className = "form-control select2"; - selectElement.setAttribute("multiple", "multiple"); - selectElement.setAttribute("data-placeholder", "Select users"); - - //Initialize user selector - ComunicWeb.components.userSelect.init(selectElement); - - setInterval(function(){ - console.log(ComunicWeb.components.userSelect.getResults(selectElement)); - }, 3000); - } else{ //Display landing page