From fc50439f7f66f229c49fc757f66aff8cdd0e0307 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 28 Aug 2012 09:07:49 +0000 Subject: [PATCH] make browsing artifact content navigable. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1378029 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/css/archiva.css | 3 ++ .../src/main/webapp/js/archiva/main.js | 30 ++++++++++++++++++- .../src/main/webapp/js/archiva/search.js | 10 ++++++- .../webapp/js/templates/archiva/search.html | 11 +++---- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/archiva.css b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/archiva.css index e14681631..f145eb09f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/archiva.css +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/archiva.css @@ -81,7 +81,10 @@ } .browse-list-project{ list-style-image: url("../images/folder-saved-search.png"); +} +.package-list{ + list-style-image: url("../images/package-x-generic.png"); } .force-upper-case{ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js index 0dc0da9bc..b55de7d8d 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js @@ -311,10 +311,11 @@ function(jquery,ui,sammy,tmpl) { var checkArtifactDetailContent=function(groupId,artifactId,version,repositoryId,tabToActivate,idContentToCheck,contentDisplayFn){ // no need to recalculate all stuff just activate the tab var htmlId = idContentToCheck?idContentToCheck:"browse_artifact_detail"; - var htmlIdSelect = $("#main-content #"+htmlId ); + var htmlIdSelect = $("#main-content").find("#"+htmlId ); if(htmlIdSelect.html()!=null){ if( $.trim(htmlIdSelect.html().length)>0){ $("#main-content #"+tabToActivate).tab('show'); + $.log("checkArtifactDetailContent " + htmlId + " html not empty no calculation"); return; } } @@ -365,6 +366,33 @@ function(jquery,ui,sammy,tmpl) { checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-dependencies-content-a"); }); + this.get('#artifact-details-files-content/: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; + + checkArtifactDetailContent(groupId,artifactId,version,null,"artifact-details-files-content-a","artifact-details-files-content", + function(groupId,artifactId,version,artifactVersionDetailViewModel){ + displayArtifactFilesContent(artifactVersionDetailViewModel); + }); + + }); + + this.get('#artifact-details-files-content~:repositoryId/: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; + checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-files-content-a","artifact-details-files-content", + function(groupId,artifactId,version,artifactVersionDetailViewModel){ + displayArtifactFilesContent(artifactVersionDetailViewModel); + }); + }); + + this.get('#artifact-dependency-tree/:groupId/:artifactId/:version',function(context){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index 12391a106..880b12a89 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -341,7 +341,15 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno return; } if ($(e.target).attr("href")=="#artifact-details-files-content") { - displayArtifactFilesContent(self); + //displayArtifactFilesContent(self); + var location ="#artifact-details-files-content"; + if (self.repositoryId){ + location+="~"+self.repositoryId; + } + location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version; + + window.sammyArchivaApplication.setLocation(location); + return; } }); if(afterCallbackFn){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html index 5761389b4..821a7f00d 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html @@ -638,14 +638,11 @@ -
-
+
-
-
+
-
-
+
@@ -825,7 +822,7 @@