Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cc154fc4
Commit
cc154fc4
authored
Jul 01, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache autocomplete results
parent
ab81ea1e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
app/assets/javascripts/gfm_auto_complete.js.coffee
app/assets/javascripts/gfm_auto_complete.js.coffee
+5
-2
app/views/layouts/_init_auto_complete.html.haml
app/views/layouts/_init_auto_complete.html.haml
+1
-0
No files found.
app/assets/javascripts/gfm_auto_complete.js.coffee
View file @
cc154fc4
...
...
@@ -4,7 +4,7 @@ window.GitLab ?= {}
GitLab
.
GfmAutoComplete
=
dataLoading
:
false
dataLoaded
:
false
cachedData
:
{}
dataSource
:
''
# Emoji
...
...
@@ -55,7 +55,7 @@ GitLab.GfmAutoComplete =
@
setupAtWho
()
if
@
dataSource
if
!
@
dataLoading
if
not
@
dataLoading
and
not
@
cachedData
@
dataLoading
=
true
# We should wait until initializations are done
...
...
@@ -70,6 +70,8 @@ GitLab.GfmAutoComplete =
@
loadData
(
data
)
,
1000
)
if
@
cachedData
?
@
loadData
(
@
cachedData
)
setupAtWho
:
->
# Emoji
...
...
@@ -205,6 +207,7 @@ GitLab.GfmAutoComplete =
$
.
getJSON
(
dataSource
)
loadData
:
(
data
)
->
@
cachedData
=
data
@
dataLoaded
=
true
# load members
...
...
app/views/layouts/_init_auto_complete.html.haml
View file @
cc154fc4
...
...
@@ -3,4 +3,5 @@
-
if
@noteable
:javascript
GitLab
.
GfmAutoComplete
.
dataSource
=
"
#{
autocomplete_sources_namespace_project_path
(
project
.
namespace
,
project
,
type:
@noteable
.
class
,
type_id:
params
[
:id
])
}
"
GitLab
.
GfmAutoComplete
.
cachedData
=
undefined
;
GitLab
.
GfmAutoComplete
.
setup
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment