Commit 569f5701 authored by Yorick Peterse's avatar Yorick Peterse

Only load autocomplete data when actually needed

Previously this would result in autocomplete data being loaded for every
page (e.g. the page showing all Git branches of a project).
parent ce066ba6
...@@ -68,12 +68,13 @@ GitLab.GfmAutoComplete = ...@@ -68,12 +68,13 @@ GitLab.GfmAutoComplete =
title: sanitize(m.title) title: sanitize(m.title)
search: "#{m.iid} #{m.title}" search: "#{m.iid} #{m.title}"
$.getJSON(@dataSource).done (data) -> if @dataSource
# load members $.getJSON(@dataSource).done (data) ->
input.atwho 'load', '@', data.members # load members
# load issues input.atwho 'load', '@', data.members
input.atwho 'load', 'issues', data.issues # load issues
# load merge requests input.atwho 'load', 'issues', data.issues
input.atwho 'load', 'mergerequests', data.mergerequests # load merge requests
# load emojis input.atwho 'load', 'mergerequests', data.mergerequests
input.atwho 'load', ':', data.emojis # load emojis
input.atwho 'load', ':', data.emojis
- project = @target_project || @project - project = @target_project || @project
:javascript
GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_namespace_project_path(project.namespace, project, type: @noteable.class, type_id: params[:id])}" - if @noteable
GitLab.GfmAutoComplete.setup(); :javascript
GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_namespace_project_path(project.namespace, project, type: @noteable.class, type_id: params[:id])}"
GitLab.GfmAutoComplete.setup();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment