From 325e0b4dddf68f1fce0a9815a68fab984ccb5814 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 7 Sep 2016 10:39:06 +0200 Subject: [PATCH] Renamed term to query for searches. --- .../javascripts/app/controllers/users.coffee | 26 +++++++++---------- .../javascripts/app/lib/app_post/ajax.coffee | 2 +- .../user_organization_autocompletion.coffee | 16 ++++++------ app/controllers/organizations_controller.rb | 2 +- app/controllers/tickets_controller.rb | 2 +- app/controllers/users_controller.rb | 4 +-- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/app/controllers/users.coffee b/app/assets/javascripts/app/controllers/users.coffee index 0746fccd7..178600cf6 100644 --- a/app/assets/javascripts/app/controllers/users.coffee +++ b/app/assets/javascripts/app/controllers/users.coffee @@ -27,8 +27,8 @@ class Index extends App.ControllerContent (e) => e.preventDefault() $(e.target).toggleClass('active') - term = @searchInput.val().trim() - if term + query = @searchInput.val().trim() + if query @delay( @search, 220, 'search' ) return @recent() @@ -36,10 +36,10 @@ class Index extends App.ControllerContent # start search @searchInput.bind( 'keyup', (e) => - term = @searchInput.val().trim() - return if !term - return if term is @term - @term = term + query = @searchInput.val().trim() + return if !query + return if query is @query + @query = query @delay( @search, 220, 'search' ) ) @@ -140,11 +140,11 @@ class Index extends App.ControllerContent ) @startLoading(@$('.table-overview')) App.Ajax.request( - id: 'search' - type: 'GET' - url: @apiPath + '/users/search' + id: 'search' + type: 'GET' + url: @apiPath + '/users/search' data: - term: @term + query: @query limit: 140 role_ids: role_ids full: 1 @@ -163,9 +163,9 @@ class Index extends App.ControllerContent ) @startLoading(@$('.table-overview')) App.Ajax.request( - id: 'search' - type: 'GET' - url: "#{@apiPath}/users/recent" + id: 'search' + type: 'GET' + url: "#{@apiPath}/users/recent" data: limit: 40 role_ids: role_ids diff --git a/app/assets/javascripts/app/lib/app_post/ajax.coffee b/app/assets/javascripts/app/lib/app_post/ajax.coffee index 8bfb5e5db..06687d69a 100644 --- a/app/assets/javascripts/app/lib/app_post/ajax.coffee +++ b/app/assets/javascripts/app/lib/app_post/ajax.coffee @@ -4,7 +4,7 @@ type: 'GET' url: url data: - term: term + qeury: query processData: true, success: (data, status, xhr) => console.log(data, status) diff --git a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee index 1496e31c6..52c2ea804 100644 --- a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee +++ b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee @@ -290,30 +290,30 @@ class App.UserOrganizationAutocompletion extends App.Controller @userSelect.on 'keyup', @onKeyUp onKeyUp: (e) => - term = $(e.target).val().trim() - return if @searchTerm is term - @searchTerm = term + query = $(e.target).val().trim() + return if @searchTerm is query + @searchTerm = query @hideOrganizationMembers() # hide dropdown - if !term + if !query @emptyResultList() if !@attribute.disableCreateUser @recipientList.append(@buildUserNew()) # show dropdown - if term && ( !@attribute.minLengt || @attribute.minLengt <= term.length ) - @lazySearch(term) + if query && ( !@attribute.minLengt || @attribute.minLengt <= query.length ) + @lazySearch(query) - searchUser: (term) => + searchUser: (query) => @ajax( id: "searchUser#{@key}" type: 'GET' url: @attribute.source data: - query: term + query: query processData: true success: (data, status, xhr) => @emptyResultList() diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 4628807d5..baa16ae29 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -228,7 +228,7 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co end query_params = { - query: params[:term], + query: params[:query], limit: params[:limit], current_user: current_user, } diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index cf37b24f8..79ab1c0e1 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -396,7 +396,7 @@ class TicketsController < ApplicationController # build result list tickets = Ticket.search( limit: params[:limit], - query: params[:term], + query: params[:query], condition: params[:condition], current_user: current_user, ) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7c9c3a9fb..724f7fdc7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -310,7 +310,7 @@ class UsersController < ApplicationController # The requester has to be in the role 'Admin' or 'Agent' to # be able to search for User records. # - # @parameter term [String] The search term. + # @parameter query [String] The search query. # @parameter limit [Integer] The limit of search results. # @parameter role_ids(multi) [Array] A list of Role identifiers to which the Users have to be allocated to. # @parameter full [Boolean] Defines if the result should be @@ -332,7 +332,7 @@ class UsersController < ApplicationController end query_params = { - query: params[:term], + query: params[:query], limit: params[:limit], current_user: current_user, }