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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
c674ffe0
Commit
c674ffe0
authored
Mar 09, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'improve-archived-projects'
parents
e8cd04e8
7a311c23
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
93 additions
and
69 deletions
+93
-69
CHANGELOG
CHANGELOG
+1
-0
app/assets/stylesheets/framework/dropdowns.scss
app/assets/stylesheets/framework/dropdowns.scss
+5
-4
app/controllers/concerns/filter_projects.rb
app/controllers/concerns/filter_projects.rb
+15
-0
app/controllers/dashboard/projects_controller.rb
app/controllers/dashboard/projects_controller.rb
+8
-16
app/controllers/explore/projects_controller.rb
app/controllers/explore/projects_controller.rb
+5
-6
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+4
-2
app/helpers/explore_helper.rb
app/helpers/explore_helper.rb
+2
-10
app/helpers/sorting_helper.rb
app/helpers/sorting_helper.rb
+10
-0
app/views/dashboard/_projects_head.html.haml
app/views/dashboard/_projects_head.html.haml
+1
-1
app/views/explore/projects/_dropdown.html.haml
app/views/explore/projects/_dropdown.html.haml
+0
-20
app/views/explore/projects/_filter.html.haml
app/views/explore/projects/_filter.html.haml
+5
-5
app/views/groups/_projects.html.haml
app/views/groups/_projects.html.haml
+5
-4
app/views/shared/projects/_dropdown.html.haml
app/views/shared/projects/_dropdown.html.haml
+22
-0
features/dashboard/archived_projects.feature
features/dashboard/archived_projects.feature
+5
-0
features/explore/projects.feature
features/explore/projects.feature
+1
-1
features/steps/dashboard/archived_projects.rb
features/steps/dashboard/archived_projects.rb
+4
-0
No files found.
CHANGELOG
View file @
c674ffe0
...
@@ -21,6 +21,7 @@ v 8.6.0 (unreleased)
...
@@ -21,6 +21,7 @@ v 8.6.0 (unreleased)
- Increase the notes polling timeout over time (Roberto Dip)
- Increase the notes polling timeout over time (Roberto Dip)
- Show labels in dashboard and group milestone views
- Show labels in dashboard and group milestone views
- Add main language of a project in the list of projects (Tiago Botelho)
- Add main language of a project in the list of projects (Tiago Botelho)
- Add ability to show archived projects on dashboard, explore and group pages
v 8.5.4
v 8.5.4
- Do not cache requests for badges (including builds badge)
- Do not cache requests for badges (including builds badge)
...
...
app/assets/stylesheets/framework/dropdowns.scss
View file @
c674ffe0
...
@@ -81,8 +81,9 @@
...
@@ -81,8 +81,9 @@
&
:
:
before
{
&
:
:
before
{
content
:
"\f00c"
;
content
:
"\f00c"
;
position
:
absolute
;
position
:
absolute
;
left
:
4px
;
left
:
5px
;
top
:
8px
;
top
:
50%
;
margin-top
:
-7px
;
font
:
normal
normal
normal
14px
/
1
FontAwesome
;
font
:
normal
normal
normal
14px
/
1
FontAwesome
;
font-size
:
inherit
;
font-size
:
inherit
;
text-rendering
:
auto
;
text-rendering
:
auto
;
...
@@ -94,8 +95,8 @@
...
@@ -94,8 +95,8 @@
}
}
.dropdown-header
{
.dropdown-header
{
padding-left
:
10
px
;
padding-left
:
5
px
;
padding-right
:
10
px
;
padding-right
:
5
px
;
color
:
$dropdown-header-color
;
color
:
$dropdown-header-color
;
font-size
:
13px
;
font-size
:
13px
;
line-height
:
22px
;
line-height
:
22px
;
...
...
app/controllers/concerns/filter_projects.rb
0 → 100644
View file @
c674ffe0
# == FilterProjects
#
# Controller concern to handle projects filtering
# * by name
# * by archived state
#
module
FilterProjects
extend
ActiveSupport
::
Concern
def
filter_projects
(
projects
)
projects
=
projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
projects
=
projects
.
non_archived
if
params
[
:archived
].
blank?
projects
end
end
app/controllers/dashboard/projects_controller.rb
View file @
c674ffe0
class
Dashboard::ProjectsController
<
Dashboard
::
ApplicationController
class
Dashboard::ProjectsController
<
Dashboard
::
ApplicationController
include
FilterProjects
before_action
:event_filter
before_action
:event_filter
def
index
def
index
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
]
)
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
includes
(
:namespace
)
@projects
=
@projects
.
includes
(
:namespace
)
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
terms
=
params
[
:filter_projects
]
if
terms
.
present?
@projects
=
@projects
.
search
(
terms
)
end
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
terms
.
blank?
@last_push
=
current_user
.
recent_push
@last_push
=
current_user
.
recent_push
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -32,16 +29,11 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
...
@@ -32,16 +29,11 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
def
starred
def
starred
@projects
=
current_user
.
starred_projects
.
sorted_by_activity
@projects
=
current_user
.
starred_projects
.
sorted_by_activity
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
includes
(
:namespace
,
:forked_from_project
,
:tags
)
@projects
=
@projects
.
includes
(
:namespace
,
:forked_from_project
,
:tags
)
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
terms
=
params
[
:filter_projects
]
if
terms
.
present?
@projects
=
@projects
.
search
(
terms
)
end
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
terms
.
blank?
@last_push
=
current_user
.
recent_push
@last_push
=
current_user
.
recent_push
@groups
=
[]
@groups
=
[]
...
...
app/controllers/explore/projects_controller.rb
View file @
c674ffe0
class
Explore::ProjectsController
<
Explore
::
ApplicationController
class
Explore::ProjectsController
<
Explore
::
ApplicationController
include
FilterProjects
def
index
def
index
@projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
@tags
=
@projects
.
tags_on
(
:tags
)
@tags
=
@projects
.
tags_on
(
:tags
)
@projects
=
@projects
.
tagged_with
(
params
[
:tag
])
if
params
[
:tag
].
present?
@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
.
where
(
visibility_level:
params
[
:visibility_level
])
if
params
[
:visibility_level
].
present?
@projects
=
@projects
.
non_archived
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
includes
(
:namespace
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
@projects
=
@projects
.
includes
(
:namespace
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
...
@@ -22,8 +22,7 @@ class Explore::ProjectsController < Explore::ApplicationController
...
@@ -22,8 +22,7 @@ class Explore::ProjectsController < Explore::ApplicationController
def
trending
def
trending
@projects
=
TrendingProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
TrendingProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
@projects
.
non_archived
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -38,7 +37,7 @@ class Explore::ProjectsController < Explore::ApplicationController
...
@@ -38,7 +37,7 @@ class Explore::ProjectsController < Explore::ApplicationController
def
starred
def
starred
@projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
reorder
(
'star_count DESC'
)
@projects
=
@projects
.
reorder
(
'star_count DESC'
)
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
...
...
app/controllers/groups_controller.rb
View file @
c674ffe0
class
GroupsController
<
Groups
::
ApplicationController
class
GroupsController
<
Groups
::
ApplicationController
include
FilterProjects
include
IssuesAction
include
IssuesAction
include
MergeRequestsAction
include
MergeRequestsAction
...
@@ -41,7 +42,8 @@ class GroupsController < Groups::ApplicationController
...
@@ -41,7 +42,8 @@ class GroupsController < Groups::ApplicationController
def
show
def
show
@last_push
=
current_user
.
recent_push
if
current_user
@last_push
=
current_user
.
recent_push
if
current_user
@projects
=
@projects
.
includes
(
:namespace
)
@projects
=
@projects
.
includes
(
:namespace
)
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -98,7 +100,7 @@ class GroupsController < Groups::ApplicationController
...
@@ -98,7 +100,7 @@ class GroupsController < Groups::ApplicationController
end
end
def
load_projects
def
load_projects
@projects
||=
ProjectsFinder
.
new
.
execute
(
current_user
,
group:
group
).
sorted_by_activity
.
non_archived
@projects
||=
ProjectsFinder
.
new
.
execute
(
current_user
,
group:
group
).
sorted_by_activity
end
end
# Dont allow unauthorized access to group
# Dont allow unauthorized access to group
...
...
app/helpers/explore_helper.rb
View file @
c674ffe0
module
ExploreHelper
module
ExploreHelper
def
explore_projects_filter
_path
(
options
=
{})
def
filter_projects
_path
(
options
=
{})
exist_opts
=
{
exist_opts
=
{
sort:
params
[
:sort
],
sort:
params
[
:sort
],
scope:
params
[
:scope
],
scope:
params
[
:scope
],
...
@@ -9,15 +9,7 @@ module ExploreHelper
...
@@ -9,15 +9,7 @@ module ExploreHelper
}
}
options
=
exist_opts
.
merge
(
options
)
options
=
exist_opts
.
merge
(
options
)
path
=
request
.
path
path
=
if
explore_controller?
explore_projects_path
elsif
current_action?
(
:starred
)
starred_dashboard_projects_path
else
dashboard_projects_path
end
path
<<
"?
#{
options
.
to_param
}
"
path
<<
"?
#{
options
.
to_param
}
"
path
path
end
end
...
...
app/helpers/sorting_helper.rb
View file @
c674ffe0
...
@@ -16,6 +16,16 @@ module SortingHelper
...
@@ -16,6 +16,16 @@ module SortingHelper
}
}
end
end
def
projects_sort_options_hash
{
sort_value_name
=>
sort_title_name
,
sort_value_recently_updated
=>
sort_title_recently_updated
,
sort_value_oldest_updated
=>
sort_title_oldest_updated
,
sort_value_recently_created
=>
sort_title_recently_created
,
sort_value_oldest_created
=>
sort_title_oldest_created
,
}
end
def
sort_title_oldest_updated
def
sort_title_oldest_updated
'Oldest updated'
'Oldest updated'
end
end
...
...
app/views/dashboard/_projects_head.html.haml
View file @
c674ffe0
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
.nav-controls
.nav-controls
=
form_tag
request
.
original_url
,
method: :get
,
class:
'project-filter-form'
,
id:
'project-filter-form'
do
|
f
|
=
form_tag
request
.
original_url
,
method: :get
,
class:
'project-filter-form'
,
id:
'project-filter-form'
do
|
f
|
=
search_field_tag
:filter_projects
,
params
[
:filter_projects
],
placeholder:
'Filter by name...'
,
class:
'project-filter-form-field form-control input-short projects-list-filter'
,
spellcheck:
false
,
id:
'project-filter-form-field'
,
tabindex:
"2"
=
search_field_tag
:filter_projects
,
params
[
:filter_projects
],
placeholder:
'Filter by name...'
,
class:
'project-filter-form-field form-control input-short projects-list-filter'
,
spellcheck:
false
,
id:
'project-filter-form-field'
,
tabindex:
"2"
=
render
'
explore
/projects/dropdown'
=
render
'
shared
/projects/dropdown'
-
if
current_user
.
can_create_project?
-
if
current_user
.
can_create_project?
=
link_to
new_project_path
,
class:
'btn btn-new'
do
=
link_to
new_project_path
,
class:
'btn btn-new'
do
=
icon
(
'plus'
)
=
icon
(
'plus'
)
...
...
app/views/explore/projects/_dropdown.html.haml
deleted
100644 → 0
View file @
e8cd04e8
.dropdown.inline
%button
.dropdown-toggle.btn
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%span
.light
-
if
@sort
.
present?
=
sort_options_hash
[
@sort
]
-
else
=
sort_title_recently_updated
%b
.caret
%ul
.dropdown-menu.dropdown-menu-align-right
%li
=
link_to
explore_projects_filter_path
(
sort:
sort_value_name
)
do
=
sort_title_name
=
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/_filter.html.haml
View file @
c674ffe0
...
@@ -10,11 +10,11 @@
...
@@ -10,11 +10,11 @@
%b
.caret
%b
.caret
%ul
.dropdown-menu
%ul
.dropdown-menu
%li
%li
=
link_to
explore_projects_filter
_path
(
visibility_level:
nil
)
do
=
link_to
filter_projects
_path
(
visibility_level:
nil
)
do
Any
Any
-
Gitlab
::
VisibilityLevel
.
values
.
each
do
|
level
|
-
Gitlab
::
VisibilityLevel
.
values
.
each
do
|
level
|
%li
{
class:
(
level
.
to_s
==
params
[
:visibility_level
])
?
'active'
:
'light'
}
%li
{
class:
(
level
.
to_s
==
params
[
:visibility_level
])
?
'active'
:
'light'
}
=
link_to
explore_projects_filter
_path
(
visibility_level:
level
)
do
=
link_to
filter_projects
_path
(
visibility_level:
level
)
do
=
visibility_level_icon
(
level
)
=
visibility_level_icon
(
level
)
=
visibility_level_label
(
level
)
=
visibility_level_label
(
level
)
...
@@ -30,11 +30,11 @@
...
@@ -30,11 +30,11 @@
%b
.caret
%b
.caret
%ul
.dropdown-menu
%ul
.dropdown-menu
%li
%li
=
link_to
explore_projects_filter
_path
(
tag:
nil
)
do
=
link_to
filter_projects
_path
(
tag:
nil
)
do
Any
Any
-
@tags
.
each
do
|
tag
|
-
@tags
.
each
do
|
tag
|
%li
{
class:
(
tag
.
name
==
params
[
:tag
])
?
'active'
:
'light'
}
%li
{
class:
(
tag
.
name
==
params
[
:tag
])
?
'active'
:
'light'
}
=
link_to
explore_projects_filter
_path
(
tag:
tag
.
name
)
do
=
link_to
filter_projects
_path
(
tag:
tag
.
name
)
do
%i
.fa.fa-tag
=
icon
(
'tag'
)
=
tag
.
name
=
tag
.
name
app/views/groups/_projects.html.haml
View file @
c674ffe0
...
@@ -3,9 +3,10 @@
...
@@ -3,9 +3,10 @@
=
form_tag
request
.
original_url
,
method: :get
,
class:
'project-filter-form'
,
id:
'project-filter-form'
do
|
f
|
=
form_tag
request
.
original_url
,
method: :get
,
class:
'project-filter-form'
,
id:
'project-filter-form'
do
|
f
|
-
if
@projects
.
present?
-
if
@projects
.
present?
=
search_field_tag
:filter_projects
,
nil
,
placeholder:
'Filter by name'
,
class:
'projects-list-filter form-control'
,
spellcheck:
false
=
search_field_tag
:filter_projects
,
nil
,
placeholder:
'Filter by name'
,
class:
'projects-list-filter form-control'
,
spellcheck:
false
-
if
can?
current_user
,
:create_projects
,
@group
=
render
'shared/projects/dropdown'
=
link_to
new_project_path
(
namespace_id:
@group
.
id
),
class:
'btn btn-new pull-right'
do
-
if
can?
current_user
,
:create_projects
,
@group
=
icon
(
'plus'
)
=
link_to
new_project_path
(
namespace_id:
@group
.
id
),
class:
'btn btn-new pull-right'
do
New Project
=
icon
(
'plus'
)
New Project
=
render
'shared/projects/list'
,
projects:
@projects
,
stars:
false
,
skip_namespace:
true
=
render
'shared/projects/list'
,
projects:
@projects
,
stars:
false
,
skip_namespace:
true
app/views/shared/projects/_dropdown.html.haml
0 → 100644
View file @
c674ffe0
-
@sort
||=
sort_value_recently_updated
-
archived
=
params
[
:archived
]
.dropdown.inline
%button
.dropdown-toggle.btn
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%span
.light
=
projects_sort_options_hash
[
@sort
]
%b
.caret
%ul
.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable
%li
.dropdown-header
Sort by
-
projects_sort_options_hash
.
each
do
|
value
,
title
|
%li
=
link_to
filter_projects_path
(
sort:
value
,
archived:
archived
),
class:
(
"is-active"
if
@sort
==
value
)
do
=
title
%li
.divider
%li
=
link_to
filter_projects_path
(
sort:
@sort
,
archived:
nil
),
class:
(
"is-active"
unless
params
[
:archived
].
present?
)
do
Hide archived projects
%li
=
link_to
filter_projects_path
(
sort:
@sort
,
archived:
true
),
class:
(
"is-active"
if
params
[
:archived
].
present?
)
do
Show archived projects
features/dashboard/archived_projects.feature
View file @
c674ffe0
...
@@ -10,3 +10,8 @@ Feature: Dashboard Archived Projects
...
@@ -10,3 +10,8 @@ Feature: Dashboard Archived Projects
Scenario
:
I
should see non-archived projects on dashboard
Scenario
:
I
should see non-archived projects on dashboard
Then
I should see
"Shop"
project link
Then
I should see
"Shop"
project link
And
I should not see
"Forum"
project link
And
I should not see
"Forum"
project link
Scenario
:
I
toggle show of archived projects on dashboard
When
I click
"Show archived projects"
link
Then
I should see
"Shop"
project link
And
I should see
"Forum"
project link
features/explore/projects.feature
View file @
c674ffe0
...
@@ -140,4 +140,4 @@ Feature: Explore Projects
...
@@ -140,4 +140,4 @@ Feature: Explore Projects
When
I visit the explore starred projects
When
I visit the explore starred projects
Then
I should see project
"Community"
Then
I should see project
"Community"
And
I should see project
"Internal"
And
I should see project
"Internal"
And
I should see project
"Archive"
And
I should
not
see project
"Archive"
features/steps/dashboard/archived_projects.rb
View file @
c674ffe0
...
@@ -19,4 +19,8 @@ class Spinach::Features::DashboardArchivedProjects < Spinach::FeatureSteps
...
@@ -19,4 +19,8 @@ class Spinach::Features::DashboardArchivedProjects < Spinach::FeatureSteps
step
'I should see "Forum" project link'
do
step
'I should see "Forum" project link'
do
expect
(
page
).
to
have_link
"Forum"
expect
(
page
).
to
have_link
"Forum"
end
end
step
'I click "Show archived projects" link'
do
click_link
"Show archived projects"
end
end
end
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