diff options
author | Olivier Lamy <olamy@apache.org> | 2012-05-21 17:22:15 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-05-21 17:22:15 +0000 |
commit | eac9ee57f1b82878b9a516f6cbde591b66f309f8 (patch) | |
tree | 1bc115d7c0e20a20f037690c9788145310a577d8 | |
parent | d58465581ad602458ffe1bf663a90dc95adabcf4 (diff) | |
download | archiva-eac9ee57f1b82878b9a516f6cbde591b66f309f8.tar.gz archiva-eac9ee57f1b82878b9a516f6cbde591b66f309f8.zip |
implements a basic go to anchot mechanism
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341117 13f79535-47bb-0310-9956-ffa450edef68
3 files changed, 10 insertions, 4 deletions
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 b927169d4..f4eb806de 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 @@ -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,'<'); text=text.replace(/>/g,">"); 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,'<'); text=text.replace(/>/g,">"); mainContent.find("#artifact-content-text" ).html(text); + goToAnchor("artifact-content-text-header"); } }); } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index 69a575e36..605b7a5fd 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -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 //------------------------------------ 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 544b90155..a44be1ca8 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 @@ -823,8 +823,8 @@ </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 |