Display text posts and images posts

This commit is contained in:
Pierre
2017-12-31 18:51:46 +01:00
parent 1147ab787e
commit 9a2e3e5351
8 changed files with 278 additions and 7 deletions

View File

@ -134,7 +134,7 @@ ComunicWeb.pages.userPage.main = {
var row = createElem2({
appendTo: sectionContent,
type: "div",
class: "row"
class: "row page-contener"
});
//Create left column
@ -151,10 +151,10 @@ ComunicWeb.pages.userPage.main = {
var rightColumn = createElem2({
appendTo: row,
type: "div",
class: "col-md-9"
class: "col-md-6"
});
//Display text
//Display posts
ComunicWeb.pages.userPage.posts.display(infos, params, rightColumn);
}

View File

@ -22,10 +22,48 @@ ComunicWeb.pages.userPage.posts = {
class: "box box-primary"
});
//Check whether a precise post has to be opened or not
//TODO implement
var postsBody = createElem2({
appendTo: postsBlock,
type: "div",
class: "box-body"
});
//Get the posts from the API
ComunicWeb.components.posts.interface.get_user(userInfos.userID, function(result){
//Check for errors
if(result.error){
//Display notification
ComunicWeb.common.notificationSystem.showNotification("Couldn't get user posts!", "danger", 4, "Error");
}
else {
//Show the posts
ComunicWeb.pages.userPage.posts._show(result, postsBody);
}
});
}
},
/**
* Show user posts
*
* @param {Object} posts The list of posts to display
* @param {HMTLElement} target The rendering target
*/
_show: function(posts, target){
//Process each post
var i;
for(i in posts){
//Display post
ComunicWeb.components.posts.ui.display_post(posts[i], target);
}
},