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
Boxiang Sun
gitlab-ce
Commits
b3af3930
Commit
b3af3930
authored
Apr 15, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started updating search UI
parent
6ff740ff
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
31 deletions
+49
-31
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+2
-0
app/assets/javascripts/search_dropdowns.js.coffee
app/assets/javascripts/search_dropdowns.js.coffee
+6
-0
app/assets/stylesheets/framework/common.scss
app/assets/stylesheets/framework/common.scss
+1
-0
app/assets/stylesheets/pages/search.scss
app/assets/stylesheets/pages/search.scss
+15
-11
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+10
-0
app/views/search/_filter.html.haml
app/views/search/_filter.html.haml
+11
-9
app/views/search/_form.html.haml
app/views/search/_form.html.haml
+3
-5
app/views/search/_results.html.haml
app/views/search/_results.html.haml
+1
-6
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
b3af3930
...
@@ -108,6 +108,8 @@ class Dispatcher
...
@@ -108,6 +108,8 @@ class Dispatcher
new
BuildArtifacts
()
new
BuildArtifacts
()
when
'projects:group_links:index'
when
'projects:group_links:index'
new
GroupsSelect
()
new
GroupsSelect
()
when
'search:show'
new
SearchDropdowns
()
switch
path
.
first
()
switch
path
.
first
()
when
'admin'
when
'admin'
...
...
app/assets/javascripts/search_dropdowns.js.coffee
0 → 100644
View file @
b3af3930
class
@
SearchDropdowns
constructor
:
->
$
(
'.js-search-group-dropdown'
).
glDropdown
(
selectable
:
true
filterable
:
true
)
app/assets/stylesheets/framework/common.scss
View file @
b3af3930
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
.prepend-top-10
{
margin-top
:
10px
}
.prepend-top-10
{
margin-top
:
10px
}
.prepend-top-default
{
margin-top
:
$gl-padding
!
important
;
}
.prepend-top-default
{
margin-top
:
$gl-padding
!
important
;
}
.prepend-top-20
{
margin-top
:
20px
}
.prepend-top-20
{
margin-top
:
20px
}
.prepend-left-5
{
margin-left
:
5px
}
.prepend-left-10
{
margin-left
:
10px
}
.prepend-left-10
{
margin-left
:
10px
}
.prepend-left-default
{
margin-left
:
$gl-padding
;
}
.prepend-left-default
{
margin-left
:
$gl-padding
;
}
.prepend-left-20
{
margin-left
:
20px
}
.prepend-left-20
{
margin-left
:
20px
}
...
...
app/assets/stylesheets/pages/search.scss
View file @
b3af3930
...
@@ -10,17 +10,6 @@
...
@@ -10,17 +10,6 @@
}
}
}
}
.search-holder
{
max-width
:
600px
;
margin
:
0
auto
;
margin-bottom
:
20px
;
input
{
border-color
:
#bbb
;
font-weight
:
bold
;
}
}
.search
{
.search
{
margin-right
:
10px
;
margin-right
:
10px
;
margin-left
:
10px
;
margin-left
:
10px
;
...
@@ -163,3 +152,18 @@
...
@@ -163,3 +152,18 @@
}
}
}
}
}
}
.search-holder
{
display
:
-
webkit-flex
;
display
:
flex
;
.search-field-holder
{
position
:
relative
;
width
:
100%
;
}
.dropdown-toggle
{
width
:
160px
;
text-align
:
left
;
}
}
app/helpers/search_helper.rb
View file @
b3af3930
...
@@ -19,6 +19,16 @@ module SearchHelper
...
@@ -19,6 +19,16 @@ module SearchHelper
end
end
end
end
def
search_entries_info
(
collection
)
if
collection
.
count
>
0
from
=
collection
.
offset_value
+
1
to
=
collection
.
offset_value
+
collection
.
length
count
=
collection
.
count
"Showing
#{
from
}
-
#{
to
}
of
#{
count
}
results for All projects:
\"
#{
@search_term
}
\"
"
end
end
private
private
# Autocomplete results for various settings pages
# Autocomplete results for various settings pages
...
...
app/views/search/_filter.html.haml
View file @
b3af3930
.dropdown.
inline
.dropdown.
append-right-5.prepend-left-5
%button
.dropdown-toggle.btn.
btn-sm
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%button
.dropdown-toggle.btn.
js-search-group-dropdown
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
%span
.light
Group:
Group:
-
if
@group
.
present?
-
if
@group
.
present?
%strong
=
@group
.
name
%strong
=
@group
.
name
-
else
-
else
Any
Any
%b
.caret
%b
.caret
.dropdown-menu.dropdown-select.dropdown-menu-selectable
.dropdown-menu.dropdown-select.dropdown-menu-selectable
.dropdown-menu-align-right
.dropdown-title
.dropdown-title
%span
Filter results by group
%span
Filter results by group
%button
.dropdown-title-button.dropdown-menu-close
{
aria:
{
label:
"Close"
}
}
%button
.dropdown-title-button.dropdown-menu-close
{
aria:
{
label:
"Close"
}
}
=
icon
(
'times'
)
=
icon
(
'times'
)
=
dropdown_filter
(
"Search groups"
)
.dropdown-content
.dropdown-content
%ul
%ul
%li
%li
...
@@ -22,19 +23,20 @@
...
@@ -22,19 +23,20 @@
=
link_to
search_filter_path
(
group_id:
group
.
id
,
project_id:
nil
),
class:
(
"is-active"
if
params
[
:group_id
]
==
group
.
id
.
to_s
)
do
=
link_to
search_filter_path
(
group_id:
group
.
id
,
project_id:
nil
),
class:
(
"is-active"
if
params
[
:group_id
]
==
group
.
id
.
to_s
)
do
=
group
.
name
=
group
.
name
.dropdown.
inline.prepend-left-10.project-filter
.dropdown.
project-filter.append-right-5.prepend-left-5
%button
.dropdown-toggle.btn
.btn-sm
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%button
.dropdown-toggle.btn
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
%span
.light
Project:
Project:
-
if
@project
.
present?
-
if
@project
.
present?
%strong
=
@project
.
name_with_namespace
%strong
=
@project
.
name_with_namespace
-
else
-
else
Any
Any
%b
.caret
%b
.caret
.dropdown-menu.dropdown-select.dropdown-menu-selectable
.dropdown-menu.dropdown-select.dropdown-menu-selectable
.dropdown-menu-align-right
.dropdown-title
.dropdown-title
%span
Filter results by project
%span
Filter results by project
%button
.dropdown-title-button.dropdown-menu-close
{
aria:
{
label:
"Close"
}}
%button
.dropdown-title-button.dropdown-menu-close
{
aria:
{
label:
"Close"
}}
=
icon
(
'times'
)
=
icon
(
'times'
)
=
dropdown_filter
(
"Search projects"
)
.dropdown-content
.dropdown-content
%ul
%ul
%li
%li
...
...
app/views/search/_form.html.haml
View file @
b3af3930
...
@@ -4,11 +4,9 @@
...
@@ -4,11 +4,9 @@
=
hidden_field_tag
:snippets
,
params
[
:snippets
]
=
hidden_field_tag
:snippets
,
params
[
:snippets
]
=
hidden_field_tag
:scope
,
params
[
:scope
]
=
hidden_field_tag
:scope
,
params
[
:scope
]
.search-holder
.clearfix
.search-holder
.
input-group
.
search-field-holder.append-right-5
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Search for projects, issues etc"
,
class:
"form-control search-text-input"
,
id:
"dashboard_search"
,
autofocus:
true
,
spellcheck:
false
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Search for projects, issues etc"
,
class:
"form-control search-text-input"
,
id:
"dashboard_search"
,
autofocus:
true
,
spellcheck:
false
%span
.input-group-btn
=
button_tag
'Search'
,
class:
"btn btn-primary"
-
unless
params
[
:snippets
].
eql?
'true'
-
unless
params
[
:snippets
].
eql?
'true'
%br
=
render
'filter'
if
current_user
=
render
'filter'
if
current_user
=
button_tag
'Search'
,
class:
"btn btn-success btn-search prepend-left-5"
app/views/search/_results.html.haml
View file @
b3af3930
...
@@ -2,9 +2,7 @@
...
@@ -2,9 +2,7 @@
=
render
partial:
"search/results/empty"
=
render
partial:
"search/results/empty"
-
else
-
else
.gray-content-block
.gray-content-block
Search results for
=
search_entries_info
@objects
%code
=
@search_term
-
unless
@show_snippets
-
unless
@show_snippets
-
if
@project
-
if
@project
in project
#{
link_to
@project
.
name_with_namespace
,
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
]
}
in project
#{
link_to
@project
.
name_with_namespace
,
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
]
}
...
@@ -21,6 +19,3 @@
...
@@ -21,6 +19,3 @@
-
if
@scope
!=
'projects'
-
if
@scope
!=
'projects'
=
paginate
@objects
,
theme:
'gitlab'
=
paginate
@objects
,
theme:
'gitlab'
:javascript
$
(
"
.search-results .term
"
).
highlight
(
"
#{
escape_javascript
(
params
[
:search
])
}
"
);
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