mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-29 15:26:27 +00:00
Created latest posts page.
This commit is contained in:
parent
d913b38a5d
commit
8ae6d01b4f
5
assets/css/pages/latestPosts/main.css
Normal file
5
assets/css/pages/latestPosts/main.css
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Latests post stylesheet
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
@ -917,6 +917,20 @@ var ComunicWeb = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Latest posts page
|
||||
*/
|
||||
latestPosts: {
|
||||
|
||||
/**
|
||||
* Main script
|
||||
*/
|
||||
main: {
|
||||
//TODO: implement
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Login controller
|
||||
*/
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -19,7 +19,7 @@ ComunicWeb.pages.home.home = {
|
||||
if(userLoggedIn){
|
||||
|
||||
//Open current user page
|
||||
openPage("user/me");
|
||||
openPage("latest");
|
||||
|
||||
}
|
||||
else{
|
||||
|
31
assets/js/pages/latestPosts/main.js
Normal file
31
assets/js/pages/latestPosts/main.js
Normal 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
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
}
|
@ -32,6 +32,15 @@ ComunicWeb.pagesList = {
|
||||
disableMenus: false
|
||||
},
|
||||
|
||||
/**
|
||||
* Latest post
|
||||
*/
|
||||
latest: {
|
||||
pageTitle: "Latest",
|
||||
methodHandler: "ComunicWeb.pages.latestPosts.main.open",
|
||||
disableMenus: false
|
||||
},
|
||||
|
||||
/**
|
||||
* Login page
|
||||
*/
|
||||
|
@ -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",
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user