]> source.dussan.org Git - archiva.git/commitdiff
move search screen to a tab/pill model
authorOlivier Lamy <olamy@apache.org>
Mon, 27 Feb 2012 16:58:00 +0000 (16:58 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 27 Feb 2012 16:58:00 +0000 (16:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1294223 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/chosen.css
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/chosen.jquery.js

index a08d816ca7d6d82a44f48d8ed3be1db371553e50..568e018362a280dcf67c800463a0ad9b30e36cc9 100644 (file)
   font-style: normal;
 }
 
-.chzn-results ul {
-  z-index: 1000;
-}
 
 .chzn-container .chzn-results .highlighted em {
   background: transparent;
 }
 .chzn-container-multi .chzn-drop .result-selected {
   display: none;
+  z-index: 999;
 }
 .chzn-container .chzn-results-scroll {
   background: white;
index 857bd8e9b0d5298dd8ebf2c757d4160c52698ec1..5a5dd3f54425fede00f68cd2e601a92f97fd2c6b 100644 (file)
@@ -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());
+                                                  }
+                                                );
+
+                                });
         }
     });
 
index 780b0c739ae905c9b202f9385efe2a8942d1c7ba..079ff1e5475dcca81480da921f3d4d4512aaac79 100644 (file)
   <div class="page-header">
     <h3>${$.i18n.prop('search.artifact.header')}</h3>
   </div>
-  <div class="accordion" id="search-artifacts-accordion">
-    <div class="accordion-group">
-      <div class="accordion-heading">
-        <a class="accordion-toggle" href="#search-form-collapse" data-parent="#search-artifacts-accordion" data-toggle="collapse">${$.i18n.prop('search.artifact.form.header')}</a>
-      </div>
-      <div id="search-form-collapse" class="accordion-body collapse in">
+  <div id="search-artifacts-tabs">
+    <div class="tabbable tabs-below">
+      <ul class="nav nav-tabs">
+        <li class="active">
+          <a data-toggle="tab" href="#search-form-collapse">${$.i18n.prop('search.artifact.form.header')}</a>
+        </li>
+          <li class="">
+            <a data-toggle="tab" href="#search-results">${$.i18n.prop('search.artifact.results.header')}</a>
+          </li>
+      </ul>
+      <div class="tab-content">
+
+      <div id="search-form-collapse" class="tab-pane active">
         <div class="tabbable tabs-below">
-          <ul class="nav nav-tabs">
+          <ul class="nav nav-pills">
             <li class="active">
               <a href="#search-basic-form-pane" data-toggle="tab">${$.i18n.prop('search.artifact.search.form.basic')}</a>
             </li>
               <a href="#search-osgi-form-pane" data-toggle="tab">${$.i18n.prop('search.artifact.search.form.osgi')}</a>
             </li>
           </ul>
-          <div class="tab-content">
-            <div class="tab-pane active" id="search-basic-form-pane">
-              <form class="well form-horizontal" id="search-basic-form">
+          <div class="pill-content">
+            <div class="pill-pane active" id="search-basic-form-pane">
+              <form class="well form-inline" id="search-basic-form">
                 <fieldset>
-                  <div class="control-group">
-                    <label class="control-label" for="search-terms">${$.i18n.prop('search.artifact.search.form.query.terms')}</label>
-                    <div class="controls">
-                      <input type="text" class="input-medium search-query" id="search-terms" name="search-terms" size="50"
-                             data-bind="value: searchParameters().basicQueryString"/>
-                    </div>
-                  </div>
-                  <div class="control-group">
-
-
-                    <div>
-                      <select data-placeholder="Choose a Country" id="search-basic-repostories-select" class="chzn-select"
-                              multiple style="z-index: 1000" tabindex="10">
+                    <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"
+                              multiple style="width:350px;" tabindex="4">
                         <option value="">All</option>
                         {{each(i,repoId) observableRepoIds}}
                           <option value="${repoId}">${repoId}</option>
                         {{/each}}
                       </select>
+                  </div>
+                  <div class="control-group">
+                    <label class="control-label" for="search-terms"></label>
+                    <div class="controls">
+                      <input type="text" class="input-medium search-query" id="search-terms" name="search-terms" size="50"
+                             data-bind="value: searchParameters().basicQueryString" placeholder="${$.i18n.prop('search.artifact.search.form.query.terms')}"/>
                     </div>
                   </div>
-                </fieldset>
                 <button type="submit" class="btn" data-bind="click: basicSearch">Search</button>
               </form>
             </div>
-            <div class="tab-pane" id="search-advanced-form-pane">
+            <div class="pill-pane" id="search-advanced-form-pane">
                 <form class="well form-horizontal" id="search-advanced-form">
                   <fieldset>
                     <div class="control-group">
                                data-bind="value: searchParameters().searchRequest().groupId"/>
                       </div>
                     </div>
+                    <div class="control-group">
+                      <label class="control-label" for="artifactId">${$.i18n.prop('search.artifact.search.form.query.artifactId')}</label>
+                      <div class="controls">
+                        <input type="text" class="input-medium search-query" id="artifactId" name="artifactId" size="50"
+                               data-bind="value: searchParameters().searchRequest().artifactId"/>
+                      </div>
+                    </div>
+                    <div class="control-group">
+                      <label class="control-label" for="artifactId">${$.i18n.prop('search.artifact.search.form.query.version')}</label>
+                      <div class="controls">
+                        <input type="text" class="input-medium search-query" id="version" name="version" size="50"
+                               data-bind="value: searchParameters().searchRequest().version"/>
+                      </div>
+                    </div>
+                    <div class="control-group">
+                      <label class="control-label" for="artifactId">${$.i18n.prop('search.artifact.search.form.query.packaging')}</label>
+                      <div class="controls">
+                        <input type="text" class="input-medium search-query" id="packaging" name="packaging" size="50"
+                               data-bind="value: searchParameters().searchRequest().packaging"/>
+                      </div>
+                    </div>
+                    <div class="control-group">
+                      <label class="control-label" for="artifactId">${$.i18n.prop('search.artifact.search.form.query.className')}</label>
+                      <div class="controls">
+                        <input type="text" class="input-medium search-query" id="className" name="className" size="50"
+                               data-bind="value: searchParameters().searchRequest().className"/>
+                      </div>
+                    </div>
                   </fieldset>
                   <button type="submit" class="btn" data-bind="click: advancedSearch">Search</button>
                 </form>
             </div>
-            <div class="tab-pane" id="search-osgi-form-pane">
+            <div class="pill-pane" id="search-osgi-form-pane">
               <p>osgi search form.</p>
             </div>
           </div>
         </div>
       </div>
 
-      <div class="accordion-heading">
-        <a class="accordion-toggle" href="#search-results" data-parent="#search-artifacts-accordion" data-toggle="collapse">${$.i18n.prop('search.artifact.results.header')}</a>
-      </div>
-      <div id="search-results" class="accordion-body collapse">
+
+      <div id="search-results" class="tab-pane">
         results
       </div>
+
+      </div>
     </div>
   </div>
 
index 9e5793884227b30c56d0a87590ee9d06350439af..67edfb04cdb8b756443358b24622a801a2528f10 100644 (file)
@@ -305,7 +305,7 @@ Copyright (c) 2011 by Harvest
         style: 'width: ' + this.f_width + 'px;'
       });
       if (this.is_multiple) {
-        container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
+        container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;z-index: 999"><ul class="chzn-results"></ul></div>');
       } else {
         container_div.html('<a href="javascript:void(0)" class="chzn-single"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
       }
@@ -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();