]> source.dussan.org Git - archiva.git/commitdiff
move start js to a separate js file (index.html is only html now :-) )
authorOlivier Lamy <olamy@apache.org>
Thu, 23 Aug 2012 12:51:03 +0000 (12:51 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 23 Aug 2012 12:51:03 +0000 (12:51 +0000)
make jquery.tmpl.js as a require module to help loading

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376471 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/archiva.js [new file with mode: 0644]
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/jquery.tmpl.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js

index 732ffcbf36248f2656727a50ad4650715f58adad..e1c4efb0a69956f59d19350fecc156e811ed33d4 100644 (file)
@@ -33,7 +33,7 @@
 
   <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
   <script type="text/javascript" src="js/sammy.0.7.1.js"></script>
-  <script type="text/javascript" src="js/require.2.0.6.js"></script>
+  <script type="text/javascript" data-main="js/archiva/archiva.js" src="js/require.2.0.6.js"></script>
 
   <title>Apache Archiva</title>
 
 <div id="dialog-confirm" title="" style="display: none">
 </div>
 
-
-
-<script type="text/javascript">
-
-    appendArchivaVersion=function(){
-      return "_archivaVersion="+window.archivaRuntimeInfo.version;
-    }
-
-    timestampNoCache=function(){
-      if (window.archivaRuntimeInfo.version.match("SNAPSHOT$")=="SNAPSHOT"){
-        return "&archivaTimestamp="+window.archivaRuntimeInfo.timestamp+(window.archivaRuntimeInfo.devMode?"&_="+jQuery.now():"");
-      }
-      return "";
-    }
-
-    appendTemplateUrl=function(){
-      return appendArchivaVersion()+timestampNoCache();
-    }
-
-    appendJsNoCacheUrl=function(){
-      return appendArchivaVersion()+timestampNoCache();
-    }
-
-    $.ajax({
-        url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/en",
-        dataType: 'json',
-        cache: false,
-        success:function(data){
-
-            window.archivaDevMode=data.devMode;
-            window.archivaJavascriptLog=data.javascriptLog;
-            window.archivaRuntimeInfo=data;
-
-                require.config({
-                    baseUrl: "js/",
-                    urlArgs: ""+appendJsNoCacheUrl(),
-                    shim: {
-                            'sammy':['jquery'],
-                            'archiva.main':["jquery","sammy"]
-                          },
-                    paths: {
-                        "i18n":"jquery.i18n.properties-1.0.9",
-                        "jquery": "jquery-1.8.0.min",
-                        "jquery.tmpl": "jquery.tmpl",
-                        "utils": "archiva/utils",
-                        "startup": "archiva/startup",
-                        "jquery.ui": "jquery-ui-1.8.16.custom.min",
-                        "jquery.ui.widget": "jquery.ui.widget-1.8.18",
-                        "jquery.cookie": "jquery.cookie.1.0.0",
-                        "bootstrap": "bootstrap.2.1.0",
-                        "choosen": "chosen.jquery-0.9.8",
-                        "jquery.validate": "jquery.validate-1.9.0",
-                        "jquery.json": "jquery.json-2.3.min",
-                        "knockout": "knockout-2.0.0.debug",
-                        "knockout.simpleGrid": "knockout.simpleGrid",
-                        "knockout.sortable": "knockout-sortable",
-                        "jquery.iframe.transport": "jquery.iframe-transport-1.4",
-                        "jquery.fileupload": "jquery.fileupload-5.10.0",
-                        "jquery.fileupload.ip":"jquery.fileupload-ip-1.0.6",
-                        "jquery.fileupload.ui":"jquery.fileupload-ui-6.6.3",
-                        "tmpl": "tmpl.min",
-                        "prettify": "prettify",
-                        "sammy": "sammy.0.7.1",
-                        "jqueryFileTree": "jqueryFileTree-1.0.1",
-                        "redback": "redback/redback",
-                        "redback.roles": "redback/roles",
-                        "redback.user": "redback/user",
-                        "redback.users": "redback/users",
-                        "redback.templates": "redback/redback-tmpl",
-                        "archiva.general-admin":"archiva/general-admin",
-                        "archiva.templates": "archiva/main-tmpl",
-                        "archiva.repositories": "archiva/repositories",
-                        "archiva.network-proxies": "archiva/network-proxies",
-                        "archiva.proxy-connectors": "archiva/proxy-connectors",
-                        "archiva.repository-groups": "archiva/repository-groups",
-                        "archiva.artifacts-management": "archiva/artifacts-management",
-                        "archiva.search": "archiva/search",
-                        "archiva.main": "archiva/main"
-                    }
-                });
-
-                requirejs(['jquery','jquery.tmpl','i18n','sammy','startup','utils','domReady!'], function (domReady) {
-                    loadi18n(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(['sammy','archiva.main','domReady!'],function (domReady) {
-                                  startArchivaApplication();
-                                  $("#loadingDiv").hide();
-                              })
-                          }
-                        })
-                    })
-                });
-        }
-    })
-
-
-</script>
-
 <div id="loadingDiv">
   <div class="loading-indicator">
     <img src="images/medium-spinner.gif" />
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/archiva.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/archiva.js
new file mode 100644 (file)
index 0000000..2342290
--- /dev/null
@@ -0,0 +1,100 @@
+appendArchivaVersion=function(){
+  return "_archivaVersion="+window.archivaRuntimeInfo.version;
+}
+
+timestampNoCache=function(){
+  if (window.archivaRuntimeInfo.version.match("SNAPSHOT$")=="SNAPSHOT"){
+    return "&archivaTimestamp="+window.archivaRuntimeInfo.timestamp+(window.archivaRuntimeInfo.devMode?"&_="+jQuery.now():"");
+  }
+  return "";
+}
+
+appendTemplateUrl=function(){
+  return appendArchivaVersion()+timestampNoCache();
+}
+
+appendJsNoCacheUrl=function(){
+  return appendArchivaVersion()+timestampNoCache();
+}
+
+$.ajax({
+    url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/en",
+    dataType: 'json',
+    cache: false,
+    success:function(data){
+
+        window.archivaDevMode=data.devMode;
+        window.archivaJavascriptLog=data.javascriptLog;
+        window.archivaRuntimeInfo=data;
+
+            requirejs.config({
+                baseUrl: "js/",
+                urlArgs: ""+appendJsNoCacheUrl(),
+                shim: {
+                      'sammy':['jquery','jquery.tmpl'],
+                      'archiva.main':['jquery','sammy','jquery.tmpl'],
+                      'utils':['jquery','jquery.tmpl'],
+                      'archiva.templates': ['jquery','jquery.tmpl','utils'],
+                      'redback.templates': ['jquery','jquery.tmpl','utils']
+                      },
+                paths: {
+                    "i18n":"jquery.i18n.properties-1.0.9",
+                    "jquery": "jquery-1.8.0.min",
+                    "jquery.tmpl": "jquery.tmpl",
+                    "utils": "archiva/utils",
+                    "startup": "archiva/startup",
+                    "jquery.ui": "jquery-ui-1.8.16.custom.min",
+                    "jquery.ui.widget": "jquery.ui.widget-1.8.18",
+                    "jquery.cookie": "jquery.cookie.1.0.0",
+                    "bootstrap": "bootstrap.2.1.0",
+                    "choosen": "chosen.jquery-0.9.8",
+                    "jquery.validate": "jquery.validate-1.9.0",
+                    "jquery.json": "jquery.json-2.3.min",
+                    "knockout": "knockout-2.0.0.debug",
+                    "knockout.simpleGrid": "knockout.simpleGrid",
+                    "knockout.sortable": "knockout-sortable",
+                    "jquery.iframe.transport": "jquery.iframe-transport-1.4",
+                    "jquery.fileupload": "jquery.fileupload-5.10.0",
+                    "jquery.fileupload.ip":"jquery.fileupload-ip-1.0.6",
+                    "jquery.fileupload.ui":"jquery.fileupload-ui-6.6.3",
+                    "tmpl": "tmpl.min",
+                    "prettify": "prettify",
+                    "sammy": "sammy.0.7.1",
+                    "jqueryFileTree": "jqueryFileTree-1.0.1",
+                    "redback": "redback/redback",
+                    "redback.roles": "redback/roles",
+                    "redback.user": "redback/user",
+                    "redback.users": "redback/users",
+                    "redback.templates": "redback/redback-tmpl",
+                    "archiva.general-admin":"archiva/general-admin",
+                    "archiva.templates": "archiva/main-tmpl",
+                    "archiva.repositories": "archiva/repositories",
+                    "archiva.network-proxies": "archiva/network-proxies",
+                    "archiva.proxy-connectors": "archiva/proxy-connectors",
+                    "archiva.repository-groups": "archiva/repository-groups",
+                    "archiva.artifacts-management": "archiva/artifacts-management",
+                    "archiva.search": "archiva/search",
+                    "archiva.main": "archiva/main"
+                }
+            });
+
+            requirejs(['jquery','jquery.tmpl','i18n','sammy','startup','utils','domReady!'], function (domReady) {
+                loadi18n(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(['sammy','jquery','jquery.tmpl','archiva.main','utils','domReady!'],function (domReady) {
+                              startArchivaApplication();
+                              $("#loadingDiv").hide();
+                          })
+                      }
+                    })
+                })
+            });
+    }
+})
index 4764863f366a633445881de770e3cc2deaeb5131..72fb7ab9800d5b66418835140126b0ce9110a03f 100644 (file)
  * specific language governing permissions and limitations
  * under the License.
  */
-define("archiva.templates",["jquery.tmpl","utils","text!templates/archiva/menu.html",
+require(['jquery',"jquery.tmpl","utils","text!templates/archiva/menu.html",
           "text!templates/archiva/generics.html",
           "text!templates/archiva/modal.html",
           "text!templates/archiva/repositories.html",
           "text!templates/archiva/search.html",
           "text!templates/archiva/general-admin.html"],
-  function(jqueryTmpl,utils,menu,generics,modal,repositories,
+  function(jquery,jqueryTmpl,utils,menu,generics,modal,repositories,
            search,general_admin) {
 
     var htmlFragment=$("#html-fragments");
index f4f1966af27f2daabe474e2f8014195dfb9d51c0..93299d01b12d24734f1cba30bb4161027a97719b 100644 (file)
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-define("archiva.main",["jquery","sammy","jquery.ui","jquery.cookie","bootstrap","archiva.search",
+define("archiva.main",["jquery","sammy","jquery.tmpl","jquery.ui","jquery.cookie","bootstrap","archiva.search",
          "jquery.validate","jquery.json","knockout","redback.templates","archiva.templates",
           "redback.roles","redback","archiva.general-admin","archiva.repositories",
           "archiva.network-proxies","archiva.proxy-connectors","archiva.repository-groups","archiva.artifacts-management"],
@@ -593,16 +593,5 @@ function() {
   }
 
 
-  //-----------------------------------------
-  // extends jquery tmpl to support var def
-  //-----------------------------------------
-
-  $.extend($.tmpl.tag, {
-      "var": {
-          open: "var $1;"
-      }
-  });
-
-
 });
 
index 8502354f091711fa73356d6ddc25d6104dd206bf..7ae911abbbe056e85d399bf10619c16d367d4a68 100644 (file)
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define("utils",["jquery","jquery.tmpl","i18n"], function() {
+require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
 
   loadi18n=function(loadCallback){
     $.log("loadi18n");
@@ -426,6 +426,16 @@ define("utils",["jquery","jquery.tmpl","i18n"], function() {
     return this.substring(idx);
   }
 
+  //-----------------------------------------
+  // extends jquery tmpl to support var def
+  //-----------------------------------------
 
+  $(function() {
+    $.extend($.tmpl.tag, {
+        "var": {
+            open: "var $1;"
+        }
+    });
+  });
 
 });
\ No newline at end of file
index 7e850f9d061d1e833dd90c1b47d4fbb12483ec0f..c10fc8f759a09ebc605deac678b9355e80252593 100644 (file)
@@ -7,7 +7,11 @@
  * Dual licensed under the MIT or GPL Version 2 licenses.
  * http://jquery.org/license
  */
-(function( jQuery, undefined ){
+
+define("jquery.tmpl",["jquery"],
+function() {
+
+//(function( jQuery, undefined ){
        var oldManip = jQuery.fn.domManip, tmplItmAtt = "_tmplitem", htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
                newTmplItems = {}, wrappedItems = {}, appendToTmplItems, topTmplItem = { key: 0, data: {} }, itemKey = 0, cloneIndex = 0, stack = [];
 
                jQuery.tmpl( null, null, null, this).insertBefore( coll[0] );
                jQuery( coll ).remove();
        }
-})( jQuery );
+//})( jQuery );
+
+
+
+});
\ No newline at end of file
index a177bc16c73187d8eb3e362d508b5cddeedbe294..7817e4a8983a1fb55a78f2774545604de50122e3 100644 (file)
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-define("redback.templates",["jquery.tmpl","utils","text!templates/redback/user-edit.html",
+require(['jquery',"jquery.tmpl","utils","text!templates/redback/user-edit.html",
           "text!templates/redback/login.html"],
-    function(jqueryTmpl,utils,useredit, login) {
+    function(jquery,jqueryTmpl,utils,useredit, login) {
 
       var htmlFragment=$("#html-fragments");