mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Added a getResults method
This commit is contained in:
parent
ec6532a0b7
commit
94773a9dc1
@ -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;
|
||||
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user