summaryrefslogtreecommitdiff
path: root/app/controllers/identities_controller.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-07-09 12:51:16 +0200
committerAzul <azul@leap.se>2014-07-09 12:51:16 +0200
commit0cc11ebb609de225fbeacbf80788b992b88b6ce6 (patch)
tree3dbf8562e91ac7d7c8759a0516efbdca93cbdeff /app/controllers/identities_controller.rb
parentbdb4b0e275c205b0b44bbe3cc4ec4c162b309b37 (diff)
list identities based on search only
Diffstat (limited to 'app/controllers/identities_controller.rb')
-rw-r--r--app/controllers/identities_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/identities_controller.rb b/app/controllers/identities_controller.rb
index 624e38a..8bd3b28 100644
--- a/app/controllers/identities_controller.rb
+++ b/app/controllers/identities_controller.rb
@@ -1,12 +1,18 @@
class IdentitiesController < ApplicationController
+ respond_to :html, :json
before_filter :require_login
before_filter :require_admin
before_filter :fetch_identity, only: :destroy
before_filter :protect_main_email, only: :destroy
def index
- @identities = Identity.all
+ if params[:query].present?
+ @identities = Identity.address_starts_with(params[:query]).limit(100)
+ else
+ @identities = []
+ end
+ respond_with @identities.map(&:login).sort
end
def destroy