mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Ajaxify booth responsibles selectize interface
No need to load *all* users into a select input...
This commit is contained in:
parent
800bb28c34
commit
2e21079991
4 changed files with 77 additions and 29 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UsersController < ApplicationController
|
||||
before_action :authenticate_user!, only: :search
|
||||
load_and_authorize_resource
|
||||
|
||||
# GET /users/1
|
||||
|
|
@ -22,6 +23,14 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def search
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
render json: { users: User.where('username like ?', "%#{params[:query]}%").select(:username, :id) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue