diff --git a/assets/css/pages/latestPosts/main.css b/assets/css/pages/latestPosts/main.css new file mode 100644 index 00000000..6e1dbb9e --- /dev/null +++ b/assets/css/pages/latestPosts/main.css @@ -0,0 +1,5 @@ +/** + * Latests post stylesheet + * + * @author Pierre HUBERT + */ \ No newline at end of file diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 2cfb42e9..4ed604b8 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -917,6 +917,20 @@ var ComunicWeb = { }, + /** + * Latest posts page + */ + latestPosts: { + + /** + * Main script + */ + main: { + //TODO: implement + }, + + }, + /** * Login controller */ diff --git a/assets/js/components/posts/interface.js b/assets/js/components/posts/interface.js index 8da17cb7..f00b6707 100644 --- a/assets/js/components/posts/interface.js +++ b/assets/js/components/posts/interface.js @@ -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 * diff --git a/assets/js/pages/home/home.js b/assets/js/pages/home/home.js index 02b096cc..bcfc328d 100644 --- a/assets/js/pages/home/home.js +++ b/assets/js/pages/home/home.js @@ -19,7 +19,7 @@ ComunicWeb.pages.home.home = { if(userLoggedIn){ //Open current user page - openPage("user/me"); + openPage("latest"); } else{ diff --git a/assets/js/pages/latestPosts/main.js b/assets/js/pages/latestPosts/main.js new file mode 100644 index 00000000..a389a3cb --- /dev/null +++ b/assets/js/pages/latestPosts/main.js @@ -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 + + }); + + }, +} \ No newline at end of file diff --git a/assets/js/pagesList.js b/assets/js/pagesList.js index 3237280a..db93df0e 100644 --- a/assets/js/pagesList.js +++ b/assets/js/pagesList.js @@ -32,6 +32,15 @@ ComunicWeb.pagesList = { disableMenus: false }, + /** + * Latest post + */ + latest: { + pageTitle: "Latest", + methodHandler: "ComunicWeb.pages.latestPosts.main.open", + disableMenus: false + }, + /** * Login page */ diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 785eabec..ef65ff62 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -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",