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
iv
gitlab-ce
Commits
6aa50165
Commit
6aa50165
authored
Mar 01, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'logged-out-search' into 'master'
Logged out search Fixes #13676 See merge request !3045
parents
b8f8a55b
4c8721b2
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
72 additions
and
43 deletions
+72
-43
CHANGELOG
CHANGELOG
+1
-0
app/assets/stylesheets/framework/common.scss
app/assets/stylesheets/framework/common.scss
+1
-1
app/assets/stylesheets/pages/search.scss
app/assets/stylesheets/pages/search.scss
+7
-3
app/controllers/search_controller.rb
app/controllers/search_controller.rb
+2
-0
app/views/layouts/application.html.haml
app/views/layouts/application.html.haml
+1
-5
app/views/layouts/header/_default.html.haml
app/views/layouts/header/_default.html.haml
+27
-22
app/views/layouts/header/_public.html.haml
app/views/layouts/header/_public.html.haml
+0
-10
app/views/search/_form.html.haml
app/views/search/_form.html.haml
+1
-1
app/views/search/_results.html.haml
app/views/search/_results.html.haml
+1
-1
features/search.feature
features/search.feature
+22
-0
features/steps/search.rb
features/steps/search.rb
+9
-0
No files found.
CHANGELOG
View file @
6aa50165
...
@@ -8,6 +8,7 @@ v 8.6.0 (unreleased)
...
@@ -8,6 +8,7 @@ v 8.6.0 (unreleased)
- Strip leading and trailing spaces in URL validator (evuez)
- Strip leading and trailing spaces in URL validator (evuez)
- Return empty array instead of 404 when commit has no statuses in commit status API
- Return empty array instead of 404 when commit has no statuses in commit status API
- Update documentation to reflect Guest role not being enforced on internal projects
- Update documentation to reflect Guest role not being enforced on internal projects
- Allow search for logged out users
v 8.5.2
v 8.5.2
- Fix sidebar overlapping content when screen width was below 1200px
- Fix sidebar overlapping content when screen width was below 1200px
...
...
app/assets/stylesheets/framework/common.scss
View file @
6aa50165
...
@@ -305,7 +305,7 @@ table {
...
@@ -305,7 +305,7 @@ table {
}
}
.btn-sign-in
{
.btn-sign-in
{
margin-top
:
8
px
;
margin-top
:
10
px
;
text-shadow
:
none
;
text-shadow
:
none
;
}
}
...
...
app/assets/stylesheets/pages/search.scss
View file @
6aa50165
.search-results
{
.search-results
{
.search-result-row
{
.search-result-row
{
border-bottom
:
1px
solid
#DDD
;
border-bottom
:
1px
solid
$border-color
;
padding-bottom
:
15px
;
padding-bottom
:
$gl-padding
;
margin-bottom
:
15px
;
margin-bottom
:
$gl-padding
;
&
:last-child
{
border-bottom
:
none
;
}
}
}
}
}
...
...
app/controllers/search_controller.rb
View file @
6aa50165
class
SearchController
<
ApplicationController
class
SearchController
<
ApplicationController
skip_before_action
:authenticate_user!
,
:reject_blocked
include
SearchHelper
include
SearchHelper
layout
'search'
layout
'search'
...
...
app/views/layouts/application.html.haml
View file @
6aa50165
...
@@ -5,11 +5,7 @@
...
@@ -5,11 +5,7 @@
-# Ideally this would be inside the head, but turbolinks only evaluates page-specific JS in the body.
-# Ideally this would be inside the head, but turbolinks only evaluates page-specific JS in the body.
=
yield
:scripts_body_top
=
yield
:scripts_body_top
-
if
current_user
=
render
"layouts/header/default"
,
title:
header_title
=
render
"layouts/header/default"
,
title:
header_title
-
else
=
render
"layouts/header/public"
,
title:
header_title
=
render
'layouts/page'
,
sidebar:
sidebar
=
render
'layouts/page'
,
sidebar:
sidebar
=
yield
:scripts_body
=
yield
:scripts_body
app/views/layouts/header/_default.html.haml
View file @
6aa50165
...
@@ -13,30 +13,35 @@
...
@@ -13,30 +13,35 @@
%li
.visible-sm.visible-xs
%li
.visible-sm.visible-xs
=
link_to
search_path
,
title:
'Search'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
link_to
search_path
,
title:
'Search'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'search'
)
=
icon
(
'search'
)
-
if
session
[
:impersonator_id
]
-
if
current_user
%li
.impersonation
-
if
session
[
:impersonator_id
]
=
link_to
stop_impersonation_admin_users_path
,
method: :delete
,
title:
'Stop Impersonation'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
%li
.impersonation
=
icon
(
'user-secret fw'
)
=
link_to
stop_impersonation_admin_users_path
,
method: :delete
,
title:
'Stop Impersonation'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
-
if
current_user
.
is_admin?
=
icon
(
'user-secret fw'
)
-
if
current_user
.
is_admin?
%li
=
link_to
admin_root_path
,
title:
'Admin Area'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'wrench fw'
)
%li
%li
=
link_to
admin_root_path
,
title:
'Admin Area'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
link_to
dashboard_todos_path
,
title:
'Todos'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'wrench fw'
)
%span
.badge.todos-pending-count
%li
=
todos_pending_count
=
link_to
dashboard_todos_path
,
title:
'Todos'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
-
if
current_user
.
can_create_project?
%span
.badge.todos-pending-count
%li
=
todos_pending_count
=
link_to
new_project_path
,
title:
'New project'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
-
if
current_user
.
can_create_project?
=
icon
(
'plus fw'
)
-
if
Gitlab
::
Sherlock
.
enabled?
%li
=
link_to
sherlock_transactions_path
,
title:
'Sherlock Transactions'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'tachometer fw'
)
%li
%li
=
link_to
new_project_path
,
title:
'New project'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
link_to
destroy_user_session_path
,
class:
'logout'
,
method: :delete
,
title:
'Sign out'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'plus fw'
)
=
icon
(
'sign-out'
)
-
if
Gitlab
::
Sherlock
.
enabled?
-
else
%li
.pull-right
=
link_to
sherlock_transactions_path
,
title:
'Sherlock Transactions'
,
=
link_to
"Sign in"
,
new_session_path
(
:user
,
redirect_to_referer:
'yes'
),
class:
'btn btn-sign-in btn-success'
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'tachometer fw'
)
%li
=
link_to
destroy_user_session_path
,
class:
'logout'
,
method: :delete
,
title:
'Sign out'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'sign-out'
)
%h1
.title
=
title
%h1
.title
=
title
...
...
app/views/layouts/header/_public.html.haml
deleted
100644 → 0
View file @
b8f8a55b
%header
.navbar.navbar-fixed-top.navbar-gitlab
{
class:
nav_header_class
}
%div
{
class:
fluid_layout
?
"container-fluid"
:
"container-fluid"
}
.header-content
-
unless
current_controller?
(
'sessions'
)
.pull-right
=
link_to
"Sign in"
,
new_session_path
(
:user
,
redirect_to_referer:
'yes'
),
class:
'btn btn-sign-in btn-success'
%h1
.title
=
title
=
render
'shared/outdated_browser'
app/views/search/_form.html.haml
View file @
6aa50165
...
@@ -11,4 +11,4 @@
...
@@ -11,4 +11,4 @@
=
button_tag
'Search'
,
class:
"btn btn-primary"
=
button_tag
'Search'
,
class:
"btn btn-primary"
-
unless
params
[
:snippets
].
eql?
'true'
-
unless
params
[
:snippets
].
eql?
'true'
%br
%br
=
render
'filter'
=
render
'filter'
if
current_user
app/views/search/_results.html.haml
View file @
6aa50165
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
=
render
'shared/projects/list'
,
projects:
@objects
=
render
'shared/projects/list'
,
projects:
@objects
-
else
-
else
=
render
partial:
"search/results/
#{
@scope
.
singularize
}
"
,
collection:
@objects
=
render
partial:
"search/results/
#{
@scope
.
singularize
}
"
,
collection:
@objects
=
paginate
@objects
,
theme:
'gitlab'
=
paginate
@objects
,
theme:
'gitlab'
:javascript
:javascript
$
(
"
.search-results .term
"
).
highlight
(
"
#{
escape_javascript
(
params
[
:search
])
}
"
);
$
(
"
.search-results .term
"
).
highlight
(
"
#{
escape_javascript
(
params
[
:search
])
}
"
);
features/search.feature
View file @
6aa50165
...
@@ -65,3 +65,25 @@ Feature: Search
...
@@ -65,3 +65,25 @@ Feature: Search
And
I search for
"Wiki content"
And
I search for
"Wiki content"
And
I click
"Wiki"
link
And
I click
"Wiki"
link
Then
I should see
"test_wiki"
link in the search results
Then
I should see
"test_wiki"
link in the search results
Scenario
:
I
logout and should see project I am looking for
Given
project
"Shop"
is public
And
I logout
And
I search for
"Sho"
Then
I should see
"Shop"
project link
Scenario
:
I
logout and should see issues I am looking for
Given
project
"Shop"
is public
And
I logout
And
project has issues
When
I search for
"Foo"
And
I click
"Issues"
link
Then
I should see
"Foo"
link in the search results
And
I should not see
"Bar"
link in the search results
Scenario
:
I
logout and should see project code I am looking for
Given
project
"Shop"
is public
And
I logout
When
I visit project
"Shop"
page
And
I search for
"rspec"
on project page
Then
I should see code results for project
"Shop"
features/steps/search.rb
View file @
6aa50165
...
@@ -18,6 +18,11 @@ class Spinach::Features::Search < Spinach::FeatureSteps
...
@@ -18,6 +18,11 @@ class Spinach::Features::Search < Spinach::FeatureSteps
click_button
"Search"
click_button
"Search"
end
end
step
'I search for "rspec" on project page'
do
fill_in
"search"
,
with:
"rspec"
click_button
"Go"
end
step
'I search for "Wiki content"'
do
step
'I search for "Wiki content"'
do
fill_in
"dashboard_search"
,
with:
"content"
fill_in
"dashboard_search"
,
with:
"content"
click_button
"Search"
click_button
"Search"
...
@@ -103,4 +108,8 @@ class Spinach::Features::Search < Spinach::FeatureSteps
...
@@ -103,4 +108,8 @@ class Spinach::Features::Search < Spinach::FeatureSteps
@wiki
=
::
ProjectWiki
.
new
(
project
,
current_user
)
@wiki
=
::
ProjectWiki
.
new
(
project
,
current_user
)
@wiki
.
create_page
(
"test_wiki"
,
"Some Wiki content"
,
:markdown
,
"first commit"
)
@wiki
.
create_page
(
"test_wiki"
,
"Some Wiki content"
,
:markdown
,
"first commit"
)
end
end
step
'project "Shop" is public'
do
project
.
update_attributes
(
visibility_level:
Project
::
PUBLIC
)
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