mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Display like button
This commit is contained in:
		@@ -115,7 +115,7 @@ ComunicWeb.pages.userPage.main = {
 | 
			
		||||
	 * Display a user page
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param {Object} infos Informations about the user to display
 | 
			
		||||
	 * @param {Object} params Parametres required to open the page
 | 
			
		||||
	 * @param {Object} params Parameters required to open the page
 | 
			
		||||
	 * @param {HTMLElement} target Target of the user page
 | 
			
		||||
	 */
 | 
			
		||||
	displayUserPage: function(infos, params, target){
 | 
			
		||||
@@ -146,6 +146,16 @@ ComunicWeb.pages.userPage.main = {
 | 
			
		||||
 | 
			
		||||
		//Display profile informations
 | 
			
		||||
		ComunicWeb.pages.userPage.profileInfos.display(infos, leftColumn);
 | 
			
		||||
 | 
			
		||||
		//Create right column
 | 
			
		||||
		var rightColumn = createElem2({
 | 
			
		||||
			appendTo: row,
 | 
			
		||||
			type: "div",
 | 
			
		||||
			class: "col-md-9"
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		//Display text
 | 
			
		||||
		ComunicWeb.pages.userPage.posts.display(infos, params, rightColumn);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								assets/js/pages/userPage/posts.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								assets/js/pages/userPage/posts.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Posts function
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ComunicWeb.pages.userPage.posts = {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Display the posts
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param {Object} userInfos Informations about the user
 | 
			
		||||
	 * @param {Object} params Additionnal parametres passed with the request
 | 
			
		||||
	 * @param {HTMLElement} target The target where the posts will be applied
 | 
			
		||||
	 */
 | 
			
		||||
	display: function(userInfos, params, target){
 | 
			
		||||
 | 
			
		||||
		//Create posts blocks
 | 
			
		||||
		var postsBlock = createElem2({
 | 
			
		||||
			appendTo: target,
 | 
			
		||||
			type: "div",
 | 
			
		||||
			class: "box box-primary"
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		//Check whether a precise post has to be opened or not
 | 
			
		||||
		//TODO implement
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
@@ -63,6 +63,28 @@ ComunicWeb.pages.userPage.profileInfos = {
 | 
			
		||||
			innerHTML: infos.firstName + " " + infos.lastName
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		//Show user likes
 | 
			
		||||
		var userLikesTarget = createElem2({
 | 
			
		||||
			appendTo: boxBody,
 | 
			
		||||
			type: "div"
 | 
			
		||||
		});
 | 
			
		||||
		userLikesTarget.style.textAlign = "center";
 | 
			
		||||
 | 
			
		||||
		//Check wether user is linking or not
 | 
			
		||||
		var userLiking = null;
 | 
			
		||||
		if(signed_in()){
 | 
			
		||||
			userLiking = infos.user_like_page;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Call component
 | 
			
		||||
		ComunicWeb.components.like.button.display(
 | 
			
		||||
			"user",
 | 
			
		||||
			infos.userID,
 | 
			
		||||
			infos.pageLikes,
 | 
			
		||||
			userLiking,
 | 
			
		||||
			userLikesTarget,
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		//Add list of informations about user
 | 
			
		||||
		var listInfos = createElem2({
 | 
			
		||||
			appendTo: boxBody,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user