]> source.dussan.org Git - archiva.git/commitdiff
add a button to restore original search results after have applying some filtering
authorOlivier Lamy <olamy@apache.org>
Wed, 29 Feb 2012 18:52:02 +0000 (18:52 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 29 Feb 2012 18:52:02 +0000 (18:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295215 13f79535-47bb-0310-9956-ffa450edef68

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

index bdf45ee41325c039aa58d3c0d035732a629fe0f7..90a1f9c7c3b33f18df0a541038c304ec21d13b21 100644 (file)
@@ -724,7 +724,9 @@ $(function() {
     advancedSearch=function(){
       self.search("restServices/archivaServices/searchService/searchArtifacts");
     }
-
+    removeFilter=function(){
+      self.resultViewModel.artifacts(self.resultViewModel.originalArtifacts);
+    }
     this.search=function(url){
 
       var mainContent=$("#main-content");
@@ -756,11 +758,13 @@ $(function() {
               displayWarningMessage( $.i18n.prop("search.artifact.noresults"));
               return;
             } else {
+              self.resultViewModel.originalArtifacts=artifacts;
               self.resultViewModel.artifacts(artifacts);
               if (!searchResultsGrid.attr("data-bind")){
                 searchResultsGrid.attr("data-bind",
                                  "simpleGrid: gridViewModel,simpleGridTemplate:'search-results-view-grid-tmpl',pageLinksId:'search-results-view-grid-pagination'");
                 ko.applyBindings(self.resultViewModel,searchResultsGrid.get(0));
+                ko.applyBindings(self,mainContent.find("#remove-filter-id" ).get(0));
               }
 
               activateSearchResultsTab();
index 4c1b98637991fb90672596711818f2e3eba95ad8..e24694035ffad282f5c5ae17b7d6b9c5ad288078 100644 (file)
 
 
       <div id="search-results" class="tab-pane">
+        <a href="#" class="btn btn-warning" data-bind="click: removeFilter" id="remove-filter-id">remove filter</a>
+
         <table class="table table-striped table-bordered" id="search-results-grid">
         </table>
         <div id="search-results-view-grid-pagination"></div>