aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-08-23 08:49:20 +0000
committerOlivier Lamy <olamy@apache.org>2012-08-23 08:49:20 +0000
commit7d8874e0ae2815c2cdb4f52a9567a0f616ffabbb (patch)
tree64a6db325f2fe84e4a142f6ac182133044bbf996
parentc0bdc5622e35417c56da1c02b3b68a68dda9beb0 (diff)
downloadarchiva-7d8874e0ae2815c2cdb4f52a9567a0f616ffabbb.tar.gz
archiva-7d8874e0ae2815c2cdb4f52a9567a0f616ffabbb.zip
make basic search navigable
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376407 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js27
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js25
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html2
3 files changed, 48 insertions, 6 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
index 240acdfe1..f4f1966af 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
@@ -208,8 +208,21 @@ 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;
- $.log("queryterms:"+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);
@@ -220,6 +233,18 @@ function() {
},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);
+ searchViewModel.searchRequest(searchRequest);
+ displaySearch(function(){
+ searchViewModel.externalBasicSearch();
+ },searchViewModel);
+ });
+
this.get('#open-admin-create-box',function(){
$.log("#open-admin-create-box");
adminCreateBox();
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 898e37fe8..644e266d8 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
@@ -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();
}
});
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 7f2addecd..5761389b4 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
@@ -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}}