[#369] new pull request: fix a 'To project' typehead

This commit is contained in:
Alexander Machehin 2015-02-10 16:57:16 +05:00
parent 3cef7bd250
commit a1fae2f1b1
2 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,6 @@
_.each $('input.typeahead'), (item) ->
item = $(item)
item = $(item)
triggerLength = 1
if item.data('id')
onSelect = (i) ->
@ -8,7 +9,10 @@ _.each $('input.typeahead'), (item) ->
if item.attr('id') is 'to_project'
onSelect = (data) ->
pullUpdateToProject(data)
triggerLength = 3
item.typeahead
ajax: item.data('ajax')
onSelect: onSelect
ajax:
url: item.data('ajax')
triggerLength: triggerLength
onSelect: onSelect

View File

@ -103,7 +103,7 @@ class Projects::PullRequestsController < Projects::BaseController
def autocomplete_to_project
items = []
term = params[:term].to_s.strip.downcase
term = params[:query].to_s.strip.downcase
[ Project.where(id: @project.pull_requests.last.try(:to_project_id)),
@project.ancestors,
Project.accessible_by(current_ability, :membered)