ComunicWeb/assets/js/pages/home/home.js

33 lines
923 B
JavaScript
Raw Permalink Normal View History

/**
* Common homes functions
2017-02-18 17:37:36 +00:00
*
* @author Pierre HUBERT
*/
ComunicWeb.pages.home.home = {
/**
* Open home page
2017-02-18 17:37:36 +00:00
*
* @param {Object} additionnalData Additionnal data passed in the method
* @param {element} targetElement Where the template will be applied
* @returns {Boolean} False if it fails
*/
openHomePage: function(additionnalData, targetElement){
//Check wether if user is logged in or not
var userLoggedIn = ComunicWeb.user.userLogin.getUserLoginState();
2017-05-22 16:12:50 +00:00
//Check if user is in or not
if(userLoggedIn){
2017-03-01 14:37:55 +00:00
//Open current user page
2018-05-11 06:03:32 +00:00
ComunicWeb.pages.latestPosts.main.open(additionnalData, targetElement);
2017-06-05 14:03:14 +00:00
}
else{
2017-05-22 16:12:50 +00:00
//Display landing page
ComunicWeb.pages.home.landingPage.display(targetElement);
}
//Everything seems to be OK
return true;
}
};