summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-04-02 21:48:35 +0200
committerArthur Schiwon <blizzz@owncloud.com>2014-06-02 12:53:55 +0200
commit5b8ba79356c50934b949a9e2a1942aeddd7640ff (patch)
tree7dee9aa3e363b21611e4a361d7b0c440f9b32519 /settings/js
parent19fd7cd9c7206cea7c0eba21ed2b5d34ce652429 (diff)
downloadnextcloud-server-5b8ba79356c50934b949a9e2a1942aeddd7640ff.tar.gz
nextcloud-server-5b8ba79356c50934b949a9e2a1942aeddd7640ff.zip
make filter work on server-side
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/users/filter.js39
-rw-r--r--settings/js/users/users.js16
2 files changed, 42 insertions, 13 deletions
diff --git a/settings/js/users/filter.js b/settings/js/users/filter.js
new file mode 100644
index 00000000000..134ca47a7d1
--- /dev/null
+++ b/settings/js/users/filter.js
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2014, Arthur Schiwon <blizzz@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or later.
+ * See the COPYING-README file.
+ */
+
+/**
+ * @brief foobar
+ * @param jQuery input element that works as the user text input field
+ */
+function UserManagementFilter(filterInput, userList) {
+ this.filterInput = filterInput;
+ this.userList = userList;
+ this.thread = undefined;
+
+ this.init();
+}
+
+UserManagementFilter.prototype.init = function() {
+ umf = this;
+ this.filterInput.keyup(function() {
+ clearTimeout(umf.thread);
+ umf.thread = setTimeout(
+ function() {
+ umf.run();
+ },
+ 300
+ );
+ });
+}
+
+UserManagementFilter.prototype.run = function() {
+ this.userList.empty();
+ this.userList.update();
+}
+
+UserManagementFilter.prototype.getPattern = function() {
+ return this.filterInput.val();
+} \ No newline at end of file
diff --git a/settings/js/users/users.js b/settings/js/users/users.js
index f5c3b1decc5..92ce8277baf 100644
--- a/settings/js/users/users.js
+++ b/settings/js/users/users.js
@@ -219,7 +219,8 @@ var UserList = {
gid = '';
}
UserList.currentGid = gid;
- var query = $.param({ offset: UserList.offset, limit: UserList.usersToLoad, gid: gid });
+ pattern = filter.getPattern();
+ var query = $.param({ offset: UserList.offset, limit: UserList.usersToLoad, gid: gid, pattern: pattern });
$.get(OC.generateUrl('/settings/ajax/userlist') + '?' + query, function (result) {
var loadedUsers = 0;
var trs = [];
@@ -538,16 +539,5 @@ $(document).ready(function () {
);
});
// Implements User Search
- $('#usersearchform input').keyup(function() {
- var inputVal = $(this).val(), regex = new RegExp(inputVal, "i");;
- $('table tbody tr td.name').each(function (key,element) {
- if (regex.test($(element).text())) {
- $(element).parent().show();
- } else {
- $(element).parent().hide();
- }
- });
- });
-
-
+ filter = new UserManagementFilter($('#usersearchform input'), UserList);
});