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
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
Show 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)
- Increase the notes polling timeout over time (Roberto Dip)
- Show labels in dashboard and group milestone views
- 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
- Do not cache requests for badges (including builds badge)
...
...
app/assets/stylesheets/framework/dropdowns.scss
View file @
c674ffe0
...
...
@@ -81,8 +81,9 @@
&
:
:
before
{
content
:
"\f00c"
;
position
:
absolute
;
left
:
4px
;
top
:
8px
;
left
:
5px
;
top
:
50%
;
margin-top
:
-7px
;
font
:
normal
normal
normal
14px
/
1
FontAwesome
;
font-size
:
inherit
;
text-rendering
:
auto
;
...
...
@@ -94,8 +95,8 @@
}
.dropdown-header
{
padding-left
:
10
px
;
padding-right
:
10
px
;
padding-left
:
5
px
;
padding-right
:
5
px
;
color
:
$dropdown-header-color
;
font-size
:
13px
;
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
include
FilterProjects
before_action
:event_filter
def
index
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
]
)
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
@projects
=
filter_projects
(
@projects
)
@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
respond_to
do
|
format
|
...
...
@@ -32,16 +29,11 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
def
starred
@projects
=
current_user
.
starred_projects
.
sorted_by_activity
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
includes
(
:namespace
,
:forked_from_project
,
:tags
)
@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
@groups
=
[]
...
...
app/controllers/explore/projects_controller.rb
View file @
c674ffe0
class
Explore::ProjectsController
<
Explore
::
ApplicationController
include
FilterProjects
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
.
non_archived
@projects
=
@projects
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
includes
(
:namespace
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
...
...
@@ -22,8 +22,7 @@ class Explore::ProjectsController < Explore::ApplicationController
def
trending
@projects
=
TrendingProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
@projects
.
non_archived
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
filter_projects
(
@projects
)
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
respond_to
do
|
format
|
...
...
@@ -38,7 +37,7 @@ class Explore::ProjectsController < Explore::ApplicationController
def
starred
@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
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:filter_projects
].
blank?
...
...
app/controllers/groups_controller.rb
View file @
c674ffe0
class
GroupsController
<
Groups
::
ApplicationController
include
FilterProjects
include
IssuesAction
include
MergeRequestsAction
...
...
@@ -41,7 +42,8 @@ class GroupsController < Groups::ApplicationController
def
show
@last_push
=
current_user
.
recent_push
if
current_user
@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?
respond_to
do
|
format
|
...
...
@@ -98,7 +100,7 @@ class GroupsController < Groups::ApplicationController
end
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
# Dont allow unauthorized access to group
...
...
app/helpers/explore_helper.rb
View file @
c674ffe0
module
ExploreHelper
def
explore_projects_filter
_path
(
options
=
{})
def
filter_projects
_path
(
options
=
{})
exist_opts
=
{
sort:
params
[
:sort
],
scope:
params
[
:scope
],
...
...
@@ -9,15 +9,7 @@ module ExploreHelper
}
options
=
exist_opts
.
merge
(
options
)
path
=
if
explore_controller?
explore_projects_path
elsif
current_action?
(
:starred
)
starred_dashboard_projects_path
else
dashboard_projects_path
end
path
=
request
.
path
path
<<
"?
#{
options
.
to_param
}
"
path
end
...
...
app/helpers/sorting_helper.rb
View file @
c674ffe0
...
...
@@ -16,6 +16,16 @@ module SortingHelper
}
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
'Oldest updated'
end
...
...
app/views/dashboard/_projects_head.html.haml
View file @
c674ffe0
...
...
@@ -15,7 +15,7 @@
.nav-controls
=
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"
=
render
'
explore
/projects/dropdown'
=
render
'
shared
/projects/dropdown'
-
if
current_user
.
can_create_project?
=
link_to
new_project_path
,
class:
'btn btn-new'
do
=
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 @@
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
explore_projects_filter
_path
(
visibility_level:
nil
)
do
=
link_to
filter_projects
_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
=
link_to
filter_projects
_path
(
visibility_level:
level
)
do
=
visibility_level_icon
(
level
)
=
visibility_level_label
(
level
)
...
...
@@ -30,11 +30,11 @@
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
explore_projects_filter
_path
(
tag:
nil
)
do
=
link_to
filter_projects
_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
=
link_to
filter_projects
_path
(
tag:
tag
.
name
)
do
=
icon
(
'tag'
)
=
tag
.
name
app/views/groups/_projects.html.haml
View file @
c674ffe0
...
...
@@ -3,6 +3,7 @@
=
form_tag
request
.
original_url
,
method: :get
,
class:
'project-filter-form'
,
id:
'project-filter-form'
do
|
f
|
-
if
@projects
.
present?
=
search_field_tag
:filter_projects
,
nil
,
placeholder:
'Filter by name'
,
class:
'projects-list-filter form-control'
,
spellcheck:
false
=
render
'shared/projects/dropdown'
-
if
can?
current_user
,
:create_projects
,
@group
=
link_to
new_project_path
(
namespace_id:
@group
.
id
),
class:
'btn btn-new pull-right'
do
=
icon
(
'plus'
)
...
...
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
Scenario
:
I
should see non-archived projects on dashboard
Then
I should see
"Shop"
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
When
I visit the explore starred projects
Then
I should see project
"Community"
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
step
'I should see "Forum" project link'
do
expect
(
page
).
to
have_link
"Forum"
end
step
'I click "Show archived projects" link'
do
click_link
"Show archived projects"
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