]> source.dussan.org Git - archiva.git/commitdiff
simplify template url loading
authorOlivier Lamy <olamy@apache.org>
Mon, 26 Mar 2012 22:51:03 +0000 (22:51 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 26 Mar 2012 22:51:03 +0000 (22:51 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1305652 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/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/startup.js

index d2e6838bdf766178f9ef6a08f21e35ca95bface8..b7667532e70b69090d57f16e82ed022e94db55a6 100644 (file)
 
 <script type="text/javascript">
 
-        require.config({
-            baseUrl: "js/",
-            urlArgs: "_="+new Date().getTime(),
-            "paths": {
-                "i18n":"jquery.i18n.properties-1.0.9",
-                "jquery": "jquery-1.7.2",
-                "jquery_tmpl": "jquery.tmpl",
-                "utils": "archiva/utils",
-                "jquery_ui": "jquery-ui-1.8.16.custom.min",
-                "jquery_cookie": "jquery.cookie.1.0.0",
-                "bootstrap": "bootstrap.2.0.2",
-                "choosen": "chosen.jquery-0.9.7",
-                "jquery_validate": "jquery.validate-1.9.0",
-                "jquery_json": "jquery.json-2.3.min",
-                "knockout.simpleGrid": "knockout.simpleGrid",
-                "knockout": "knockout-2.0.0.debug",
-                "knockout.sortable": "knockout-sortable",
-                "redback": "redback/redback",
-                "general-admin":"archiva/general-admin",
-                "redback-templates": "redback/redback-tmpl",
-                "main-templates": "archiva/main-tmpl",
-                "repositories": "archiva/repositories",
-                "network-proxies": "archiva/network-proxies",
-                "proxy-connectors": "archiva/proxy-connectors",
-                "repository-groups": "archiva/repository-groups",
-                "roles": "redback/roles",
-                "user": "redback/user",
-                "users": "redback/users",
-                "archiva/main": "archiva/main"
-            }
-            // file upload dependencies
-            //.script("jquery.iframe-transport-1.4.js").wait()
-            //.script("jquery.fileupload-5.10.0.js").wait()
-            //.script("jquery.fileupload-ip-1.0.6.js").wait()
-            //.script("jquery.fileupload-ui-6.6.3.js" ).wait()
-        });
-        require(['order!domReady','order!jquery','order!i18n','order!startup'], function (domReady) {
-          domReady.withResources(function () {
-              loadi18n();
-              $.ajax({
-                  url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
-                  dataType: 'json',
-                  success:function(data){
-                      window.archivaDevMode=data.devMode;
-                      window.archivaJavascriptLog=data.javascriptLog;
-                      window.archivaRuntimeInfo=data;
-                      require(['order!domReady','archiva/main'],function (domReady) {
-                          domReady.withResources(function () {
-                              startArchivaApplication();
-                          })
-                        })
-                  }}
-              )
-          })
-        });
 
+    appendArchivaVersion=function(){
+      return "_archivaVersion="+window.archivaRuntimeInfo.version;
+    }
+
+    timestampNoCache=function(){
+      if (!window.archivaDevMode){
+        return "";
+      }
+      return "&_="+jQuery.now();
+    }
+
+    appendTemplateUrl=function(){
+      return appendArchivaVersion()+timestampNoCache();
+    }
+
+    $.ajax({
+        url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/en",
+        dataType: 'json',
+        success:function(data){
+
+            window.archivaDevMode=data.devMode;
+            window.archivaJavascriptLog=data.javascriptLog;
+            window.archivaRuntimeInfo=data;
+
+                require.config({
+                    baseUrl: "js/",
+                    urlArgs: ""+appendTemplateUrl(),
+                    paths: {
+                        "i18n":"jquery.i18n.properties-1.0.9",
+                        "jquery": "jquery-1.7.2",
+                        "jquery_tmpl": "jquery.tmpl",
+                        "utils": "archiva/utils",
+                        "jquery_ui": "jquery-ui-1.8.16.custom.min",
+                        "jquery_cookie": "jquery.cookie.1.0.0",
+                        "bootstrap": "bootstrap.2.0.2",
+                        "choosen": "chosen.jquery-0.9.7",
+                        "jquery_validate": "jquery.validate-1.9.0",
+                        "jquery_json": "jquery.json-2.3.min",
+                        "knockout.simpleGrid": "knockout.simpleGrid",
+                        "knockout": "knockout-2.0.0.debug",
+                        "knockout.sortable": "knockout-sortable",
+                        "redback": "redback/redback",
+                        "general-admin":"archiva/general-admin",
+                        "redback-templates": "redback/redback-tmpl",
+                        "main-templates": "archiva/main-tmpl",
+                        "repositories": "archiva/repositories",
+                        "network-proxies": "archiva/network-proxies",
+                        "proxy-connectors": "archiva/proxy-connectors",
+                        "repository-groups": "archiva/repository-groups",
+                        "roles": "redback/roles",
+                        "user": "redback/user",
+                        "users": "redback/users",
+                        "archiva/main": "archiva/main"
+                    }
+                    // file upload dependencies
+                    //.script("jquery.iframe-transport-1.4.js").wait()
+                    //.script("jquery.fileupload-5.10.0.js").wait()
+                    //.script("jquery.fileupload-ip-1.0.6.js").wait()
+                    //.script("jquery.fileupload-ui-6.6.3.js" ).wait()
+                });
+
+
+
+
+                require(['order!domReady','order!jquery','order!i18n','order!startup'], function (domReady) {
+                  domReady.withResources(function () {
+                      $.ajax({
+                          url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
+                          dataType: 'json',
+                          success:function(data){
+                              window.archivaDevMode=data.devMode;
+                              window.archivaJavascriptLog=data.javascriptLog;
+                              window.archivaRuntimeInfo=data;
+
+
+                              require(['order!domReady','archiva/main'],function (domReady) {
+                                  domReady.withResources(function () {
+                                      startArchivaApplication();
+                                  })
+                              })
+
+
+
+                          }
+                      })
+                  })
+                });
+        }
+    })
 
 
 </script>
index fdc5d5325a655a9ddff54fde4343d7324784f50d..6dafd15c8db32c30e514182f8c1186f74717b3ae 100644 (file)
  * specific language governing permissions and limitations
  * under the License.
  */
-define("main-templates",["text!js/archiva/templates/menu.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(),
-          "text!js/archiva/templates/repository-groups.html"+appendTemplateUrl(),
-          "text!js/archiva/templates/search.html"+appendTemplateUrl(),
-          "text!js/archiva/templates/general-admin.html"+appendTemplateUrl(),
+define("main-templates",["text!archiva/templates/menu.html",
+          "text!archiva/templates/message.html",
+          "text!archiva/templates/modal.html",
+          "text!archiva/templates/grids-generics.html",
+          "text!archiva/templates/repositories.html",
+          "text!archiva/templates/network-proxies.html",
+          "text!archiva/templates/proxy-connectors.html",
+          "text!archiva/templates/repository-groups.html",
+          "text!archiva/templates/search.html",
+          "text!archiva/templates/general-admin.html",
           "jquery_tmpl","utils"],
   function(menu,message,modal,grids_generics,repositories,network_proxies,proxies_connectors,
            repository_groups,search,general_admin) {
index 2f4a9031feb0b9f355e421e4b775d0dddec4647d..c1599fa5354db8d4a999080a0f2f372bb142aa44 100644 (file)
@@ -318,6 +318,14 @@ define("utils",["jquery","i18n","jquery_tmpl"], function() {
     }
   }
 
+  appendArchivaVersion=function(){
+    return "_archivaVersion="+window.archivaRuntimeInfo.version;
+  }
+
+  buildLoadJsUrl=function(srcScript){
+    return srcScript+"?"+appendArchivaVersion()+"&_"+jQuery.now();
+  }
+
   timestampNoCache=function(){
     if (!window.archivaDevMode){
       return "";
@@ -325,9 +333,6 @@ define("utils",["jquery","i18n","jquery_tmpl"], function() {
     return "&_="+jQuery.now();
   }
 
-  appendTemplateUrl=function(){
-    return "?"+appendArchivaVersion()+timestampNoCache();
-  }
 
   /**
    * mapping for a java Map entry
index 77cc757dec5d51125c62f87d19f19aebb675a7d5..91ce0feb042d909e8302b5bb97a20e998746cbd1 100644 (file)
  * specific language governing permissions and limitations
  * under the License.
  */
-define("redback-templates",["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(),
+define("redback-templates",["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",
           "jquery_tmpl","utils"],
     function(useredit, usergrids, login,register,passwordchange,usereditform,roles) {
 
index 1ec5fc6e13eaa6600880ef486d5dd2d21a06b204..481d0df4400715995611fca3c606f2c77c19480e 100644 (file)
 define("startup",["jquery","utils"],
 function() {
 
-
-  appendArchivaVersion=function(){
-    return "_archivaVersion="+window.archivaRuntimeInfo.version;
-  }
-
-  buildLoadJsUrl=function(srcScript){
-    return srcScript+"?"+appendArchivaVersion()+"&_"+jQuery.now();
-  }
-
-
   // define a container object with various datas
   window.archivaModel = {};
 
@@ -39,6 +29,6 @@ function() {
   jQuery.ajaxSetup( {
     cache: false,//!window.archivaDevMode
     dataType: 'json'
-  } );
-
+  });
+  loadi18n();
 });
\ No newline at end of file