Skip to content
Browse files

user search

  • Loading branch information...
1 parent a9357d6 commit 4a6e1a7f18e9d89a2522352b4960860c9eaa9489 @jchris committed Sep 18, 2010
View
6 evently/profile/profileReady/selectors/div.controls/tweet/mustache.html
@@ -1,4 +1,3 @@
-<h3>Tweet here</h3>
<form class="tweet">
<label>New Tweet: <input type="text" name="status" size=80></label>
<select name="account">
@@ -13,4 +12,9 @@
<label>Search: <input type="text" name="search" size=20></label>
<input type="submit" value="Search">
<span class="matches"></span>
+</form>
+<form class="users">
+ <label>Users: <input type="text" name="users" size=20></label>
+ <input type="submit" value="Go">
+ <span class="matches"></span>
</form>
View
21 evently/profile/profileReady/selectors/div.controls/tweet/selectors/form.users/keyup.js
@@ -0,0 +1,21 @@
+function() {
+ var widget = $(this)
+ , term = $("input[name=users]", widget).val()
+ , app = $$(widget).app
+ , nonce = Math.random()
+ ;
+ $$(widget).nonce = nonce;
+ app.db.list("twebz/topN","userWordCount", {
+ startkey : [term],
+ endkey : [term+"\u9999"],
+ group_level : 1,
+ top : 10,
+ success : function(list) {
+ if ($$(widget).nonce == nonce) {
+ $("form.users span.matches").html(list.map(function(t) {
+ return '<a href="#/user/'+t+'">'+t+'</a>';
+ }).join(' '));
+ }
+ }
+ });
+};

0 comments on commit 4a6e1a7

Please sign in to comment.
Something went wrong with that request. Please try again.