]> source.dussan.org Git - archiva.git/commitdiff
fix BreadCrumb when displaying artifact with version detail
authorOlivier Lamy <olamy@apache.org>
Mon, 19 Mar 2012 22:46:44 +0000 (22:46 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 19 Mar 2012 22:46:44 +0000 (22:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1302699 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html

index bbdddbcc30f6c25bcb853db53ceecaedf8d29a15..95cd54d482269852a8a14637512854c7f956a06f 100644 (file)
@@ -150,37 +150,51 @@ $(function() {
     this.groupId=groupId;
     this.artifactId=artifactId;
     this.version=version;
-    this.artifactDetailViewModel=artifactDetailViewModel;
     this.projectVersionMetadata=null;
+    breadCrumbEntries=function(){
+      var entries = calculateBreadCrumbEntries(self.groupId);
+      var artifactBreadCrumbEntry = new BreadCrumbEntry(self.groupId,self.artifactId);
+      artifactBreadCrumbEntry.artifactId=self.artifactId;
+      artifactBreadCrumbEntry.artifact=true;
+      entries.push(artifactBreadCrumbEntry);
+      entries.push(new BreadCrumbEntry("foo",self.version));
+      return entries;
+    }
     this.display=function(){
-      $.log("displayArtifactVersionDetail:"+self.groupId+":"+self.artifactId+":"+self.version);
-      mainContent.find("#browse_artifact").hide("slide", {}, 300,function(){
-        mainContent.find("#browse_artifact_detail").show();
-        mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg());
-        var metadataUrl="restServices/archivaServices/browseService/projectVersionMetadata/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId);
-        var selectedRepo=getSelectedBrowsingRepository();
-        if (selectedRepo){
-          metadataUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
-        }
+      mainContent.find("#browse_breadcrumb").hide("slide", {}, 300,function(){
+        mainContent.find("#browse_artifact").hide("slide", {}, 300,function(){
+          mainContent.find("#browse_artifact_detail").show();
+          mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg());
+          mainContent.find("#browse_breadcrumb" ).show();
+          mainContent.find("#browse_breadcrumb" ).html(mediumSpinnerImg());
+          var metadataUrl="restServices/archivaServices/browseService/projectVersionMetadata/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId);
+          var selectedRepo=getSelectedBrowsingRepository();
+          if (selectedRepo){
+            metadataUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
+          }
 
-        $.ajax(metadataUrl, {
-          type: "GET",
-          dataType: 'json',
-          success: function(data) {
-            self.projectVersionMetadata=mapProjectVersionMetadata(data);
-            ko.applyBindings(self,mainContent.find("#browse_artifact_detail" ).get(0));
-            mainContent.find("#artifact-details-tabs").on('show', function (e) {
-              if ($(e.target).attr("href")=="#artifact-details-dependency-tree-content") {
-                $.log("#artifact-details-dependency-tree-content");
-              }
-              if ($(e.target).attr("href")=="#artifact-details-used-by-content") {
-                $.log("#artifact-details-used-by-content");
-              }
+          $.ajax(metadataUrl, {
+            type: "GET",
+            dataType: 'json',
+            success: function(data) {
+              self.projectVersionMetadata=mapProjectVersionMetadata(data);
+              ko.applyBindings(self,mainContent.find("#browse_artifact_detail" ).get(0));
+              ko.applyBindings(self,mainContent.find("#browse_breadcrumb" ).get(0));
+              mainContent.find("#browse-autocomplete" ).hide();
+              mainContent.find("#browse-autocomplete-divider" ).hide();
+              mainContent.find("#artifact-details-tabs").on('show', function (e) {
+                if ($(e.target).attr("href")=="#artifact-details-dependency-tree-content") {
+                  $.log("#artifact-details-dependency-tree-content");
+                }
+                if ($(e.target).attr("href")=="#artifact-details-used-by-content") {
+                  $.log("#artifact-details-used-by-content");
+                }
+
+              });
+            }
+          });
 
-            });
-          }
         });
-
       });
     }
   }
index 0c5da7f25fa2bface00738e4f33698df16fe43fe..654e2e885d4d322824824d77019af1b71a3d8347 100644 (file)
         {{if i==(number-1)}}
           ${breadCrumbEntry.displayValue}
         {{else}}
-          <a href="#" data-bind="click: function(){displayGroupId(breadCrumbEntry.groupId)}">${breadCrumbEntry.displayValue}</a>
+          {{if breadCrumbEntry.artifact}}
+            <a href="#" data-bind="click: function(){displayArtifactDetail(breadCrumbEntry.groupId,breadCrumbEntry.artifactId,null,null)}">${breadCrumbEntry.displayValue}</a>
+          {{else}}
+            <a href="#" data-bind="click: function(){displayGroupId(breadCrumbEntry.groupId)}">${breadCrumbEntry.displayValue}</a>
+          {{/if}}
         {{/if}}
         {{if i<(number-1)}}
           <span class="divider">/</span>
@@ -82,7 +86,7 @@
     {{/each}}
     <li>
       {{if number>0}}
-        <span class="divider">/</span>
+        <span class="divider" id="browse-autocomplete-divider">/</span>
       {{/if}}
       <input type="text" class="form-search span4" size="50" id="browse-autocomplete"/>
     </li>