BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ac8247b4
Commit
ac8247b4
authored
Jan 25, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved search. added filters
parent
f6c482c0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
106 deletions
+117
-106
common.scss
app/assets/stylesheets/common.scss
+14
-2
search_controller.rb
app/controllers/search_controller.rb
+13
-1
application_helper.rb
app/helpers/application_helper.rb
+20
-20
_search.html.haml
app/views/layouts/_search.html.haml
+2
-0
_filter.html.haml
app/views/search/_filter.html.haml
+24
-0
_result.html.haml
app/views/search/_result.html.haml
+34
-79
show.html.haml
app/views/search/show.html.haml
+10
-4
No files found.
app/assets/stylesheets/common.scss
View file @
ac8247b4
html
{
html
{
overflow-y
:
scroll
;
overflow-y
:
scroll
;
}
}
/** LAYOUT **/
/** LAYOUT **/
...
@@ -277,8 +277,20 @@ p.time {
...
@@ -277,8 +277,20 @@ p.time {
}
}
}
}
.search-holder
{
label
,
input
{
height
:
30px
;
padding
:
0
;
font-size
:
14px
;
}
label
{
line-height
:
30px
;
color
:
#666
;
}
}
.highlight_word
{
.highlight_word
{
b
ackground
:
#EEDC94
;
b
order-bottom
:
2px
solid
#F90
;
}
}
.status_info
{
.status_info
{
...
...
app/controllers/search_controller.rb
View file @
ac8247b4
class
SearchController
<
ApplicationController
class
SearchController
<
ApplicationController
def
show
def
show
result
=
SearchContext
.
new
(
current_user
.
authorized_projects
.
map
(
&
:id
),
params
).
execute
project_id
=
params
[
:project_id
]
group_id
=
params
[
:group_id
]
project_ids
=
current_user
.
authorized_projects
.
map
(
&
:id
)
if
group_id
.
present?
group_project_ids
=
Group
.
find
(
group_id
).
projects
.
map
(
&
:id
)
project_ids
.
select!
{
|
id
|
group_project_ids
.
include?
(
id
)}
elsif
project_id
.
present?
project_ids
.
select!
{
|
id
|
id
==
project_id
.
to_i
}
end
result
=
SearchContext
.
new
(
project_ids
,
params
).
execute
@projects
=
result
[
:projects
]
@projects
=
result
[
:projects
]
@merge_requests
=
result
[
:merge_requests
]
@merge_requests
=
result
[
:merge_requests
]
...
...
app/helpers/application_helper.rb
View file @
ac8247b4
...
@@ -72,8 +72,8 @@ module ApplicationHelper
...
@@ -72,8 +72,8 @@ module ApplicationHelper
end
end
def
search_autocomplete_source
def
search_autocomplete_source
projects
=
current_user
.
authorized_projects
.
map
{
|
p
|
{
label:
p
.
name_with_namespace
,
url:
project_path
(
p
)
}
}
projects
=
current_user
.
authorized_projects
.
map
{
|
p
|
{
label:
"project:
#{
p
.
name_with_namespace
}
"
,
url:
project_path
(
p
)
}
}
groups
=
current_user
.
authorized_groups
.
map
{
|
group
|
{
label:
"
<group>
#{
group
.
name
}
"
,
url:
group_path
(
group
)
}
}
groups
=
current_user
.
authorized_groups
.
map
{
|
group
|
{
label:
"
group:
#{
group
.
name
}
"
,
url:
group_path
(
group
)
}
}
default_nav
=
[
default_nav
=
[
{
label:
"My Profile"
,
url:
profile_path
},
{
label:
"My Profile"
,
url:
profile_path
},
...
@@ -83,29 +83,29 @@ module ApplicationHelper
...
@@ -83,29 +83,29 @@ module ApplicationHelper
]
]
help_nav
=
[
help_nav
=
[
{
label:
"API Help"
,
url:
help_api_path
},
{
label:
"
help:
API Help"
,
url:
help_api_path
},
{
label:
"Markdown Help"
,
url:
help_markdown_path
},
{
label:
"
help:
Markdown Help"
,
url:
help_markdown_path
},
{
label:
"Permissions Help"
,
url:
help_permissions_path
},
{
label:
"
help:
Permissions Help"
,
url:
help_permissions_path
},
{
label:
"Public Access Help"
,
url:
help_public_access_path
},
{
label:
"
help:
Public Access Help"
,
url:
help_public_access_path
},
{
label:
"Rake Tasks Help"
,
url:
help_raketasks_path
},
{
label:
"
help:
Rake Tasks Help"
,
url:
help_raketasks_path
},
{
label:
"SSH Keys Help"
,
url:
help_ssh_path
},
{
label:
"
help:
SSH Keys Help"
,
url:
help_ssh_path
},
{
label:
"System Hooks Help"
,
url:
help_system_hooks_path
},
{
label:
"
help:
System Hooks Help"
,
url:
help_system_hooks_path
},
{
label:
"Web Hooks Help"
,
url:
help_web_hooks_path
},
{
label:
"
help:
Web Hooks Help"
,
url:
help_web_hooks_path
},
{
label:
"Workflow Help"
,
url:
help_workflow_path
},
{
label:
"
help:
Workflow Help"
,
url:
help_workflow_path
},
]
]
project_nav
=
[]
project_nav
=
[]
if
@project
&&
@project
.
repository
&&
@project
.
repository
.
root_ref
if
@project
&&
@project
.
repository
&&
@project
.
repository
.
root_ref
project_nav
=
[
project_nav
=
[
{
label:
"
#{
@project
.
name
}
Issues"
,
url:
project_issues_path
(
@project
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Issues"
,
url:
project_issues_path
(
@project
)
},
{
label:
"
#{
@project
.
name
}
Commits"
,
url:
project_commits_path
(
@project
,
@ref
||
@project
.
repository
.
root_ref
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Commits"
,
url:
project_commits_path
(
@project
,
@ref
||
@project
.
repository
.
root_ref
)
},
{
label:
"
#{
@project
.
name
}
Merge Requests"
,
url:
project_merge_requests_path
(
@project
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Merge Requests"
,
url:
project_merge_requests_path
(
@project
)
},
{
label:
"
#{
@project
.
name
}
Milestones"
,
url:
project_milestones_path
(
@project
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Milestones"
,
url:
project_milestones_path
(
@project
)
},
{
label:
"
#{
@project
.
name
}
Snippets"
,
url:
project_snippets_path
(
@project
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Snippets"
,
url:
project_snippets_path
(
@project
)
},
{
label:
"
#{
@project
.
name
}
Team"
,
url:
project_team_index_path
(
@project
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Team"
,
url:
project_team_index_path
(
@project
)
},
{
label:
"
#{
@project
.
name
}
Tree"
,
url:
project_tree_path
(
@project
,
@ref
||
@project
.
repository
.
root_ref
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Tree"
,
url:
project_tree_path
(
@project
,
@ref
||
@project
.
repository
.
root_ref
)
},
{
label:
"
#{
@project
.
name
}
Wall"
,
url:
wall_project_path
(
@project
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Wall"
,
url:
wall_project_path
(
@project
)
},
{
label:
"
#{
@project
.
name
}
Wiki"
,
url:
project_wikis_path
(
@project
)
},
{
label:
"
#{
@project
.
name
_with_namespace
}
-
Wiki"
,
url:
project_wikis_path
(
@project
)
},
]
]
end
end
...
...
app/views/layouts/_search.html.haml
View file @
ac8247b4
.search
.search
=
form_tag
search_path
,
method: :get
,
class:
'navbar-form pull-left'
do
|
f
|
=
form_tag
search_path
,
method: :get
,
class:
'navbar-form pull-left'
do
|
f
|
=
text_field_tag
"search"
,
nil
,
placeholder:
"Search"
,
class:
"search-input"
=
text_field_tag
"search"
,
nil
,
placeholder:
"Search"
,
class:
"search-input"
=
hidden_field_tag
:group_id
,
@group
.
try
(
:id
)
=
hidden_field_tag
:project_id
,
@project
.
try
(
:id
)
:javascript
:javascript
$
(
function
(){
$
(
function
(){
...
...
app/views/search/_filter.html.haml
0 → 100644
View file @
ac8247b4
%fieldset
%legend
Groups:
%ul
.nav.nav-pills.nav-stacked
%li
{
class:
(
"active"
if
params
[
:group_id
].
blank?
)}
=
link_to
search_path
(
group_id:
nil
,
search:
params
[
:search
])
do
Any
-
current_user
.
authorized_groups
.
each
do
|
group
|
%li
{
class:
(
"active"
if
params
[
:group_id
]
==
group
.
id
.
to_s
)}
=
link_to
search_path
(
group_id:
group
.
id
,
search:
params
[
:search
])
do
=
group
.
name
%fieldset
%legend
Projects:
%ul
.nav.nav-pills.nav-stacked
%li
{
class:
(
"active"
if
params
[
:project_id
].
blank?
)}
=
link_to
search_path
(
project_id:
nil
,
search:
params
[
:search
])
do
Any
-
current_user
.
authorized_projects
.
each
do
|
project
|
%li
{
class:
(
"active"
if
params
[
:project_id
]
==
project
.
id
.
to_s
)}
=
link_to
search_path
(
project_id:
project
.
id
,
search:
params
[
:search
])
do
=
project
.
name_with_namespace
=
hidden_field_tag
:group_id
,
params
[
:group_id
]
=
hidden_field_tag
:project_id
,
params
[
:project_id
]
app/views/search/_result.html.haml
View file @
ac8247b4
%br
%fieldset
%h3
.page_title
%legend
Search results
Search results
%span
.cgray
(
#{
@projects
.
count
+
@merge_requests
.
count
+
@issues
.
count
+
@wiki_pages
.
count
}
)
%span
.cgray
(
#{
@projects
.
count
+
@merge_requests
.
count
+
@issues
.
count
+
@wiki_pages
.
count
}
)
%hr
.search_results
.search_results
.row
%ul
.well-list
.span6
-
@projects
.
each
do
|
project
|
%table
%li
%thead
project:
%tr
=
link_to
project
do
%th
Projects
%strong
.term
=
project
.
name_with_namespace
%tbody
-
@merge_requests
.
each
do
|
merge_request
|
-
@projects
.
each
do
|
project
|
%li
%tr
merge request:
%td
=
link_to
[
merge_request
.
project
,
merge_request
]
do
=
link_to
project
do
%span
##{merge_request.id}
%strong
.term
=
project
.
name_with_namespace
%strong
.term
%small
.cgray
=
truncate
merge_request
.
title
,
length:
50
last activity at
%span
.light
(
#{
merge_request
.
project
.
name_with_namespace
}
)
=
project
.
last_activity_date
.
stamp
(
"Aug 25, 2011"
)
-
@issues
.
each
do
|
issue
|
-
if
@projects
.
blank?
%li
%tr
issue:
%td
=
link_to
[
issue
.
project
,
issue
]
do
%h4
.nothing_here_message
No Projects
%span
##{issue.id}
%br
%strong
.term
%table
=
truncate
issue
.
title
,
length:
50
%thead
%span
.light
(
#{
issue
.
project
.
name_with_namespace
}
)
%tr
-
@wiki_pages
.
each
do
|
wiki_page
|
%th
Merge Requests
%li
%tbody
wiki:
-
@merge_requests
.
each
do
|
merge_request
|
=
link_to
project_wiki_path
(
wiki_page
.
project
,
wiki_page
)
do
%tr
%strong
.term
%td
=
truncate
wiki_page
.
title
,
length:
50
=
link_to
[
merge_request
.
project
,
merge_request
]
do
%span
.light
(
#{
wiki_page
.
project
.
name_with_namespace
}
)
%span
.badge.badge-info
##{merge_request.id}
–
%strong
.term
=
truncate
merge_request
.
title
,
length:
50
%strong
.right
%span
.label
=
merge_request
.
project
.
name
-
if
@merge_requests
.
blank?
%tr
%td
%h4
.nothing_here_message
No Merge Requests
.span6
%table
%thead
%tr
%th
Issues
%tbody
-
@issues
.
each
do
|
issue
|
%tr
%td
=
link_to
[
issue
.
project
,
issue
]
do
%span
.badge.badge-info
##{issue.id}
–
%strong
.term
=
truncate
issue
.
title
,
length:
40
%strong
.right
%span
.label
=
issue
.
project
.
name
-
if
@issues
.
blank?
%tr
%td
%h4
.nothing_here_message
No Issues
.span6
%table
%thead
%tr
%th
Wiki
%tbody
-
@wiki_pages
.
each
do
|
wiki_page
|
%tr
%td
=
link_to
project_wiki_path
(
wiki_page
.
project
,
wiki_page
)
do
%strong
.term
=
truncate
wiki_page
.
title
,
length:
40
%strong
.right
%span
.label
=
wiki_page
.
project
.
name
-
if
@wiki_pages
.
blank?
%tr
%td
%h4
.nothing_here_message
No wiki pages
:javascript
:javascript
$
(
function
()
{
$
(
function
()
{
$
(
".search_results .term"
).
highlight
(
"
#{
escape_javascript
(
params
[
:search
])
}
"
);
$
(
".search_results .term"
).
highlight
(
"
#{
escape_javascript
(
params
[
:search
])
}
"
);
...
...
app/views/search/show.html.haml
View file @
ac8247b4
=
form_tag
search_path
,
method: :get
,
class:
'form-inline'
do
|
f
|
=
form_tag
search_path
,
method: :get
,
class:
'form-inline'
do
|
f
|
.
padded
.
search-holder
=
label_tag
:search
do
=
label_tag
:search
do
%s
trong
Looking for
%s
pan
Looking for
.input
.input
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"issue 143"
,
class:
"input-xxlarge search-text-input"
,
id:
"dashboard_search"
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"issue 143"
,
class:
"input-xxlarge search-text-input"
,
id:
"dashboard_search"
=
submit_tag
'Search'
,
class:
"btn primary wide"
=
submit_tag
'Search'
,
class:
"btn primary wide"
-
if
params
[
:search
].
present?
.clearfix
=
render
'search/result'
.row
.span3
=
render
'filter'
,
f:
f
.span9
.results
-
if
params
[
:search
].
present?
=
render
'search/result'
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