validate query terms are not empty

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1294225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-02-27 16:58:37 +00:00
parent a89c5eec82
commit 68cd673255
3 changed files with 17 additions and 4 deletions

View File

@ -215,4 +215,5 @@ search.artifact.search.form.query.className=Class Name
search.artifact.search.form.query.repositories=Repositories search.artifact.search.form.query.repositories=Repositories
search.artifact.search.form.advanced=Advanced Parameters search.artifact.search.form.advanced=Advanced Parameters
search.artifact.search.form.query.artifactId=Artifact ID search.artifact.search.form.query.artifactId=Artifact ID
search.artifact.search.form.repositories.all=All
search.artifact.search.form.terms.empty=You must enter some search terms.

View File

@ -551,8 +551,20 @@ $(function() {
this.selectedRepoIds=[]; this.selectedRepoIds=[];
basicSearch=function(){ basicSearch=function(){
$.log("query:"+this.searchParameters().basicQueryString()); //$.log("query:"+this.searchParameters().basicQueryString());
$.log("repoIds:"+this.selectedRepoIds); //$.log("repoIds:"+this.selectedRepoIds);
var queryTerm=this.searchParameters().basicQueryString();
if (!queryTerm || $.trim(queryTerm).length<1){
$.log("empty");
var errorList=[{
message: $.i18n.prop("search.artifact.search.form.terms.empty"),
element: $("#main-content #search-basic-form #search-terms" ).get(0)
}];
customShowError("#main-content #search-basic-form", null, null, errorList);
} else {
// cleanup previours error message
customShowError("#main-content #search-basic-form", null, null, []);
}
} }
advancedSearch=function(){ advancedSearch=function(){

View File

@ -187,7 +187,7 @@
<select data-placeholder="${$.i18n.prop('search.artifact.search.form.query.repositories')}" <select data-placeholder="${$.i18n.prop('search.artifact.search.form.query.repositories')}"
id="search-basic-repostories-select" class="chzn-select" id="search-basic-repostories-select" class="chzn-select"
multiple style="width:350px;" tabindex="4"> multiple style="width:350px;" tabindex="4">
<option value="">All</option> <option value="all">${$.i18n.prop('search.artifact.search.form.repositories.all')}</option>
{{each(i,repoId) observableRepoIds}} {{each(i,repoId) observableRepoIds}}
<option value="${repoId}">${repoId}</option> <option value="${repoId}">${repoId}</option>
{{/each}} {{/each}}