archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1370412 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva: main.js search.js
Date Tue, 07 Aug 2012 18:13:06 GMT
Author: olamy
Date: Tue Aug  7 18:13:05 2012
New Revision: 1370412

URL: http://svn.apache.org/viewvc?rev=1370412&view=rev
Log:
use navigation when browsing with autocomplete

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js?rev=1370412&r1=1370411&r2=1370412&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
Tue Aug  7 18:13:05 2012
@@ -205,18 +205,14 @@ function() {
           return;
 
         });
-        this.get('#artifact:repositoryId/:groupId/:artifactId/:version',function(context){
+        this.get('#artifact/:groupId/:artifactId/:version',function(context){
 
           var repositoryId = this.params.repositoryId;
           var groupId= this.params.groupId;
           var artifactId= this.params.artifactId;
           var version= this.params.version;
+          generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
 
-          if(!version){
-            displayBrowseArtifactDetail(splitted[0],splitted[1]);//,null,null);
-          } else {
-            generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
-          }
         });
         this.get('#browse/:groupId',function(context){
           var groupId = this.params.groupId;

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js?rev=1370412&r1=1370411&r2=1370412&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
Tue Aug  7 18:13:05 2012
@@ -598,6 +598,37 @@ define("archiva.search",["jquery","i18n"
     artifactVersionDetailViewModel.display();
   }
 
+  goToBrowseArtifactDetail=function(groupId, artifactId){
+    $.log("goToBrowseArtifactDetail:"+groupId+":"+artifactId);
+    displayBrowseGroupId(groupId,null,null);
+    displayArtifactDetail(groupId,artifactId,null,null);
+  }
+
+  /**
+   *
+   */
+  displayBrowseGroupId=function(groupId,repositoryId,artifactId){
+    clearUserMessages();
+    $.log("displayBrowseGroupId:"+groupId+":"+repositoryId);
+    userRepositoriesCall(
+        function(data){
+          var mainContent = $("#main-content");
+          mainContent.html($("#browse-tmpl" ).tmpl());
+          mainContent.find("#browse_result").html(mediumSpinnerImg());
+          var parentBrowseViewModel=new BrowseViewModel(null,null,null,repositoryId);
+          var url="restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
+          if (repositoryId){
+            url+="?repositoryId="+repositoryId;
+            mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl"
).tmpl({repositories:data,selected:repositoryId}));
+          }else{
+            mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl"
).tmpl({repositories:data,selected:""}));
+          }
+          displayGroupDetail(groupId,parentBrowseViewModel,url,repositoryId);
+        }
+    );
+
+  }
+
   /**
    *
    * @param groupId
@@ -606,6 +637,7 @@ define("archiva.search",["jquery","i18n"
    * @param restUrl
    */
   displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl){
+    $.log("displayArtifactDetail:"+groupId+":"+artifactId);
     var artifactDetailViewModel=new ArtifactDetailViewModel(groupId,artifactId);
     var mainContent = $("#main-content");
     mainContent.find("#browse_artifact_detail" ).hide();
@@ -808,7 +840,14 @@ define("archiva.search",["jquery","i18n"
           var artifactId=values[values.length-1];
           displayArtifactDetail(groupId,artifactId,self);
         } else {
-          displayBrowseGroupIdFromAutoComplete(ui.item.name);
+          var selectedRepo=getSelectedBrowsingRepository();
+          var location ="#browse";
+          if (selectedRepo){
+            location+="~"+selectedRepo;
+          }
+          location+="/"+ui.item.name;
+          window.sammyArchivaApplication.setLocation(location);
+          //displayBrowseGroupIdFromAutoComplete(ui.item.name);
         }
         return false;
       }
@@ -832,43 +871,11 @@ define("archiva.search",["jquery","i18n"
     displayGroupDetail(groupId,parentBrowseViewModel,null);
   }
 
-  /**
-   * called if browser url contains queryParam browse=groupId
-   * @param groupId
-   */
-  displayBrowseGroupId=function(groupId,repositoryId){
-    clearUserMessages();
-    $.log("displayBrowseGroupId:"+groupId+":"+repositoryId);
-    userRepositoriesCall(
-        function(data){
-          var mainContent = $("#main-content");
-          mainContent.html($("#browse-tmpl" ).tmpl());
-          mainContent.find("#browse_result").html(mediumSpinnerImg());
-          var parentBrowseViewModel=new BrowseViewModel(null,null,null,repositoryId);
-          var url="restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
-          if (repositoryId){
-            url+="?repositoryId="+repositoryId;
-            mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl"
).tmpl({repositories:data,selected:repositoryId}));
-          }else{
-            mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl"
).tmpl({repositories:data,selected:""}));
-          }
-          displayGroupDetail(groupId,parentBrowseViewModel,url,repositoryId);
-        }
-    );
-
-  }
-
   displayBrowseArtifactDetail=function(groupId, artifactId){
     $.log("displayBrowseArtifactDetail");
     window.sammyArchivaApplication.setLocation("#artifact/"+groupId+"/"+artifactId);
   }
 
-  goToBrowseArtifactDetail=function(groupId, artifactId){
-    $.log("displayBrowseArtifactDetail");
-    displayBrowseGroupId(groupId);
-    displayArtifactDetail(groupId,artifactId,null,null);
-  }
-
   mapBrowseResultEntries=function(data){
     $.log("mapBrowseResultEntries");
     if (data.browseResultEntries) {



Mime
View raw message