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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
d54b8826
Commit
d54b8826
authored
Oct 11, 2016
by
Akram FARES
Committed by
Akram Fares
Nov 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit autocomplete to currently selected items
parent
3de1e71c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
app/assets/javascripts/gfm_auto_complete.js.es6
app/assets/javascripts/gfm_auto_complete.js.es6
+6
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+3
-1
app/services/projects/autocomplete_service.rb
app/services/projects/autocomplete_service.rb
+8
-1
changelogs/unreleased/22680-unlabel-limit-autocomplete-to-selected-items.yml
...ed/22680-unlabel-limit-autocomplete-to-selected-items.yml
+4
-0
No files found.
app/assets/javascripts/gfm_auto_complete.js.es6
View file @
d54b8826
...
...
@@ -51,6 +51,11 @@
if (!GitLab.GfmAutoComplete.dataLoaded) {
return this.at;
} else {
if (value.indexOf("unlabel") !== -1) {
GitLab.GfmAutoComplete.input.atwho('load', '~', GitLab.GfmAutoComplete.cachedData.unlabels);
} else {
GitLab.GfmAutoComplete.input.atwho('load', '~', GitLab.GfmAutoComplete.cachedData.labels);
}
return value;
}
}
...
...
@@ -352,3 +357,4 @@
};
}).call(this);
app/controllers/projects_controller.rb
View file @
d54b8826
...
...
@@ -144,13 +144,15 @@ class ProjectsController < Projects::ApplicationController
autocomplete
=
::
Projects
::
AutocompleteService
.
new
(
@project
,
current_user
)
participants
=
::
Projects
::
ParticipantsService
.
new
(
@project
,
current_user
).
execute
(
noteable
)
unlabels
=
autocomplete
.
unlabels
(
noteable
)
@suggestions
=
{
emojis:
Gitlab
::
AwardEmoji
.
urls
,
issues:
autocomplete
.
issues
,
milestones:
autocomplete
.
milestones
,
mergerequests:
autocomplete
.
merge_requests
,
labels:
autocomplete
.
labels
,
labels:
autocomplete
.
labels
-
unlabels
,
unlabels:
unlabels
,
members:
participants
,
commands:
autocomplete
.
commands
(
noteable
,
params
[
:type
])
}
...
...
app/services/projects/autocomplete_service.rb
View file @
d54b8826
...
...
@@ -13,7 +13,14 @@ module Projects
end
def
labels
LabelsFinder
.
new
(
current_user
,
project_id:
project
.
id
).
execute
.
select
([
:title
,
:color
])
LabelsFinder
.
new
(
current_user
,
project_id:
project
.
id
).
execute
.
pluck
(
:title
,
:color
).
map
{
|
l
|
{
title:
l
.
first
,
color:
l
.
second
}
}
end
def
unlabels
(
noteable
)
return
[]
unless
noteable
&&
noteable
.
respond_to?
(
:labels
)
noteable
.
labels
.
pluck
(
:title
,
:color
).
map
{
|
l
|
{
title:
l
.
first
,
color:
l
.
second
}
}
end
def
commands
(
noteable
,
type
)
...
...
changelogs/unreleased/22680-unlabel-limit-autocomplete-to-selected-items.yml
0 → 100644
View file @
d54b8826
---
title
:
Limit autocomplete to currently selected items for unlabel slash command
merge_request
:
22680
author
:
Akram Fares
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