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
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
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
94 deletions
+38
-94
dashboard_controller.rb
app/controllers/dashboard_controller.rb
+0
-1
projects_controller.rb
app/controllers/explore/projects_controller.rb
+3
-0
dashboard_helper.rb
app/helpers/dashboard_helper.rb
+0
-16
explore_helper.rb
app/helpers/explore_helper.rb
+17
-0
_filter.html.haml
app/views/explore/projects/_filter.html.haml
+17
-50
index.html.haml
app/views/explore/projects/index.html.haml
+1
-26
_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
→
app/views/
explore/projects/
_filter.html.haml
View file @
83f7e98d
.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
.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
...
...
@@ -25,37 +18,14 @@
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
projects_dashboard
_filter_path
(
visibility_level:
nil
)
do
=
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
projects_dashboard
_filter_path
(
visibility_level:
level
)
do
=
link_to
explore_projects
_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"
}
...
...
@@ -68,18 +38,17 @@
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
projects_dashboard
_filter_path
(
tag:
nil
)
do
=
link_to
explore_projects
_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
=
link_to
explore_projects
_filter_path
(
tag:
tag
.
name
)
do
%i
.fa.fa-tag
=
tag
.
name
.pull-right
.dropdown.inline
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%button
.dropdown-toggle.btn
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%span
.light
sort:
-
if
@sort
.
present?
=
sort_options_hash
[
@sort
]
...
...
@@ -88,13 +57,11 @@
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
projects_dashboard
_filter_path
(
sort:
sort_value_recently_created
)
do
=
link_to
explore_projects
_filter_path
(
sort:
sort_value_recently_created
)
do
=
sort_title_recently_created
=
link_to
projects_dashboard
_filter_path
(
sort:
sort_value_oldest_created
)
do
=
link_to
explore_projects
_filter_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
link_to
projects_dashboard
_filter_path
(
sort:
sort_value_recently_updated
)
do
=
link_to
explore_projects
_filter_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
link_to
projects_dashboard
_filter_path
(
sort:
sort_value_oldest_updated
)
do
=
link_to
explore_projects
_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/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