Mercurial > bugzilla-dashboard
annotate js/find-user.js @ 55:cd51aebfbf68
Removed extraneous logging
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Sat, 24 Apr 2010 23:50:23 -0700 |
parents | fdf9a6ac2848 |
children |
rev | line source |
---|---|
26 | 1 $(window).ready( |
2 function() { | |
3 var currReq; | |
4 | |
5 var options = { | |
6 minLength: 2, | |
33
fdf9a6ac2848
Changed delay of user autocomplete from 300 ms to 1000, since each request is rather expensive.
Atul Varma <varmaa@toolness.com>
parents:
32
diff
changeset
|
7 delay: 1000, |
26 | 8 source: function(request, response) { |
9 function success(result) { | |
29
68c02a911494
abort current xhr for user finder autocomplete when a new one is queued
Atul Varma <varmaa@toolness.com>
parents:
28
diff
changeset
|
10 currReq = null; |
26 | 11 var suggs = []; |
12 result.users.forEach( | |
13 function(user) { | |
28
c631a02f9f63
Submitting user-finder form now opens custom dashboard for that user.
Atul Varma <varmaa@toolness.com>
parents:
26
diff
changeset
|
14 suggs.push({label: user.real_name + " (" + user.name + ")", |
c631a02f9f63
Submitting user-finder form now opens custom dashboard for that user.
Atul Varma <varmaa@toolness.com>
parents:
26
diff
changeset
|
15 value: user.name}); |
26 | 16 }); |
17 response(suggs); | |
18 } | |
29
68c02a911494
abort current xhr for user finder autocomplete when a new one is queued
Atul Varma <varmaa@toolness.com>
parents:
28
diff
changeset
|
19 if (currReq) |
68c02a911494
abort current xhr for user finder autocomplete when a new one is queued
Atul Varma <varmaa@toolness.com>
parents:
28
diff
changeset
|
20 currReq.abort(); |
26 | 21 currReq = Bugzilla.ajax({url: "/user", |
22 data: {match: request.term, | |
23 username: $("#username").val(), | |
24 password: $("#password").val()}, | |
25 success: success}); | |
26 } | |
27 }; | |
28 $("input#query").autocomplete(options); | |
28
c631a02f9f63
Submitting user-finder form now opens custom dashboard for that user.
Atul Varma <varmaa@toolness.com>
parents:
26
diff
changeset
|
29 $("#find-user").submit( |
c631a02f9f63
Submitting user-finder form now opens custom dashboard for that user.
Atul Varma <varmaa@toolness.com>
parents:
26
diff
changeset
|
30 function(event) { |
c631a02f9f63
Submitting user-finder form now opens custom dashboard for that user.
Atul Varma <varmaa@toolness.com>
parents:
26
diff
changeset
|
31 event.preventDefault(); |
c631a02f9f63
Submitting user-finder form now opens custom dashboard for that user.
Atul Varma <varmaa@toolness.com>
parents:
26
diff
changeset
|
32 window.open("index.html?username=" + escape($("input#query").val())); |
c631a02f9f63
Submitting user-finder form now opens custom dashboard for that user.
Atul Varma <varmaa@toolness.com>
parents:
26
diff
changeset
|
33 }); |
26 | 34 }); |