From 73dfc842afe7e56cf70086a3a1a9d1d781c41fed Mon Sep 17 00:00:00 2001 From: Pierre Date: Tue, 15 May 2018 21:32:02 +0200 Subject: [PATCH] Site current URI can now be easily updated. --- assets/js/common/functionsSchema.js | 5 +++++ assets/js/common/page.js | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 10032dad..9d57d95c 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -191,6 +191,11 @@ var ComunicWeb = { */ refresh_current_page: function(){}, + /** + * Safely trigger URL update + */ + update_uri: function(title, uri){}, + /** * Inform of page location update */ diff --git a/assets/js/common/page.js b/assets/js/common/page.js index f6dd80aa..4b5a5fb5 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -188,10 +188,7 @@ ComunicWeb.common.page = { //Change page URL, if required if(additionnalData.no_url_update ? !additionnalData.no_url_update : true) - ComunicWeb.common.url.changeURI(document.title, pageURI); - - //Save new url - this._current_url = window.location.href.toString(); + this.update_uri(document.title, pageURI); //Get the main container of the page var mainContainerElem = byId("wrapper"); @@ -278,6 +275,21 @@ ComunicWeb.common.page = { this.openPage(currentPage, {no_url_update: true}); }, + /** + * Safely trigger URL update + * + * @param {String} title The new title of the page + * @param {String} uri The new URL + */ + update_uri: function(title, uri){ + + //Trigger URL update + ComunicWeb.common.url.changeURI(title, uri); + + //Save new url + this._current_url = window.location.href.toString(); + }, + /** * Inform of page location update *