]> source.dussan.org Git - archiva.git/commitdiff
add a timestamp on template loading to prevent browser cache when developping. mode...
authorOlivier Lamy <olamy@apache.org>
Tue, 24 Jan 2012 18:22:58 +0000 (18:22 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 24 Jan 2012 18:22:58 +0000 (18:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1235393 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html

index 3f179e4250040c196ad0c8997caa4c636400634a..14d602c7e112f20fcbb9c11566959eeb371e16bc 100644 (file)
@@ -44,6 +44,7 @@ $.ajax(
   {
     url: "restServices/archivaServices/commonServices/devMode",
     success:function(data){
+        window.archivaDevMode=data=='true';
         require.config({
             baseUrl: "js/"
           });
@@ -52,7 +53,7 @@ $.ajax(
             AlwaysPreserveOrder:true,
             BasePath:"js/",
             explicit_preloading:false,
-            CacheBust:data=='true'
+            CacheBust:window.archivaDevMode
         };
         $LAB.setGlobalDefaults(options);
         $LAB
index 73d313e2112ea596f841bffde0c90c66e595634c..8acd644a6a2a4b56308e29ee5c021be0d8cdde30 100644 (file)
  * specific language governing permissions and limitations
  * under the License.
  */
-require(["text!archiva/templates/menu.html","text!archiva/templates/topbar.html","text!archiva/templates/message.html",
-          "text!archiva/templates/modal.html","text!archiva/templates/grids-generics.html","text!archiva/templates/repositories.html"],
+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()],
   function(menu,topbar,message,modal,grids_generics,repositories) {
 
     // template loading
index c52b5bf31ae182c3259403b06961680dfa6727c4..dced221f641eae59528f72cf46b390c63550622a 100644 (file)
@@ -21,13 +21,17 @@ function($) {
 
 $(function() {
 
+  // define a container object with various datas
+  window.archivaModel = {};
+
+  $.log("devMode:"+window.archivaDevMode);
+
   // no cache for ajax queries
   jQuery.ajaxSetup( {
-    cache: false
+    cache: !window.archivaDevMode
   } );
 
-  // define a container object with various datas
-  window.archivaModel = {};
+
 
   /**
    * reccord a cookie for session with the logged user
index 179b073133476f6afec50df2949ed75ca7276770..15f15a295eeb10bd7b6f6ff56dead7cd544bc2df 100644 (file)
@@ -295,4 +295,11 @@ customShowError=function(validator, errorMap, errorList) {
     field.parents( "div.clearfix" ).addClass( "error" );
     field.parent().append( "<span class=\"help-inline\">" + error.message + "</span>" );
   }
+}
+
+timestampNoCache=function(){
+  if (!window.archivaDevMode){
+    return "";
+  }
+  return "_="+jQuery.now();
 }
\ No newline at end of file
index d9b537a14062c7a6d96e39f149c317c5c75f2852..e61cf04ec4f217a424ce58e1e467328602cdbeac 100644 (file)
  * specific language governing permissions and limitations
  * under the License.
  */
-require(["text!redback/templates/user-edit.html", "text!redback/templates/user-grids.html", "text!redback/templates/login.html"
-          , "text!redback/templates/register-form.html","text!redback/templates/password-change-form.html"
-          ,"text!redback/templates/user-edit-form.html","text!redback/templates/roles-tmpl.html"],
+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()],
     function(useredit, usergrids, login,register,passwordchange,usereditform,roles) {
 
 
index 1c7e919b7d4349a617542e954501bf77553ce525..6f03d6351fffa214fb15f0539332de6a1e364a53 100644 (file)
           <th>${ columnDefinition.headerText }</th>
         {{/each}}
         <th>${$.i18n.prop('edit')}</th>
-
       </tr>
   </thead>
   <tbody>
       {{each(i, row) itemsOnCurrentPage()}}
           <tr>
               {{each(j, columnDefinition) columns}}
-              <td>${ typeof columnDefinition.rowText == 'function' ? columnDefinition.rowText(row) : row[columnDefinition.rowText] }</td>
+              {{var val = (typeof columnDefinition.rowText == 'function' ? columnDefinition.rowText(row) : row[columnDefinition.rowText])}}
+              <td id="role-description-${val}">
+                ${val}
+              </td>
               {{/each}}
               <td><a href="#" data-bind="click: function(){ window.redbackModel.rolesViewModel.editRole(row) }">Edit</a></td>
           </tr>