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
Léo-Paul Géneau
gitlab-ce
Commits
90aae02b
Commit
90aae02b
authored
Aug 03, 2018
by
Chantal Rollison
Committed by
Kamil Trzciński
Aug 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group milestones to dashboard milestone page
parent
c4be8de7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
5 deletions
+87
-5
app/controllers/dashboard/milestones_controller.rb
app/controllers/dashboard/milestones_controller.rb
+12
-1
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+8
-0
app/models/dashboard_group_milestone.rb
app/models/dashboard_group_milestone.rb
+36
-0
app/models/global_milestone.rb
app/models/global_milestone.rb
+1
-1
app/models/group_milestone.rb
app/models/group_milestone.rb
+1
-1
app/views/dashboard/milestones/_milestone.html.haml
app/views/dashboard/milestones/_milestone.html.haml
+1
-1
changelogs/unreleased/cr-add-group-milestone-to-dashboard.yml
...gelogs/unreleased/cr-add-group-milestone-to-dashboard.yml
+5
-0
changelogs/unreleased/cr-add-path-of-group-milestone.yml
changelogs/unreleased/cr-add-path-of-group-milestone.yml
+5
-0
spec/controllers/dashboard/milestones_controller_spec.rb
spec/controllers/dashboard/milestones_controller_spec.rb
+18
-1
No files found.
app/controllers/dashboard/milestones_controller.rb
View file @
90aae02b
...
...
@@ -21,8 +21,19 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
private
def
group_milestones
groups
=
GroupsFinder
.
new
(
current_user
,
all_available:
true
).
execute
DashboardGroupMilestone
.
build_collection
(
groups
)
end
# See [#39545](https://gitlab.com/gitlab-org/gitlab-ce/issues/39545) for info about the deprecation of dynamic milestones
def
dynamic_milestones
DashboardMilestone
.
build_collection
(
@projects
,
params
)
end
def
milestones
@milestones
=
DashboardMilestone
.
build_collection
(
@projects
,
params
)
@milestones
=
group_milestones
+
dynamic_milestones
end
def
milestone
...
...
app/helpers/milestones_helper.rb
View file @
90aae02b
...
...
@@ -233,4 +233,12 @@ module MilestonesHelper
group_milestone_path
(
@group
,
milestone
.
iid
,
milestone:
params
)
end
end
def
group_or_dashboard_milestone_path
(
milestone
)
if
milestone
.
group_milestone?
group_milestone_path
(
milestone
.
group
,
milestone
.
iid
,
milestone:
{
title:
milestone
.
title
})
else
dashboard_milestone_path
(
milestone
.
safe_title
,
title:
milestone
.
title
)
end
end
end
app/models/dashboard_group_milestone.rb
0 → 100644
View file @
90aae02b
# frozen_string_literal: true
# Dashboard Group Milestones are milestones that allow us to pull more info out for the UI that the Milestone object doesn't allow for
class
DashboardGroupMilestone
<
GlobalMilestone
extend
::
Gitlab
::
Utils
::
Override
attr_reader
:group_name
override
:initialize
def
initialize
(
milestone
)
super
(
milestone
.
title
,
Array
(
milestone
))
@group_name
=
milestone
.
group
.
full_name
end
def
self
.
build_collection
(
groups
)
MilestonesFinder
.
new
(
group_ids:
groups
.
pluck
(
:id
)).
execute
.
map
{
|
m
|
new
(
m
)
}
end
override
:group_milestone?
def
group_milestone?
@first_milestone
.
group_milestone?
end
override
:milestoneish_ids
def
milestoneish_ids
milestones
.
map
(
&
:id
)
end
def
group
@first_milestone
.
group
end
def
iid
@first_milestone
.
iid
end
end
app/models/global_milestone.rb
View file @
90aae02b
# frozen_string_literal: true
# Global Milestones are milestones that can be shared across multiple projects
class
GlobalMilestone
include
Milestoneish
...
...
app/models/group_milestone.rb
View file @
90aae02b
# frozen_string_literal: true
# Group Milestones are milestones that can be shared among many projects within the same group
class
GroupMilestone
<
GlobalMilestone
attr_accessor
:group
...
...
app/views/dashboard/milestones/_milestone.html.haml
View file @
90aae02b
=
render
'shared/milestones/milestone'
,
milestone_path:
dashboard_milestone_path
(
milestone
.
safe_title
,
title:
milestone
.
titl
e
),
milestone_path:
group_or_dashboard_milestone_path
(
mileston
e
),
issues_path:
issues_dashboard_path
(
milestone_title:
milestone
.
title
),
merge_requests_path:
merge_requests_dashboard_path
(
milestone_title:
milestone
.
title
),
milestone:
milestone
,
...
...
changelogs/unreleased/cr-add-group-milestone-to-dashboard.yml
0 → 100644
View file @
90aae02b
---
title
:
Adds the ability to view group milestones on the dashboard milestone page.
merge_request
:
20618
author
:
type
:
fixed
changelogs/unreleased/cr-add-path-of-group-milestone.yml
0 → 100644
View file @
90aae02b
---
title
:
Adds the project and group name to the return type for project and group milestones.
merge_request
:
20890
author
:
type
:
changed
spec/controllers/dashboard/milestones_controller_spec.rb
View file @
90aae02b
...
...
@@ -2,8 +2,10 @@ require 'spec_helper'
describe
Dashboard
::
MilestonesController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project_milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:group_milestone
)
{
create
(
:milestone
,
group:
group
)
}
let
(
:milestone
)
do
DashboardMilestone
.
build
(
[
project
],
...
...
@@ -11,13 +13,17 @@ describe Dashboard::MilestonesController do
)
end
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
milestone:
project_milestone
)
}
let
(
:group_issue
)
{
create
(
:issue
,
milestone:
group_milestone
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
,
title:
'Issue Label'
,
issues:
[
issue
])
}
let!
(
:group_label
)
{
create
(
:group_label
,
group:
group
,
title:
'Group Issue Label'
,
issues:
[
group_issue
])
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
milestone:
project_milestone
)
}
let
(
:milestone_path
)
{
dashboard_milestone_path
(
milestone
.
safe_title
,
title:
milestone
.
title
)
}
before
do
sign_in
(
user
)
project
.
add_maintainer
(
user
)
group
.
add_developer
(
user
)
end
it_behaves_like
'milestone tabs'
...
...
@@ -35,4 +41,15 @@ describe Dashboard::MilestonesController do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
describe
"#index"
do
it
'should contain group and project milestones'
do
get
:index
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
.
size
).
to
eq
(
2
)
expect
(
json_response
.
map
{
|
i
|
i
[
"first_milestone"
][
"id"
]
}).
to
include
(
group_milestone
.
id
,
project_milestone
.
id
)
expect
(
json_response
.
map
{
|
i
|
i
[
"group_name"
]
}).
to
include
(
group
.
name
)
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