]> source.dussan.org Git - archiva.git/commitdiff
implements a basic go to anchot mechanism
authorOlivier Lamy <olamy@apache.org>
Mon, 21 May 2012 17:22:15 +0000 (17:22 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 21 May 2012 17:22:15 +0000 (17:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341117 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/utils.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html

index b927169d400c00ec05c3bcea74b00ccb90dbcca4..f4eb806de374334dda6d756180b4d8d07dad76c8 100644 (file)
@@ -295,11 +295,10 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
                           url: pomContentUrl,
                           dataType: "text",
                           success: function(data) {
-                            $.log("foo");
-                            $.log("data:"+data);
                             var text = data.replace(/</g,'&lt;');
                             text=text.replace(/>/g,"&gt;");
                             mainContent.find("#artifact-content-text" ).html(text);
+                            goToAnchor("artifact-content-text-header");
                           }
                         });
                         return;
@@ -334,6 +333,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
                              var text = data.replace(/</g,'&lt;');
                              text=text.replace(/>/g,"&gt;");
                              mainContent.find("#artifact-content-text" ).html(text);
+                             goToAnchor("artifact-content-text-header");
                            }
                           });
                                  }
index 69a575e36a044aa3da3da1a620248cfb7e87d4bd..605b7a5fd9e4f090eeae5bc98a4c353c6d8fe2f3 100644 (file)
@@ -373,6 +373,12 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() {
     return sorted?res.sort():res;
   }
 
+  goToAnchor=function(anchor){
+    var curHref = window.location.href;
+    curHref=curHref.substringBeforeLast("#");
+    window.location.href=curHref+"#"+anchor;
+  }
+
   //------------------------------------
   // utils javascript string extensions
   //------------------------------------
index 544b90155dfb759e0c04f8d9453dfc91fc7411e2..a44be1ca8184a309674eeb45fbc18dc6607a1d45 100644 (file)
           </div>
         </div>
       </div>
-      <h4>Content</h4>
+      <h4 id="artifact-content-text-header">Content</h4>
       <div>
-         <pre id="artifact-content-text"></pre>
+         <pre><code id="artifact-content-text"></code></pre>
       </div>
 </script>
\ No newline at end of file