summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-26 18:06:21 +0100
committerAzul <azul@leap.se>2012-11-26 19:14:01 +0100
commita941c89293bcbb067c6152b63765ead38a484b81 (patch)
treedff2714a47805f248913fb9b4773a6e267d864b0
parent9afcef0648f34435f40644242e038cafb1dce117 (diff)
basic typeahead and user querying working
-rw-r--r--users/app/assets/javascripts/users.js.coffee2
-rw-r--r--users/app/controllers/users_controller.rb2
-rw-r--r--users/app/views/users/index.html.haml8
3 files changed, 6 insertions, 6 deletions
diff --git a/users/app/assets/javascripts/users.js.coffee b/users/app/assets/javascripts/users.js.coffee
index 61d4121..76a6d79 100644
--- a/users/app/assets/javascripts/users.js.coffee
+++ b/users/app/assets/javascripts/users.js.coffee
@@ -22,7 +22,7 @@ srp.error = (message) ->
alert(message)
pollUsers = (query, process) ->
- $.get( "/users.json", query: query).done(process);
+ $.get( "/users.json", query: query).done(process)
$(document).ready ->
$('#new_user').submit preventDefault
diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb
index 09199f0..925b584 100644
--- a/users/app/controllers/users_controller.rb
+++ b/users/app/controllers/users_controller.rb
@@ -13,7 +13,7 @@ class UsersController < ApplicationController
else
@users = User.by_created_at.descending
end
- @users = @users.limit(5)
+ @users = @users.limit(10)
respond_with @users.map(&:login).sort
end
diff --git a/users/app/views/users/index.html.haml b/users/app/views/users/index.html.haml
index 65e99af..9e6a179 100644
--- a/users/app/views/users/index.html.haml
+++ b/users/app/views/users/index.html.haml
@@ -2,7 +2,7 @@
%h1= User.model_name.human(:count =>User.count)
.row
.span8
- %h2 Last users who signed up
+ %h2= params[:query] ? "Users starting with '#{params[:query]}'" : "Last users who signed up"
%table.table.table-hover
%tr
%th Login
@@ -11,7 +11,7 @@
= render @users.all
.span4
%h4 Find user
- %form.form-search
+ = form_tag users_path, :method => :get, :class => "form-search" do
.input-append
- %input.user.typeahead.span2.search-query{:type => :text}
- %button.btn{:type => :submit} Search
+ = text_field_tag :query, "", :class => "user typeahead span2 search-query", :autocomplete => :off
+ %button.btn{:type => :submit} Search