]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1620] add a tab to browse artifact content in artifact detail view
authorOlivier Lamy <olamy@apache.org>
Wed, 16 May 2012 22:19:21 +0000 (22:19 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 16 May 2012 22:19:21 +0000 (22:19 +0000)
fix browsing view

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1339400 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/jqueryFileTree-1.0.1.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html

index 8b8d609e23134723153d0f9655becb9eb4178686..d3b6219d7ca6b01548bccfae3698de51fee7eae8 100644 (file)
@@ -387,6 +387,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
     this.path=path;
     this.file=file;
     this.depth=depth;
+    this.text="";
   }
 
   mapArtifactContentEntries=function(data){
index 467eeea212124e7e05fee4a193ea40b61abd3366..289b8e329b035a9a4ea896d270e9f38ebcafb893 100755 (executable)
@@ -53,7 +53,13 @@ if(jQuery) (function($){
                                        $(".jqueryFileTree.start").remove();
                                        $.get(o.script, { p: t }, function(data) {
             $(c).find('.start').html('');
-            var htmlContent = $("#artifact_content_tree_partial" ).tmpl({artifactContentEntries:mapArtifactContentEntries(data)});
+            var artifactContentEntries=mapArtifactContentEntries(data);
+            $(artifactContentEntries ).each(function(idx, elem){
+              elem.text=elem.path.substr( t.length, elem.path.length);
+            });
+            var htmlContent = $("#artifact_content_tree_partial" ).tmpl(
+                {artifactContentEntries:artifactContentEntries}
+            );
                                                $(c).removeClass('wait').append(htmlContent);
                                                if( o.root == t ) $(c).find('UL:hidden').show(); else $(c).find('UL:hidden').slideDown({ duration: o.expandSpeed, easing: o.expandEasing });
                                                bindTree(c);
index 76d1d9e2ec194c390a10884638b184faff4218e2..a5d6d471e1df2062d207193ad27445d3d9383149 100644 (file)
 <script id="artifact_content_tree_partial" type="text/html">
   <ul class="jqueryFileTree" style="display: none;">
     {{each artifactContentEntries}}
-    <li class="directory collapsed">
-      <a href="#" rel="${$value.path}/">${$value.path}</a>
-    </li>
+      {{if $value.file == true}}
+        <li class="file">
+          <a href="#" rel="${$value.path}/">${$value.text}</a>
+        </li>
+      {{else}}
+        <li class="directory collapsed">
+          <a href="#" rel="${$value.path}/">${$value.text}</a>
+        </li>
+      {{/if}}
     {{/each}}
   </ul>
 </script>
\ No newline at end of file