From bf79c91f8c858b0d53f57392937ed16fbb1de819 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 30 Jan 2012 14:57:39 +0000 Subject: [PATCH] add archivaVersion in js/tmpl url loading to prevent browser cache issue when users upgrade version git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1237694 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/index.html | 60 ++++++++++--------- .../src/main/webapp/js/archiva/main-tmpl.js | 14 +++-- .../src/main/webapp/js/archiva/utils.js | 6 +- .../main/webapp/js/redback/redback-tmpl.js | 12 ++-- 4 files changed, 53 insertions(+), 39 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html index a3cad210a..62a42ad6d 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html @@ -46,6 +46,12 @@ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js index bfd0c8fb8..f9aec9d65 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -require(["text!archiva/templates/menu.html?"+timestampNoCache(),"text!archiva/templates/topbar.html?"+timestampNoCache(), - "text!archiva/templates/message.html?"+timestampNoCache(),"text!archiva/templates/modal.html?"+timestampNoCache(), - "text!archiva/templates/grids-generics.html?"+timestampNoCache(), - "text!archiva/templates/repositories.html?"+timestampNoCache(), - "text!archiva/templates/network-proxies.html?"+timestampNoCache(), - "text!archiva/templates//proxy-connectors.html?"+timestampNoCache()], +require(["text!js/archiva/templates/menu.html"+appendTemplateUrl(), + "text!js/archiva/templates/topbar.html"+appendTemplateUrl(), + "text!js/archiva/templates/message.html?"+appendTemplateUrl(), + "text!js/archiva/templates/modal.html?"+appendTemplateUrl(), + "text!js/archiva/templates/grids-generics.html?"+appendTemplateUrl(), + "text!js/archiva/templates/repositories.html?"+appendTemplateUrl(), + "text!js/archiva/templates/network-proxies.html?"+appendTemplateUrl(), + "text!js/archiva/templates//proxy-connectors.html?"+appendTemplateUrl()], function(menu,topbar,message,modal,grids_generics,repositories,network_proxies,proxies_connectors) { // template loading diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index 7be5da426..0e89557bf 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -304,5 +304,9 @@ timestampNoCache=function(){ if (!window.archivaDevMode){ return ""; } - return "_="+jQuery.now(); + return "&_="+jQuery.now(); +} + +appendTemplateUrl=function(){ + return "?"+appendArchivaVersion()+timestampNoCache(); } \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js index e61cf04ec..d1453bae0 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js @@ -16,11 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -require(["text!redback/templates/user-edit.html?"+timestampNoCache(), "text!redback/templates/user-grids.html?"+timestampNoCache(), - "text!redback/templates/login.html?"+timestampNoCache(), "text!redback/templates/register-form.html?"+timestampNoCache(), - "text!redback/templates/password-change-form.html?"+timestampNoCache(), - "text!redback/templates/user-edit-form.html?"+timestampNoCache(), - "text!redback/templates/roles-tmpl.html?"+timestampNoCache()], +require(["text!js/redback/templates/user-edit.html?"+appendTemplateUrl(), + "text!js/redback/templates/user-grids.html?"+appendTemplateUrl(), + "text!js/redback/templates/login.html?"+appendTemplateUrl(), + "text!js/redback/templates/register-form.html?"+appendTemplateUrl(), + "text!js/redback/templates/password-change-form.html?"+appendTemplateUrl(), + "text!js/redback/templates/user-edit-form.html?"+appendTemplateUrl(), + "text!js/redback/templates/roles-tmpl.html?"+appendTemplateUrl()], function(useredit, usergrids, login,register,passwordchange,usereditform,roles) { -- 2.39.5