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
28fcf5c4
Commit
28fcf5c4
authored
Feb 21, 2019
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use functional style for tags finder
parent
4667b20c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb
app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb
+19
-19
No files found.
app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb
View file @
28fcf5c4
...
...
@@ -10,34 +10,34 @@ module Autocomplete
end
def
execute
@tags
=
::
ActsAsTaggableOn
::
Tag
.
all
search!
limit!
@tags
tags
=
all_tags
tags
=
filter_by_name
(
tags
)
limit
(
tags
)
end
def
search!
search
=
@params
[
:search
]
return
unless
search
private
if
search
.
empty?
@tags
=
::
ActsAsTaggableOn
::
Tag
.
none
return
def
all_tags
::
ActsAsTaggableOn
::
Tag
.
all
end
@tags
=
def
filter_by_name
(
tags
)
return
tags
unless
search
return
tags
.
none
if
search
.
empty?
if
search
.
length
>=
Gitlab
::
SQL
::
Pattern
::
MIN_CHARS_FOR_PARTIAL_MATCHING
@
tags
.
named_like
(
search
)
tags
.
named_like
(
search
)
else
@tags
.
named
(
search
)
tags
.
named
(
search
)
end
end
def
limit
(
tags
)
tags
.
limit
(
LIMIT
)
# rubocop: disable CodeReuse/ActiveRecord
end
def
limit!
@
tags
=
@tags
.
limit
(
LIMIT
)
# rubocop: disable CodeReuse/ActiveRecord
def
search
@
params
[
:search
]
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