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
97c1a1ef
Commit
97c1a1ef
authored
Apr 26, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated based on feedback
Changed some variable names Fixed CHANGELOG entry
parent
7ee5de19
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
14 deletions
+15
-14
CHANGELOG
CHANGELOG
+1
-1
app/controllers/search_controller.rb
app/controllers/search_controller.rb
+3
-2
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+6
-6
app/views/search/_results.html.haml
app/views/search/_results.html.haml
+5
-5
No files found.
CHANGELOG
View file @
97c1a1ef
...
...
@@ -4,6 +4,7 @@ v 8.8.0 (unreleased)
- Remove future dates from contribution calendar graph.
- Fix error when visiting commit builds page before build was updated
- Add 'l' shortcut to open Label dropdown on issuables and 'i' to create new issue on a project
- Updated search UI
v 8.7.1 (unreleased)
- Fix .gitlab-ci.yml parsing issue when hidde job is a template without script definition. !3849
...
...
@@ -133,7 +134,6 @@ v 8.6.7
- Fix persistent XSS vulnerability in `commit_person_link` helper
- Fix persistent XSS vulnerability in Label and Milestone dropdowns
- Fix vulnerability that made it possible to enumerate private projects belonging to group
- Updated search UI
v 8.6.6
- Expire the exists cache before deletion to ensure project dir actually exists (Stan Hu). !3413
...
...
app/controllers/search_controller.rb
View file @
97c1a1ef
...
...
@@ -6,6 +6,8 @@ class SearchController < ApplicationController
layout
'search'
def
show
return
if
params
[
:search
].
nil?
||
params
[
:search
].
blank?
if
params
[
:project_id
].
present?
@project
=
Project
.
find_by
(
id:
params
[
:project_id
])
@project
=
nil
unless
can?
(
current_user
,
:download_code
,
@project
)
...
...
@@ -16,7 +18,6 @@ class SearchController < ApplicationController
@group
=
nil
unless
can?
(
current_user
,
:read_group
,
@group
)
end
return
if
params
[
:search
].
nil?
||
params
[
:search
].
blank?
@search_term
=
params
[
:search
]
@scope
=
params
[
:scope
]
...
...
@@ -43,7 +44,7 @@ class SearchController < ApplicationController
Search
::
GlobalService
.
new
(
current_user
,
params
).
execute
end
@objects
=
@search_results
.
objects
(
@scope
,
params
[
:page
])
@
search_
objects
=
@search_results
.
objects
(
@scope
,
params
[
:page
])
end
def
autocomplete
...
...
app/helpers/search_helper.rb
View file @
97c1a1ef
...
...
@@ -20,13 +20,13 @@ module SearchHelper
end
def
search_entries_info
(
collection
,
scope
,
term
)
if
collection
.
count
>
0
from
=
collection
.
offset_value
+
1
to
=
collection
.
offset_value
+
collection
.
length
count
=
collection
.
total_count
return
unless
collection
.
count
>
0
"Showing
#{
from
}
-
#{
to
}
of
#{
count
}
#{
scope
.
humanize
(
capitalize:
false
)
}
for
\"
#{
term
}
\"
"
end
from
=
collection
.
offset_value
+
1
to
=
collection
.
offset_value
+
collection
.
length
count
=
collection
.
total_count
"Showing
#{
from
}
-
#{
to
}
of
#{
count
}
#{
scope
.
humanize
(
capitalize:
false
)
}
for
\"
#{
term
}
\"
"
end
private
...
...
app/views/search/_results.html.haml
View file @
97c1a1ef
-
if
@objects
.
empty?
-
if
@
search_
objects
.
empty?
=
render
partial:
"search/results/empty"
-
else
.gray-content-block
=
search_entries_info
@objects
,
@scope
,
@search_term
=
search_entries_info
(
@search_objects
,
@scope
,
@search_term
)
-
unless
@show_snippets
-
if
@project
in project
#{
link_to
@project
.
name_with_namespace
,
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
]
}
...
...
@@ -13,9 +13,9 @@
.search-results
-
if
@scope
==
'projects'
.term
=
render
'shared/projects/list'
,
projects:
@objects
=
render
'shared/projects/list'
,
projects:
@
search_
objects
-
else
=
render
partial:
"search/results/
#{
@scope
.
singularize
}
"
,
collection:
@objects
=
render
partial:
"search/results/
#{
@scope
.
singularize
}
"
,
collection:
@
search_
objects
-
if
@scope
!=
'projects'
=
paginate
@objects
,
theme:
'gitlab'
=
paginate
(
@search_objects
,
theme:
'gitlab'
)
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