]> source.dussan.org Git - archiva.git/commitdiff
artifact detail view add js/html templates
authorOlivier Lamy <olamy@apache.org>
Mon, 19 Mar 2012 22:46:11 +0000 (22:46 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 19 Mar 2012 22:46:11 +0000 (22:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1302697 13f79535-47bb-0310-9956-ffa450edef68

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/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html

index 59209c3f96924a7166b79f4eb4b705676dfd6e9f..af4d18d0e2981da705bfdfda9a5b71785b64dfa7 100644 (file)
@@ -124,6 +124,7 @@ $(function() {
         displayRepositoriesGrid();
         return;
       }
+
       if (screen=="browse"){
         displayBrowse(true);
         return;
index eeeab61332e51da70b2e4667b9d69bc8d4aad01d..3968e3c64c75001f91d686e269e4a2b198d3d060 100644 (file)
@@ -82,6 +82,7 @@ $(function() {
 
   displayGroupDetail=function(groupId,parentBrowseViewModel,restUrl){
     var mainContent = $("#main-content");
+    mainContent.find("#browse_artifact_detail").hide();
     var browseResult=mainContent.find("#browse_result");
     browseResult.show();
     mainContent.find("#browse_artifact" ).hide();
@@ -137,14 +138,51 @@ $(function() {
     }
 
     displayArtifactVersionDetail=function(version){
-      $.log("displayArtifactVersionDetail:"+groupId+":"+artifactId+":"+version);
+      var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(self.groupId,self.artifactId,version,self);
+      artifactVersionDetailViewModel.display();
     }
 
   }
 
+  ArtifactVersionDetailViewModel=function(groupId,artifactId,version,artifactDetailViewModel){
+    var mainContent = $("#main-content");
+    var self=this;
+    this.groupId=groupId;
+    this.artifactId=artifactId;
+    this.version=version;
+    this.artifactDetailViewModel=artifactDetailViewModel;
+    this.projectVersionMetadata=null;
+    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);
+        }
+        if (self.artifactDetailViewModel && self.artifactDetailViewModel.projectVersionMetadata){
+          self.projectVersionMetadata=self.artifactDetailViewModel.projectVersionMetadata;
+          ko.applyBindings(self,mainContent.find("#browse_artifact_detail" ).get(0));
+        } else {
+          $.ajax(metadataUrl, {
+            type: "GET",
+            dataType: 'json',
+            success: function(data) {
+              self.projectVersionMetadata=mapProjectVersionMetadata(data);
+              ko.applyBindings(self,mainContent.find("#browse_artifact_detail" ).get(0));
+            }
+          });
+        }
+      });
+    }
+  }
+
   displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl){
     var artifactDetailViewModel=new ArtifactDetailViewModel(groupId,artifactId);
     var mainContent = $("#main-content");
+    mainContent.find("#browse_artifact_detail" ).hide();
     mainContent.find("#browse_result").hide();
     mainContent.find("#main_browse_result_content").hide("slide", {}, 300,function(){
       mainContent.find("#browse_breadcrumb").html(smallSpinnerImg());
@@ -218,7 +256,6 @@ $(function() {
 
   changeBrowseRepository=function(){
     var selectedRepository=getSelectedBrowsingRepository();
-    //displayBrowse(false,selectedRepository);
     displayGroupDetail(null,null,"restServices/archivaServices/browseService/rootGroups?repositoryId="+encodeURIComponent(selectedRepository));
   }
 
@@ -226,10 +263,9 @@ $(function() {
     var selectedOption=$("#main-content #select_browse_repository option:selected" );
     if (selectedOption.length>0){
       var repoId=selectedOption.val();
-      $.log("getSelectedBrowsingRepository:"+repoId);
       return repoId;
     }
-    $.log("getSelectedBrowsingRepository:none");
+    return null;
   }
 
   enableAutocompleBrowse=function(groupId){
index 0907916358705b83b0ca6cc09c8d2de1ce5d800a..0c5da7f25fa2bface00738e4f33698df16fe43fe 100644 (file)
@@ -29,6 +29,7 @@
       <div id="browse_breadcrumb" data-bind='template:{name:"browse-breadcrumb-tmpl"}'></div>
       <div id="browse_result" class="well" data-bind='template:{name:"browse-groups-tmpl"}'></div>
       <div id="browse_artifact" class="well" data-bind='template:{name:"browse-artifact-tmpl"}'></div>
+      <div id="browse_artifact_detail" class="well" data-bind='template:{name:"browse-artifact-detail-tmpl"}'></div>
     </div>
   </div>
 </script>
     <option value="${repository.id}">${repository.name}</option>
     {{/each}}
   </select>
+</script>
+
+<script id="browse-artifact-detail-tmpl" type="text/html">
+    <ul id="artifact-details-tabs" class="nav nav-tabs">
+      <li class="active">
+        <a data-toggle="tab" href="#artifact-details-info-content">${$.i18n.prop('artifact.detail.tab.header.info')}</a>
+      </li>
+      <li>
+        <a data-toggle="tab" href="#artifact-details-dependencies-content">${$.i18n.prop('artifact.detail.tab.header.dependencies')}</a>
+      </li>
+      <li>
+        <a data-toggle="tab" href="#artifact-details-dependency-tree-content">${$.i18n.prop('artifact.detail.tab.header.dependency.tree')}</a>
+      </li>
+      <li>
+        <a data-toggle="tab" href="#artifact-details-used-by-content">${$.i18n.prop('artifact.detail.tab.header.used.by')}</a>
+      </li>
+      <li>
+        <a data-toggle="tab" href="#artifact-details-mailing-list-content">${$.i18n.prop('artifact.detail.tab.header.mailing.list')}</a>
+      </li>
+      <li>
+        <a data-toggle="tab" href="#artifact-details-metadatas-content">${$.i18n.prop('artifact.detail.tab.header.metadatas')}</a>
+      </li>
+    </ul>
+    <div class="tab-content">
+         <div id="artifact-details-info-content" class="tab-pane active">
+        <blockquote>${projectVersionMetadata.description}</blockquote>
+        <div class="row span4">
+        <table class="table">
+          <tbody>
+            <tr>
+              <th>${$.i18n.prop('browse.artifact.groupId')}</th>
+              <td>${groupId}</td>
+            </tr>
+            <tr>
+              <th>${$.i18n.prop('browse.artifact.artifactId')}</th>
+              <td>${artifactId}</td>
+            </tr>
+            <tr>
+              <th>${$.i18n.prop('browse.artifact.version')}</th>
+              <td>${version}</td>
+            </tr>
+          </tbody>
+        </table>
+        </div>
+         </div>
+
+
+         <div id="artifact-details-dependencies-content" class="tab-pane">
+        dependencies
+         </div>
+
+      <div id="artifact-details-dependency-tree-content" class="tab-pane">
+        dependency tree
+      </div>
+
+      <div id="artifact-details-used-by-content" class="tab-pane">
+        used by
+      </div>
+
+      <div id="artifact-details-mailing-list-content" class="tab-pane">
+        mailing list
+      </div>
+
+      <div id="artifact-details-metadatas-content" class="tab-pane">
+        metadatas
+      </div>
+
+    </div>
 </script>
\ No newline at end of file