mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Added a getResults method
This commit is contained in:
		@@ -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;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user