mirror of https://github.com/apache/archiva.git
make basic search navigable
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376407 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c0bdc5622e
commit
7d8874e0ae
|
@ -208,12 +208,37 @@ function() {
|
|||
var repositoryIds = this.params.repositoryIds;
|
||||
var repos = repositoryIds.split("~");
|
||||
$.log("queryterms:"+queryterms+',repositoryIds:'+repositoryIds+",repos:"+repos.length);
|
||||
var searchViewModel = new SearchViewModel();
|
||||
var searchRequest = new SearchRequest();
|
||||
searchRequest.queryTerms(queryterms);
|
||||
searchRequest.repositories=repos;
|
||||
searchViewModel.searchRequest(searchRequest);
|
||||
displaySearch(function(){
|
||||
searchViewModel.externalBasicSearch();
|
||||
},searchViewModel);
|
||||
});
|
||||
|
||||
this.get('#searchresult~:repositoryIds/:queryterms',function(){
|
||||
var queryterms= this.params.queryterms;
|
||||
var repositoryIds = this.params.repositoryIds;
|
||||
var repos = repositoryIds.split("~");
|
||||
$.log("queryterms:"+queryterms+',repositoryIds:'+repositoryIds+",repos:"+repos.length);
|
||||
var searchViewModel = new SearchViewModel();
|
||||
var searchRequest = new SearchRequest();
|
||||
searchRequest.queryTerms(queryterms);
|
||||
searchRequest.repositories=repos;
|
||||
searchViewModel.searchRequest(searchRequest);
|
||||
displaySearch(function(){
|
||||
searchViewModel.externalBasicSearch();
|
||||
},searchViewModel);
|
||||
});
|
||||
|
||||
this.get('#searchresult/:queryterms',function(){
|
||||
var queryterms= this.params.queryterms;
|
||||
$.log("queryterms:"+queryterms);
|
||||
var searchViewModel = new SearchViewModel();
|
||||
var searchRequest = new SearchRequest();
|
||||
searchRequest.queryTerms(queryterms);
|
||||
searchRequest.repositories=repos;
|
||||
searchViewModel.searchRequest(searchRequest);
|
||||
displaySearch(function(){
|
||||
searchViewModel.externalBasicSearch();
|
||||
|
|
|
@ -1533,6 +1533,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
|
|||
*/
|
||||
SearchViewModel=function(){
|
||||
var self=this;
|
||||
var mainContent=$("#main-content");
|
||||
this.searchRequest=ko.observable(new SearchRequest());
|
||||
this.observableRepoIds=ko.observableArray([]);
|
||||
this.selectedRepoIds=[];
|
||||
|
@ -1550,7 +1551,25 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
|
|||
// cleanup previours error message
|
||||
customShowError("#main-content #search-basic-form", null, null, []);
|
||||
}
|
||||
self.search("restServices/archivaServices/searchService/quickSearchWithRepositories");
|
||||
var location="#searchresult";
|
||||
|
||||
self.selectedRepoIds=[];
|
||||
mainContent.find("#search-basic-repositories" )
|
||||
.find(".chzn-choices li span").each(function(i,span){
|
||||
self.selectedRepoIds.push($(span).html());
|
||||
}
|
||||
);
|
||||
|
||||
if (self.selectedRepoIds.length>0){
|
||||
$.log("selectedRepoIds:"+self.selectedRepoIds.length);
|
||||
$(self.selectedRepoIds).each(function(index, Element){
|
||||
location+="~"+self.selectedRepoIds[index];
|
||||
});
|
||||
}
|
||||
location+="/"+queryTerm;
|
||||
$.log("basicsearch location:"+location);
|
||||
window.sammyArchivaApplication.setLocation(location);
|
||||
//self.search("restServices/archivaServices/searchService/quickSearchWithRepositories");
|
||||
}
|
||||
|
||||
this.externalBasicSearch=function(){
|
||||
|
@ -1574,8 +1593,6 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
|
|||
}
|
||||
this.search=function(url,repositoriesIds){
|
||||
|
||||
var mainContent=$("#main-content");
|
||||
|
||||
var searchResultsGrid=mainContent.find("#search-results #search-results-grid" );
|
||||
mainContent.find("#btn-basic-search" ).button("loading");
|
||||
mainContent.find("#btn-advanced-search" ).button("loading");
|
||||
|
@ -1673,7 +1690,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
|
|||
$.log("repos:"+repos);
|
||||
searchViewModel.observableRepoIds(repos);
|
||||
ko.applyBindings(searchViewModel,mainContent.find("#search-artifacts-div").get(0));
|
||||
mainContent.find("#search-basic-repostories-select" ).chosen();
|
||||
mainContent.find("#search-basic-repositories-select" ).chosen();
|
||||
if (successCallbackFn && $.isFunction(successCallbackFn)) successCallbackFn();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
<fieldset>
|
||||
<div class="control-group" id="search-basic-repositories">
|
||||
<select data-placeholder="${$.i18n.prop('search.artifact.search.form.query.repositories')}"
|
||||
id="search-basic-repostories-select" class="chzn-select defaults"
|
||||
id="search-basic-repositories-select" class="chzn-select defaults"
|
||||
multiple style="width:350px;" tabindex="4">
|
||||
<option value="all">${$.i18n.prop('search.artifact.search.form.repositories.all')}</option>
|
||||
{{each(i,repoId) observableRepoIds}}
|
||||
|
|
Loading…
Reference in New Issue