From 0ecc1afd539c9cf34f8ac7f83bb12e08146432b1 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 15 Jan 2014 23:31:51 +0000 Subject: [PATCH] fixing moving to project detail when selected from typeahead git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1558604 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/js/archiva/search.js | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js index 756434a8d..19796af3b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js @@ -1434,14 +1434,14 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn if (selectedRepo){ url+="?repositoryId="+encodeURIComponent(selectedRepo); } - + var theGroupId=groupId; var browseBox = $("#main-content").find("#browse-autocomplete" ); browseBox.typeahead( { name: 'browse-result', remote: { - url: url,//groupId?url+'/%QUERY':url, + url: url, beforeSend: function(jqXhr){ $.log("beforeSend browseBox.val():'"+browseBox.val()+"'"); }, @@ -1497,7 +1497,8 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn if (groupId){ if (browseResultEntries[i].name.startsWith(groupId+'.'+request)){ var item = browseResultEntries[i]; - filtered.push(item.name.substring(groupId.length+1, item.name.length)); + item.name=item.name.substring(groupId.length+1, item.name.length); + filtered.push(item); } } else { if (browseResultEntries[i].name.startsWith(request)){ @@ -1514,29 +1515,17 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn valueKey: 'name', maxParallelRequests:0, limit: 50, - template: [ - '

{{name}}

' - ].join(''), + template: '

{{name}}

', engine: Hogan } ); browseBox.on('typeahead:selected', function(obj, datum) { - $.log(obj); + $.log("typeahead:selected:"+datum.name+":"+datum.project+",groupId:"+theGroupId); //window.sammyArchivaApplication.setLocation("#quicksearch~" + datum.artifactId); if (datum.project){ - // value org.apache.maven/maven-archiver - // split this org.apache.maven and maven-archiver - var id=datum.name; - var values = id.split("."); - var groupId=""; - for (var i = 0;i