]> source.dussan.org Git - archiva.git/commitdiff
cleanup a bit
authorOlivier Lamy <olamy@apache.org>
Mon, 25 Nov 2013 05:12:42 +0000 (05:12 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 25 Nov 2013 05:12:42 +0000 (05:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1545152 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/users.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/redback/user-edit.html

index cd665cb3562b66581f6dae5f47c072ee709afb10..fa60b2b680970dfe6973d791a50f0559ba818e9d 100644 (file)
@@ -880,17 +880,18 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
   };
 
   drawQuickSearchAutocomplete=function(selector){
-
-    $( selector ? selector : "#quick-search-autocomplete" ).typeahead(
+    var box = $( selector ? selector : "#quick-search-autocomplete" );
+    box.typeahead(
         {
           name: 'quick-search-result',
           remote: 'restServices/archivaServices/searchService/quickSearch?queryString=%QUERY',
           valueKey: 'artifactId',
+          maxParallelRequests:1,
           limit: 50
         }
     );
 
-    $( selector ? selector : "#quick-search-autocomplete" ).bind('typeahead:selected', function(obj, datum, name) {
+    box.bind('typeahead:selected', function(obj, datum, name) {
       window.sammyArchivaApplication.setLocation("#quicksearch~" + datum.artifactId);
     });
   };
index 1f2d17b01f699f841ec838da1660e323126b48b3..aa92cc07e6e177bf1060965d146544ca97c63087 100644 (file)
@@ -1419,6 +1419,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","select2","knockout","kno
     if (selectedRepo){
       url+="?repositoryId="+encodeURIComponent(selectedRepo);
     }
+
     $( "#main-content").find("#browse-autocomplete" ).autocomplete({
       minLength: 2,
                        source: function(request, response){
@@ -2017,12 +2018,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","select2","knockout","kno
       });
 
       var box = $( "#main-content").find("#search-filter-auto-"+property );
-      box.typeahead(
-          {
-            local: values,
-            maxParallelRequests:2
-          }
-      );
+      box.typeahead( { local: values } );
 
       box.bind('typeahead:selected', function(obj, datum, name) {
         var artifacts=[];
index 18c9dafb0d9f650cf7cc4663c53f5b14bb9c840b..89157bdb1b7676990f0e005c2e6c8d167900344f 100644 (file)
@@ -16,8 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-define("redback.users",["jquery","utils","i18n","jquery.validate","knockout","knockout.simpleGrid"],
-function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
+define("redback.users",["jquery","utils","i18n","jquery.validate","knockout","knockout.simpleGrid","typeahead"],
+function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,typeahead) {
 
   /**
    * view model used for users grid
@@ -47,11 +47,15 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
           filter: true
         }
       ],
-      pageSize: 10
+      pageSize: 10,
+      gridUpdateCallBack: function(){
+       $.log("gridUpdateCallBack users result");
+        applyAutocompleteOnHeaders(self);
+      }
     });
     clearFilters=function(){
       self.users(self.originalUsers());
-      applyAutocompleteOnHeaders(self);
+
     };
     filterLocked=function(){
       var founds=[];
@@ -61,7 +65,6 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
         }
       });
       self.users(founds);
-      applyAutocompleteOnHeaders(self);
     }
     filterNonLocked=function(){
       var founds=[];
@@ -71,7 +74,6 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
         }
       });
       self.users(founds);
-      applyAutocompleteOnHeaders(self);
     }
 
     filterPasswordChangeRequired=function(){
@@ -82,7 +84,6 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
         }
       });
       self.users(founds);
-      applyAutocompleteOnHeaders(self);
     }
     filterPasswordChangeNotRequired=function(){
       var founds=[];
@@ -92,7 +93,6 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
         }
       });
       self.users(founds);
-      applyAutocompleteOnHeaders(self);
     }
 
 
@@ -281,6 +281,7 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
   }
 
   applyAutocompleteOnHeader=function(property,usersViewModel){
+
     $("#main-content").find("#users-grid-filter-auto-"+property ).autocomplete({
       minLength: 0,
       source: function(request, response){
@@ -306,6 +307,31 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
         return false;
       }
     });
+
+    /*
+    olamy: doesn't work????
+    var values=[];
+    $(usersViewModel.users()).each(function(idx,user){
+      var value=user[property];
+      if(value!=null && $.inArray(value, values)<0){
+        values.push(value);
+      }
+    });
+    var jid = "#users-grid-filter-auto-"+property;
+    $.log("applyAutocompleteOnHeader:"+values.length+" for " + jid);
+
+    var box = $("#main-content").find(jid);
+
+    box.typeahead( { local: values } );
+    box.bind('typeahead:selected', function(obj, datum, name) {
+      var users=[];
+      $(usersViewModel.users()).each(function(idx,user){
+        if(user[property] && user[property]() && user[property]().indexOf(datum.value)>=0){
+          users.push(user);
+        }
+      });
+      usersViewModel.users(users);
+    });*/
   }
 
   /**
@@ -341,7 +367,6 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
             }
           })
           mainContent.find("#users-view-tabs-content #users-view").addClass("active");
-          applyAutocompleteOnHeaders(usersViewModel);
           mainContent.find("#usersTable").find('.dropdown-toggle').dropdown();
         }
       }
index 06fafec9fe1cf73e9dee1fb584a75dd4c213510b..371e47c0500fe7a4239687ec0ed7722b5f633f3a 100644 (file)
       {{each(i, columnDefinition) columns}}
       <th>
         {{if columnDefinition.filter }}
-        <input type="text" class="form-search input-medium" id="users-grid-filter-auto-${columnDefinition.rowText}"
+        <input type="text" class="input-medium" id="users-grid-filter-auto-${columnDefinition.rowText}"
                placeholder="${$.i18n.prop('users.grid.filter')}"/>
         {{/if}}
       </th>