BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c34d7409
Commit
c34d7409
authored
Jun 17, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add_autocomplete_for_labels' into 'master'
Add GFM autocomplete for labels Closes #14637 See merge request !4013
parents
6300936b
385eff57
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
0 deletions
+30
-0
CHANGELOG
CHANGELOG
+1
-0
gfm_auto_complete.js.coffee
app/assets/javascripts/gfm_auto_complete.js.coffee
+24
-0
projects_controller.rb
app/controllers/projects_controller.rb
+1
-0
autocomplete_service.rb
app/services/projects/autocomplete_service.rb
+4
-0
No files found.
CHANGELOG
View file @
c34d7409
...
...
@@ -67,6 +67,7 @@ v 8.9.0 (unreleased)
- Use downcased path to container repository as this is expected path by Docker
- Projects pending deletion will render a 404 page
- Measure queue duration between gitlab-workhorse and Rails
- Added Gfm autocomplete for labels
- Make Omniauth providers specs to not modify global configuration
- Make authentication service for Container Registry to be compatible with < Docker 1.11
- Add Application Setting to configure Container Registry token expire delay (default 5min)
...
...
app/assets/javascripts/gfm_auto_complete.js.coffee
View file @
c34d7409
...
...
@@ -15,6 +15,9 @@ GitLab.GfmAutoComplete =
Members
:
template
:
'<li>${username} <small>${title}</small></li>'
Labels
:
template
:
'<li><span class="dropdown-label-box" style="background: ${color}"></span> ${title}</li>'
# Issues and MergeRequests
Issues
:
template
:
'<li><small>${id}</small> ${title}</li>'
...
...
@@ -176,6 +179,25 @@ GitLab.GfmAutoComplete =
title
:
sanitize
(
m
.
title
)
search
:
"
#{
m
.
iid
}
#{
m
.
title
}
"
@
input
.
atwho
at
:
'~'
alias
:
'labels'
searchKey
:
'search'
displayTpl
:
@
Labels
.
template
insertTpl
:
'${atwho-at}${title}'
callbacks
:
beforeSave
:
(
merges
)
->
sanitizeLabelTitle
=
(
title
)
->
if
/\w+\s+\w+/g
.
test
(
title
)
"
\"
#{
sanitize
(
title
)
}
\"
"
else
sanitize
(
title
)
$
.
map
merges
,
(
m
)
->
title
:
sanitizeLabelTitle
(
m
.
title
)
color
:
m
.
color
search
:
"
#{
m
.
title
}
"
destroyAtWho
:
->
@
input
.
atwho
(
'destroy'
)
...
...
@@ -195,6 +217,8 @@ GitLab.GfmAutoComplete =
@
input
.
atwho
'load'
,
'mergerequests'
,
data
.
mergerequests
# load emojis
@
input
.
atwho
'load'
,
':'
,
data
.
emojis
# load labels
@
input
.
atwho
'load'
,
'~'
,
data
.
labels
# This trigger at.js again
# otherwise we would be stuck with loading until the user types
...
...
app/controllers/projects_controller.rb
View file @
c34d7409
...
...
@@ -143,6 +143,7 @@ class ProjectsController < Projects::ApplicationController
issues:
autocomplete
.
issues
,
milestones:
autocomplete
.
milestones
,
mergerequests:
autocomplete
.
merge_requests
,
labels:
autocomplete
.
labels
,
members:
participants
}
...
...
app/services/projects/autocomplete_service.rb
View file @
c34d7409
...
...
@@ -11,5 +11,9 @@ module Projects
def
merge_requests
@project
.
merge_requests
.
opened
.
select
([
:iid
,
:title
])
end
def
labels
@project
.
labels
.
select
([
:title
,
:color
])
end
end
end
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