Added a getResults method

This commit is contained in:
Pierre 2017-06-06 19:05:49 +02:00
parent ec6532a0b7
commit 94773a9dc1

View File

@ -67,7 +67,6 @@ ComunicWeb.components.userSelect = {
* @return {String} The formated informations
*/
formatUser: function(infos){
console.log(infos);
if(!infos.id)
return infos.id;
@ -75,4 +74,30 @@ ComunicWeb.components.userSelect = {
return $("<img src='"+infos.accountImage+"' class='user-select-image' /> <span>" + infos.text + "</span>");
},
/**
* Returns the results of a specified select element
*
* @param {HTMLElement} inputSelect The target element
* @return {Object} An object with all the select IDs
*/
getResults: function(inputSelect){
//Prepare return
var usersID = {};
for(i in inputSelect.children){
//Check it is really a children
if(inputSelect.children[i].value){
//Get ID
var userID = inputSelect.children[i].value;
usersID['user-'+userID] = userID;
}
}
//Return result IDs
return usersID;
}
};