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
Jérome Perrin
gitlab-ce
Commits
bb50edb1
Commit
bb50edb1
authored
Apr 15, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Loads group & projects on search page with ajax
parent
b3af3930
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
24 deletions
+58
-24
app/assets/javascripts/search_dropdowns.js.coffee
app/assets/javascripts/search_dropdowns.js.coffee
+38
-0
app/views/search/_filter.html.haml
app/views/search/_filter.html.haml
+19
-21
app/views/search/_form.html.haml
app/views/search/_form.html.haml
+1
-3
No files found.
app/assets/javascripts/search_dropdowns.js.coffee
View file @
bb50edb1
...
...
@@ -3,4 +3,42 @@ class @SearchDropdowns
$
(
'.js-search-group-dropdown'
).
glDropdown
(
selectable
:
true
filterable
:
true
fieldName
:
'group_id'
data
:
(
term
,
callback
)
->
Api
.
groups
term
,
null
,
(
data
)
->
data
.
unshift
(
name
:
'Any'
)
data
.
splice
1
,
0
,
'divider'
callback
(
data
)
id
:
(
obj
)
->
obj
.
id
text
:
(
obj
)
->
obj
.
name
clicked
:
=>
@
submitSearch
()
)
$
(
'.js-search-project-dropdown'
).
glDropdown
(
selectable
:
true
filterable
:
true
fieldName
:
'project_id'
data
:
(
term
,
callback
)
->
Api
.
projects
term
,
'id'
,
(
data
)
->
data
.
unshift
(
name_with_namespace
:
'Any'
)
data
.
splice
1
,
0
,
'divider'
callback
(
data
)
id
:
(
obj
)
->
obj
.
id
text
:
(
obj
)
->
obj
.
name_with_namespace
clicked
:
=>
@
submitSearch
()
)
submitSearch
:
->
$
(
'.js-search-form'
).
submit
()
app/views/search/_filter.html.haml
View file @
bb50edb1
-
if
params
[
:group_id
].
present?
=
hidden_field_tag
:group_id
,
params
[
:group_id
]
-
if
params
[
:project_id
].
present?
=
hidden_field_tag
:project_id
,
params
[
:project_id
]
.dropdown.append-right-5.prepend-left-5
%button
.dropdown-toggle.btn.js-search-group-dropdown
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
Group:
...
...
@@ -12,19 +16,11 @@
%button
.dropdown-title-button.dropdown-menu-close
{
aria:
{
label:
"Close"
}
}
=
icon
(
'times'
)
=
dropdown_filter
(
"Search groups"
)
.dropdown-content
%ul
%li
=
link_to
search_filter_path
(
group_id:
nil
),
class:
(
"is-active"
if
!
params
[
:group_id
].
present?
)
do
Any
%li
.divider
-
current_user
.
authorized_groups
.
sort_by
(
&
:name
).
each
do
|
group
|
%li
=
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
=
dropdown_content
=
dropdown_loading
.dropdown.project-filter.append-right-5.prepend-left-5
%button
.dropdown-toggle.btn
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
%button
.dropdown-toggle.btn
.js-search-project-dropdown
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
Project:
-
if
@project
.
present?
%strong
=
@project
.
name_with_namespace
...
...
@@ -37,13 +33,15 @@
%button
.dropdown-title-button.dropdown-menu-close
{
aria:
{
label:
"Close"
}}
=
icon
(
'times'
)
=
dropdown_filter
(
"Search projects"
)
.dropdown-content
%ul
%li
=
link_to
search_filter_path
(
project_id:
nil
),
class:
(
"is-active"
if
!
params
[
:project_id
].
present?
)
do
Any
%li
.divider
-
current_user
.
authorized_projects
.
sort_by
(
&
:name_with_namespace
).
each
do
|
project
|
%li
=
link_to
search_filter_path
(
project_id:
project
.
id
,
group_id:
nil
),
class:
(
"is-active"
if
params
[
:project_id
]
==
project
.
id
.
to_s
)
do
=
project
.
name_with_namespace
=
dropdown_content
=
dropdown_loading
-# .dropdown-content
-# %ul
-# %li
-# = link_to search_filter_path(project_id: nil), class: ("is-active" if !params[:project_id].present?) do
-# Any
-# %li.divider
-# - current_user.authorized_projects.sort_by(&:name_with_namespace).each do |project|
-# %li
-# = link_to search_filter_path(project_id: project.id, group_id: nil), class: ("is-active" if params[:project_id] == project.id.to_s) do
-# = project.name_with_namespace
app/views/search/_form.html.haml
View file @
bb50edb1
=
form_tag
search_path
,
method: :get
do
|
f
|
=
hidden_field_tag
:project_id
,
params
[
:project_id
]
=
hidden_field_tag
:group_id
,
params
[
:group_id
]
=
form_tag
search_path
,
method: :get
,
class:
'js-search-form'
do
|
f
|
=
hidden_field_tag
:snippets
,
params
[
:snippets
]
=
hidden_field_tag
:scope
,
params
[
:scope
]
...
...
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