summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-01-06 11:43:21 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-01-08 17:16:39 +0100
commitcb22e5f942ef77cfaf4c92cefef93e1ec510a55c (patch)
treeb1efa0827701238fb6c8e83b25a4431ce62f7948 /app
parentc1e974ed889dd31fbbddfa2daeb1a681043d5aa0 (diff)
downloadgitlab-ce-cb22e5f942ef77cfaf4c92cefef93e1ec510a55c.tar.gz
Load autocomplete data when loading an issue pageautocomplete-on-load
This ensures the dropdown is fully available the moment a user starts typing out a username, issue ID, etc. While this won't speed up loading the autocomplete data itself it should at least make it less annoying for the user.
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/gfm_auto_complete.js.coffee25
1 files changed, 12 insertions, 13 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js.coffee b/app/assets/javascripts/gfm_auto_complete.js.coffee
index 7967892f856..fa90fb65f42 100644
--- a/app/assets/javascripts/gfm_auto_complete.js.coffee
+++ b/app/assets/javascripts/gfm_auto_complete.js.coffee
@@ -34,7 +34,7 @@ GitLab.GfmAutoComplete =
searchKey: 'search'
callbacks:
beforeSave: (members) ->
- $.map members, (m) ->
+ $.map members, (m) ->
title = m.name
title += " (#{m.count})" if m.count
@@ -50,7 +50,7 @@ GitLab.GfmAutoComplete =
insertTpl: '${atwho-at}${id}'
callbacks:
beforeSave: (issues) ->
- $.map issues, (i) ->
+ $.map issues, (i) ->
id: i.iid
title: sanitize(i.title)
search: "#{i.iid} #{i.title}"
@@ -63,18 +63,17 @@ GitLab.GfmAutoComplete =
insertTpl: '${atwho-at}${id}'
callbacks:
beforeSave: (merges) ->
- $.map merges, (m) ->
+ $.map merges, (m) ->
id: m.iid
title: sanitize(m.title)
search: "#{m.iid} #{m.title}"
- input.one 'focus', =>
- $.getJSON(@dataSource).done (data) ->
- # load members
- input.atwho 'load', '@', data.members
- # load issues
- input.atwho 'load', 'issues', data.issues
- # load merge requests
- input.atwho 'load', 'mergerequests', data.mergerequests
- # load emojis
- input.atwho 'load', ':', data.emojis
+ $.getJSON(@dataSource).done (data) ->
+ # load members
+ input.atwho 'load', '@', data.members
+ # load issues
+ input.atwho 'load', 'issues', data.issues
+ # load merge requests
+ input.atwho 'load', 'mergerequests', data.mergerequests
+ # load emojis
+ input.atwho 'load', ':', data.emojis