Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
dbd6dfc6
Commit
dbd6dfc6
authored
May 04, 2011
by
Gregor Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
#373
] Refactoring auto_completes#issues action
hoping to make it more intention revealing
parent
85092129
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
auto_completes_controller.rb
app/controllers/auto_completes_controller.rb
+8
-8
No files found.
app/controllers/auto_completes_controller.rb
View file @
dbd6dfc6
...
...
@@ -4,18 +4,18 @@ class AutoCompletesController < ApplicationController
def
issues
@issues
=
[]
q
=
params
[
:q
].
to_s
query
=
(
params
[
:scope
]
==
"all"
&&
Setting
.
cross_project_issue_relations?
)
?
Issue
:
@project
.
issues
if
q
.
match
(
/^\d+$/
)
@issues
<<
query
.
visible
.
find_by_id
(
q
.
to_i
)
end
unless
q
.
blank?
@issues
+=
query
.
visible
.
find
(
:all
,
if
q
.
present?
query
=
(
params
[
:scope
]
==
"all"
&&
Setting
.
cross_project_issue_relations?
)
?
Issue
:
@project
.
issues
@issues
|=
query
.
visible
.
find_all_by_id
(
q
.
to_i
)
if
q
=~
/^\d+$/
@issues
|=
query
.
visible
.
find
(
:all
,
:limit
=>
10
,
:order
=>
"
#{
Issue
.
table_name
}
.id ASC"
,
:conditions
=>
[
"LOWER(
#{
Issue
.
table_name
}
.subject) LIKE :q OR CAST(
#{
Issue
.
table_name
}
.id AS CHAR(13)) LIKE :q"
,
{
:q
=>
"%
#{
q
.
downcase
}
%"
}])
end
@issues
.
compact!
@issues
.
uniq!
render
:layout
=>
false
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