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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
83f7e98d
Commit
83f7e98d
authored
Mar 10, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project filter by visibility and tag to explore page
parent
8527e8d5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
88 additions
and
144 deletions
+88
-144
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+0
-1
app/controllers/explore/projects_controller.rb
app/controllers/explore/projects_controller.rb
+3
-0
app/helpers/dashboard_helper.rb
app/helpers/dashboard_helper.rb
+0
-16
app/helpers/explore_helper.rb
app/helpers/explore_helper.rb
+17
-0
app/views/dashboard/_projects_filter.html.haml
app/views/dashboard/_projects_filter.html.haml
+0
-100
app/views/explore/projects/_filter.html.haml
app/views/explore/projects/_filter.html.haml
+67
-0
app/views/explore/projects/index.html.haml
app/views/explore/projects/index.html.haml
+1
-26
app/views/layouts/nav/_dashboard.html.haml
app/views/layouts/nav/_dashboard.html.haml
+0
-1
No files found.
app/controllers/dashboard_controller.rb
View file @
83f7e98d
...
...
@@ -36,7 +36,6 @@ class DashboardController < ApplicationController
end
@projects
=
@projects
.
where
(
namespace_id:
Group
.
find_by
(
name:
params
[
:group
]))
if
params
[
:group
].
present?
@projects
=
@projects
.
where
(
visibility_level:
params
[
:visibility_level
])
if
params
[
:visibility_level
].
present?
@projects
=
@projects
.
includes
(
:namespace
,
:forked_from_project
,
:tags
)
@projects
=
@projects
.
tagged_with
(
params
[
:tag
])
if
params
[
:tag
].
present?
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
...
...
app/controllers/explore/projects_controller.rb
View file @
83f7e98d
...
...
@@ -6,6 +6,9 @@ class Explore::ProjectsController < ApplicationController
def
index
@projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
@tags
=
@projects
.
tags_on
(
:tags
)
@projects
=
@projects
.
tagged_with
(
params
[
:tag
])
if
params
[
:tag
].
present?
@projects
=
@projects
.
where
(
visibility_level:
params
[
:visibility_level
])
if
params
[
:visibility_level
].
present?
@projects
=
@projects
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
includes
(
:namespace
).
page
(
params
[
:page
]).
per
(
20
)
...
...
app/helpers/dashboard_helper.rb
View file @
83f7e98d
module
DashboardHelper
def
projects_dashboard_filter_path
(
options
=
{})
exist_opts
=
{
sort:
params
[
:sort
],
scope:
params
[
:scope
],
group:
params
[
:group
],
tag:
params
[
:tag
],
visibility_level:
params
[
:visibility_level
],
}
options
=
exist_opts
.
merge
(
options
)
path
=
request
.
path
path
<<
"?
#{
options
.
to_param
}
"
path
end
def
assigned_issues_dashboard_path
issues_dashboard_path
(
assignee_id:
current_user
.
id
)
end
...
...
app/helpers/explore_helper.rb
0 → 100644
View file @
83f7e98d
module
ExploreHelper
def
explore_projects_filter_path
(
options
=
{})
exist_opts
=
{
sort:
params
[
:sort
],
scope:
params
[
:scope
],
group:
params
[
:group
],
tag:
params
[
:tag
],
visibility_level:
params
[
:visibility_level
],
}
options
=
exist_opts
.
merge
(
options
)
path
=
request
.
path
path
<<
"?
#{
options
.
to_param
}
"
path
end
end
app/views/dashboard/_projects_filter.html.haml
deleted
100644 → 0
View file @
8527e8d5
.dash-projects-filters.append-bottom-20
.append-right-20
%ul
.nav.nav-tabs
=
nav_tab
:scope
,
nil
do
=
link_to
projects_dashboard_filter_path
(
scope:
nil
)
do
All
=
nav_tab
:scope
,
'personal'
do
=
link_to
projects_dashboard_filter_path
(
scope:
'personal'
)
do
Personal
=
nav_tab
:scope
,
'joined'
do
=
link_to
projects_dashboard_filter_path
(
scope:
'joined'
)
do
Joined
=
nav_tab
:scope
,
'owned'
do
=
link_to
projects_dashboard_filter_path
(
scope:
'owned'
)
do
Owned
.dropdown.inline.append-right-10
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%i
.fa.fa-globe
%span
.light
Visibility:
-
if
params
[
:visibility_level
].
present?
=
visibility_level_label
(
params
[
:visibility_level
].
to_i
)
-
else
Any
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
projects_dashboard_filter_path
(
visibility_level:
nil
)
do
Any
-
Gitlab
::
VisibilityLevel
.
values
.
each
do
|
level
|
%li
{
class:
(
level
.
to_s
==
params
[
:visibility_level
])
?
'active'
:
'light'
}
=
link_to
projects_dashboard_filter_path
(
visibility_level:
level
)
do
=
visibility_level_icon
(
level
)
=
visibility_level_label
(
level
)
-
if
@groups
.
present?
.dropdown.inline.append-right-10
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%i
.fa.fa-group
%span
.light
Group:
-
if
params
[
:group
].
present?
=
Group
.
find_by
(
name:
params
[
:group
]).
name
-
else
Any
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
projects_dashboard_filter_path
(
group:
nil
)
do
Any
-
@groups
.
each
do
|
group
|
%li
{
class:
(
group
.
name
==
params
[
:group
])
?
'active'
:
'light'
}
=
link_to
projects_dashboard_filter_path
(
group:
group
.
name
)
do
=
group
.
name
%small
.pull-right
=
group
.
projects
.
count
-
if
@tags
.
present?
.dropdown.inline.append-right-10
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%i
.fa.fa-tags
%span
.light
Tags:
-
if
params
[
:tag
].
present?
=
params
[
:tag
]
-
else
Any
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
projects_dashboard_filter_path
(
tag:
nil
)
do
Any
-
@tags
.
each
do
|
tag
|
%li
{
class:
(
tag
.
name
==
params
[
:tag
])
?
'active'
:
'light'
}
=
link_to
projects_dashboard_filter_path
(
tag:
tag
.
name
)
do
%i
.fa.fa-tag
=
tag
.
name
.pull-right
.dropdown.inline
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
-
if
@sort
.
present?
=
sort_options_hash
[
@sort
]
-
else
=
sort_title_recently_created
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_recently_created
)
do
=
sort_title_recently_created
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_name
)
do
=
sort_title_name
app/views/explore/projects/_filter.html.haml
0 → 100644
View file @
83f7e98d
.pull-left
=
form_tag
explore_projects_filter_path
,
method: :get
,
class:
'form-inline form-tiny'
do
|
f
|
.form-group
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"form-control search-text-input input-mn-300"
,
id:
"projects_search"
.form-group
=
button_tag
'Search'
,
class:
"btn btn-primary wide"
.pull-right.hidden-sm.hidden-xs
-
if
current_user
.dropdown.inline.append-right-10
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%i
.fa.fa-globe
%span
.light
Visibility:
-
if
params
[
:visibility_level
].
present?
=
visibility_level_label
(
params
[
:visibility_level
].
to_i
)
-
else
Any
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
explore_projects_filter_path
(
visibility_level:
nil
)
do
Any
-
Gitlab
::
VisibilityLevel
.
values
.
each
do
|
level
|
%li
{
class:
(
level
.
to_s
==
params
[
:visibility_level
])
?
'active'
:
'light'
}
=
link_to
explore_projects_filter_path
(
visibility_level:
level
)
do
=
visibility_level_icon
(
level
)
=
visibility_level_label
(
level
)
-
if
@tags
.
present?
.dropdown.inline.append-right-10
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%i
.fa.fa-tags
%span
.light
Tags:
-
if
params
[
:tag
].
present?
=
params
[
:tag
]
-
else
Any
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
explore_projects_filter_path
(
tag:
nil
)
do
Any
-
@tags
.
each
do
|
tag
|
%li
{
class:
(
tag
.
name
==
params
[
:tag
])
?
'active'
:
'light'
}
=
link_to
explore_projects_filter_path
(
tag:
tag
.
name
)
do
%i
.fa.fa-tag
=
tag
.
name
.dropdown.inline
%button
.dropdown-toggle.btn
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%span
.light
sort:
-
if
@sort
.
present?
=
sort_options_hash
[
@sort
]
-
else
=
sort_title_recently_created
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
explore_projects_filter_path
(
sort:
sort_value_recently_created
)
do
=
sort_title_recently_created
=
link_to
explore_projects_filter_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
link_to
explore_projects_filter_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
link_to
explore_projects_filter_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
app/views/explore/projects/index.html.haml
View file @
83f7e98d
.clearfix
.pull-left
=
form_tag
explore_projects_path
,
method: :get
,
class:
'form-inline form-tiny'
do
|
f
|
.form-group
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"form-control search-text-input input-mn-300"
,
id:
"projects_search"
.form-group
=
button_tag
'Search'
,
class:
"btn btn-primary wide"
.pull-right
.dropdown.inline
%button
.dropdown-toggle.btn
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%span
.light
sort:
-
if
@sort
.
present?
=
sort_options_hash
[
@sort
]
-
else
=
sort_title_recently_created
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
explore_projects_path
(
sort:
sort_value_recently_created
)
do
=
sort_title_recently_created
=
link_to
explore_projects_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
link_to
explore_projects_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
link_to
explore_projects_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
=
render
'filter'
%hr
.public-projects
...
...
app/views/layouts/nav/_dashboard.html.haml
View file @
83f7e98d
...
...
@@ -41,4 +41,3 @@
%i
.fa.fa-question-circle
%span
Help
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