From 9dd80fddb0af17517993ed32eac453bf15e79c03 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 27 Feb 2012 16:58:00 +0000 Subject: [PATCH] move search screen to a tab/pill model git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1294223 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/css/chosen.css | 4 +- .../src/main/webapp/js/archiva/search.js | 16 +++- .../webapp/js/archiva/templates/search.html | 91 +++++++++++++------ .../src/main/webapp/js/chosen.jquery.js | 6 +- 4 files changed, 80 insertions(+), 37 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/chosen.css b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/chosen.css index a08d816ca..568e01836 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/chosen.css +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/chosen.css @@ -256,9 +256,6 @@ font-style: normal; } -.chzn-results ul { - z-index: 1000; -} .chzn-container .chzn-results .highlighted em { background: transparent; @@ -277,6 +274,7 @@ } .chzn-container-multi .chzn-drop .result-selected { display: none; + z-index: 999; } .chzn-container .chzn-results-scroll { background: white; 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 857bd8e9b..5a5dd3f54 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 @@ -548,9 +548,11 @@ $(function() { SearchViewModel=function(){ this.searchParameters=ko.observable(new SearchParameters()); this.observableRepoIds=ko.observableArray([]); + this.selectedRepoIds=[]; basicSearch=function(){ - $.log("query:"+this.searchParameters().basicQueryString()) + $.log("query:"+this.searchParameters().basicQueryString()); + $.log("repoIds:"+this.selectedRepoIds); } advancedSearch=function(){ @@ -559,6 +561,7 @@ $(function() { } displaySearch=function(){ + clearUserMessages(); var mainContent=$("#main-content"); mainContent.html(mediumSpinnerImg()); $.ajax("restServices/archivaServices/searchService/observableRepoIds", { @@ -569,7 +572,16 @@ $(function() { var searchViewModel=new SearchViewModel(); searchViewModel.observableRepoIds(mapStringList(data)); ko.applyBindings(searchViewModel,mainContent.find("#search-artifacts-div").get(0)); - mainContent.find("#search-basic-repostories-select" ).chosen(); + mainContent.find("#search-basic-repostories-select" ).chosen() + .change(function(){ + searchViewModel.selectedRepoIds=[]; + mainContent.find("#search-basic-repositories" ) + .find(".chzn-choices li span").each(function(i,span){ + searchViewModel.selectedRepoIds.push($(span).html()); + } + ); + + }); } }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html index 780b0c739..079ff1e54 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html @@ -154,14 +154,21 @@ -
-
- -
+
+
+ +
+ +
-
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/chosen.jquery.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/chosen.jquery.js index 9e5793884..67edfb04c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/chosen.jquery.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/chosen.jquery.js @@ -305,7 +305,7 @@ Copyright (c) 2011 by Harvest style: 'width: ' + this.f_width + 'px;' }); if (this.is_multiple) { - container_div.html('
    '); + container_div.html('
      '); } else { container_div.html('' + this.default_text + '
        '); } @@ -317,7 +317,9 @@ Copyright (c) 2011 by Harvest dd_width = this.f_width - get_side_border_padding(this.dropdown); this.dropdown.css({ "width": dd_width + "px", - "top": dd_top + "px" + "top": dd_top + "px", + "z-index": "999", + "display": "block" }); this.search_field = this.container.find('input').first(); this.search_results = this.container.find('ul.chzn-results').first(); -- 2.39.5