]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1734] add some filtering for searching in users table
authorOlivier Lamy <olamy@apache.org>
Wed, 2 Jan 2013 10:51:04 +0000 (10:51 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 2 Jan 2013 10:51:04 +0000 (10:51 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1427725 13f79535-47bb-0310-9956-ffa450edef68

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 dca2c84eeb3454e0a52da28f5a28d04c0e3f11d4..d3df7fb8e3742be895117dda75117fbcef7a3172 100644 (file)
@@ -51,10 +51,51 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
     });
     clearFilters=function(){
       self.users(self.originalUsers());
-      applyAutocompleteOnHeader("username",self);
-      applyAutocompleteOnHeader("fullName",self);
-      applyAutocompleteOnHeader("email",self);
+      applyAutocompleteOnHeaders(self);
     };
+    filterLocked=function(){
+      var founds=[];
+      $(self.originalUsers()).each(function(idx,user){
+        if(user.locked()){
+          founds.push(user);
+        }
+      });
+      self.users(founds);
+      applyAutocompleteOnHeaders(self);
+    }
+    filterNonLocked=function(){
+      var founds=[];
+      $(self.originalUsers()).each(function(idx,user){
+        if(user.locked()==false){
+          founds.push(user);
+        }
+      });
+      self.users(founds);
+      applyAutocompleteOnHeaders(self);
+    }
+
+    filterPasswordChangeRequired=function(){
+      var founds=[];
+      $(self.originalUsers()).each(function(idx,user){
+        if(user.passwordChangeRequired()){
+          founds.push(user);
+        }
+      });
+      self.users(founds);
+      applyAutocompleteOnHeaders(self);
+    }
+    filterPasswordChangeNotRequired=function(){
+      var founds=[];
+      $(self.originalUsers()).each(function(idx,user){
+        if(user.passwordChangeRequired()==false){
+          founds.push(user);
+        }
+      });
+      self.users(founds);
+      applyAutocompleteOnHeaders(self);
+    }
+
+
     this.addUser=function() {
       clearUserMessages();
       var mainContent = $("#main-content");
@@ -298,15 +339,20 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
 
           })
           mainContent.find("#users-view-tabs-content #users-view").addClass("active");
-          applyAutocompleteOnHeader("username",usersViewModel);
-          applyAutocompleteOnHeader("fullName",usersViewModel);
-          applyAutocompleteOnHeader("email",usersViewModel);
+          applyAutocompleteOnHeaders(usersViewModel);
+          mainContent.find("#usersTable").find('.dropdown-toggle').dropdown();
         }
       }
     );
 
   }
 
+  applyAutocompleteOnHeaders=function(usersViewModel){
+    applyAutocompleteOnHeader("username",usersViewModel);
+    applyAutocompleteOnHeader("fullName",usersViewModel);
+    applyAutocompleteOnHeader("email",usersViewModel);
+  }
+
   activateUsersGridTab=function(){
     var mainContent = $("#main-content");
     mainContent.find("#users-view-tabs li").removeClass("active");
index 6ec095661b7bb0d711a8e33ba4699786e7c4740a..304597ccb72147e661bd74c2c4633f629dfce582 100644 (file)
       {{/each}}
       <th></th>
       <th></th>
-      <th>locked ?</th>
-      <th>chg pwd</th>
+      <th>
+        <div class="btn-group" style="vertical-align: top; padding-bottom: 9px;">
+          <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
+            Filter
+            <span class="caret"></span>
+          </a>
+          <ul class="dropdown-menu">
+            <li><a href="#" class="cursor-hand" data-bind="click: clearFilters">${$.i18n.prop('users.grid.filter.all')}</a></li>
+            <li><a href="#" class="cursor-hand" data-bind="click: filterLocked">${$.i18n.prop('users.grid.filter.locked')}</a></li>
+            <li><a href="#" class="cursor-hand" data-bind="click: filterNonLocked">${$.i18n.prop('users.grid.filter.not.locked')}</a></li>
+          </ul>
+        </div>
+      </th>
+      <th>
+        <div class="btn-group" style="vertical-align: top; padding-bottom: 9px;">
+          <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
+            Filter
+            <span class="caret"></span>
+          </a>
+          <ul class="dropdown-menu">
+            <li><a href="#" class="cursor-hand" data-bind="click: clearFilters">${$.i18n.prop('users.grid.filter.all')}</a></li>
+            <li><a href="#" class="cursor-hand" data-bind="click: filterPasswordChangeRequired">${$.i18n.prop('users.grid.filter.pwd.change.required')}</a></li>
+            <li><a href="#" class="cursor-hand" data-bind="click: filterPasswordChangeNotRequired">${$.i18n.prop('users.grid.filter.pwd.change.not.required')}</a></li>
+          </ul>
+        </div>
+      </th>
     </tr>
   </thead>
   <tbody>