aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-01-15 23:31:51 +0000
committerOlivier Lamy <olamy@apache.org>2014-01-15 23:31:51 +0000
commit0ecc1afd539c9cf34f8ac7f83bb12e08146432b1 (patch)
treeec900554580c0e1a5d73596a8ae6ec9b3a8e7d23
parent40aa29cfb56163c4f8fb14e946cab04cd9c35f2f (diff)
downloadarchiva-0ecc1afd539c9cf34f8ac7f83bb12e08146432b1.tar.gz
archiva-0ecc1afd539c9cf34f8ac7f83bb12e08146432b1.zip
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
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js26
1 files 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: [
- '<p>{{name}}</p>'
- ].join(''),
+ template: '<p>{{name}}</p>',
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<values.length-1;i++){
- groupId+=values[i];
- if (i<values.length-2)groupId+=".";
- }
- var artifactId=values[values.length-1];
- goToArtifactDetail(groupId,artifactId);
+ goToArtifactDetail(theGroupId,datum.name);
} else {
var selectedRepo=getSelectedBrowsingRepository();
var location ="#browse";
@@ -1544,6 +1533,7 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn
location+="~"+selectedRepo;
}
location+="/"+datum.name;
+ //browseBox.typeahead('destroy');
window.sammyArchivaApplication.setLocation(location);
}