diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-01-11 09:42:37 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-01-11 09:42:37 +0000 |
commit | ce066ba63069cfcc2d29aba896bdfa611efe30bc (patch) | |
tree | 9a4e31f94d50e11d237bc163be5d04fd53ef6550 | |
parent | e9f84c4c8c52e5016f19e7cd5fea0a1a09ec93be (diff) | |
parent | cb22e5f942ef77cfaf4c92cefef93e1ec510a55c (diff) | |
download | gitlab-ce-ce066ba63069cfcc2d29aba896bdfa611efe30bc.tar.gz |
Merge branch 'autocomplete-on-load' into 'master'
Load autocomplete data when loading an issue page
See merge request !2312
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js.coffee | 25 |
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 |