Created latest posts page.

This commit is contained in:
Pierre 2018-02-02 06:56:52 +01:00
parent d913b38a5d
commit 8ae6d01b4f
7 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,5 @@
/**
* Latests post stylesheet
*
* @author Pierre HUBERT
*/

View File

@ -917,6 +917,20 @@ var ComunicWeb = {
},
/**
* Latest posts page
*/
latestPosts: {
/**
* Main script
*/
main: {
//TODO: implement
},
},
/**
* Login controller
*/

View File

@ -25,6 +25,22 @@ ComunicWeb.components.posts.interface = {
},
/**
* Get the list of the latest posts
*
* @param {function} callback What to do when we got response
*/
get_latest: function(callback){
//Prepare API request
var APIuri = "posts/get_latest";
var params = {};
//Perform the request
ComunicWeb.common.api.makeAPIrequest(APIuri, params, true, callback);
},
/**
* Get single post informations
*

View File

@ -19,7 +19,7 @@ ComunicWeb.pages.home.home = {
if(userLoggedIn){
//Open current user page
openPage("user/me");
openPage("latest");
}
else{

View File

@ -0,0 +1,31 @@
/**
* Latest posts page main script
*
* @author Pierre HUBERT
*/
ComunicWeb.pages.latestPosts.main = {
/**
* Open latest posts page
*
* @param {Object} params Parametres required to open the page
* @param {HTMLElement} target The target for the user page
*/
open: function(params, target){
//Perform a request on the server to get the list of latest posts
ComunicWeb.components.posts.interface.get_latest(function(response){
//Check for errors - display a modal
if(response.error){
return;
}
//Display the list of posts
});
},
}

View File

@ -32,6 +32,15 @@ ComunicWeb.pagesList = {
disableMenus: false
},
/**
* Latest post
*/
latest: {
pageTitle: "Latest",
methodHandler: "ComunicWeb.pages.latestPosts.main.open",
disableMenus: false
},
/**
* Login page
*/

View File

@ -153,6 +153,9 @@ class Dev {
//Post page
"css/pages/postPage/main.css",
//Latest post page stylesheet
"css/pages/latestPosts/main.css",
);
/**
@ -273,6 +276,9 @@ class Dev {
//Post page
"js/pages/postPage/main.js",
//Latest posts page
"js/pages/latestPosts/main.js",
//Login page
"js/pages/login.js",