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
05335a3c
Commit
05335a3c
authored
Nov 13, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create milestones in the group
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
1328e4b5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
121 additions
and
10 deletions
+121
-10
app/controllers/groups/milestones_controller.rb
app/controllers/groups/milestones_controller.rb
+31
-5
app/views/groups/milestones/index.html.haml
app/views/groups/milestones/index.html.haml
+9
-3
app/views/groups/milestones/new.html.haml
app/views/groups/milestones/new.html.haml
+46
-0
config/routes.rb
config/routes.rb
+1
-1
features/groups.feature
features/groups.feature
+8
-1
features/steps/groups.rb
features/steps/groups.rb
+22
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+4
-0
No files found.
app/controllers/groups/milestones_controller.rb
View file @
05335a3c
class
Groups::MilestonesController
<
Groups
::
ApplicationController
before_action
:authorize_group_milestone!
,
only: :update
before_action
:group
def
index
project_milestones
=
case
params
[
:state
]
when
'all'
;
state
when
'closed'
;
state
(
'closed'
)
else
state
(
'active'
)
end
project_milestones
=
case
params
[
:state
]
when
'all'
;
state
when
'closed'
;
state
(
'closed'
)
else
state
(
'active'
)
end
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
@group_milestones
=
Kaminari
.
paginate_array
(
@group_milestones
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
end
def
new
@group_milestone
=
OpenStruct
.
new
(
title:
nil
,
description:
nil
)
end
def
create
project_ids
=
params
[
:milestone
][
:project_ids
]
title
=
milestone_params
[
:title
]
@group
.
projects
.
where
(
id:
project_ids
).
each
do
|
project
|
Milestones
::
CreateService
.
new
(
project
,
current_user
,
milestone_params
).
execute
end
redirect_to
group_milestone_path
(
@group
,
title
.
parameterize
,
title:
title
)
end
def
show
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
).
order
(
"due_date ASC"
)
@group_milestone
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
...
...
@@ -51,4 +69,12 @@ class Groups::MilestonesController < Groups::ApplicationController
def
authorize_group_milestone!
return
render_404
unless
can?
(
current_user
,
:admin_group
,
group
)
end
def
milestone_params
params
.
require
(
:milestone
).
permit
(
:title
,
:description
,
:due_date
)
end
end
app/views/groups/milestones/index.html.haml
View file @
05335a3c
...
...
@@ -3,9 +3,15 @@
=
render
'shared/milestones_filter'
.gray-content-block
Only milestones from
%strong
#{
@group
.
name
}
group are listed here.
.pull-right
%span
.pull-right.hidden-xs
=
link_to
new_group_milestone_path
(
@group
),
class:
"btn btn-new"
do
New Milestone
.oneline
Only milestones from
%strong
#{
@group
.
name
}
group are listed here.
.milestones
%ul
.content-list
-
if
@group_milestones
.
blank?
...
...
app/views/groups/milestones/new.html.haml
0 → 100644
View file @
05335a3c
%h3
.page-title
New Milestone
%p
.light
This will create milestone in every selected project
%hr
=
form_for
@group_milestone
,
as: :milestone
,
url:
group_milestones_path
(
@group
),
html:
{
class:
'form-horizontal milestone-form gfm-form js-requires-input'
}
do
|
f
|
.row
.col-md-6
.form-group
=
f
.
label
:title
,
"Title"
,
class:
"control-label"
.col-sm-10
=
f
.
text_field
:title
,
maxlength:
255
,
class:
"form-control js-quick-submit"
,
required:
true
%p
.hint
Required
.form-group.milestone-description
=
f
.
label
:description
,
"Description"
,
class:
"control-label"
.col-sm-10
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
"md-preview"
}
do
=
render
'projects/zen'
,
f:
f
,
attr: :description
,
classes:
'description form-control js-quick-submit'
=
render
'projects/notes/hints'
.clearfix
.error-alert
.form-group
=
f
.
label
:projects
,
"Projects"
,
class:
"control-label"
.col-sm-10
=
f
.
collection_select
:project_ids
,
@group
.
projects
,
:id
,
:name
,
{
selected:
@group
.
projects
.
map
(
&
:id
)
},
multiple:
true
,
class:
'select2'
.col-md-6
.form-group
=
f
.
label
:due_date
,
"Due Date"
,
class:
"control-label"
.col-sm-10
=
f
.
hidden_field
:due_date
.col-sm-10
.datepicker
.form-actions
=
f
.
submit
'Create Milestone'
,
class:
"btn-create btn"
=
link_to
"Cancel"
,
group_milestones_path
(
@group
),
class:
"btn btn-cancel"
:javascript
$
(
"
.datepicker
"
).
datepicker
({
dateFormat
:
"
yy-mm-dd
"
,
onSelect
:
function
(
dateText
,
inst
)
{
$
(
"
#milestone_due_date
"
).
val
(
dateText
)
}
}).
datepicker
(
"
setDate
"
,
$
.
datepicker
.
parseDate
(
'
yy-mm-dd
'
,
$
(
'
#milestone_due_date
'
).
val
()));
config/routes.rb
View file @
05335a3c
...
...
@@ -368,7 +368,7 @@ Gitlab::Application.routes.draw do
end
resource
:avatar
,
only:
[
:destroy
]
resources
:milestones
,
only:
[
:index
,
:show
,
:update
]
resources
:milestones
,
only:
[
:index
,
:show
,
:update
,
:new
,
:create
]
end
end
...
...
features/groups.feature
View file @
05335a3c
...
...
@@ -153,6 +153,13 @@ Feature: Groups
Then
I should see group milestone with descriptions and expiry date
And
I should see group milestone with all issues and MRs assigned to that milestone
Scenario
:
Create multiple milestones with one form
Given
I visit group
"Owned"
milestones page
And
I click new milestone button
And
I fill milestone name
When
I press create mileston button
Then
milestone in each project should be created
# Group projects in settings
Scenario
:
I
should see all projects in the project list in settings
Given
Group
"Owned"
has archived project
...
...
@@ -169,4 +176,4 @@ Feature: Groups
When
I visit group
"Owned"
page
Then
I should see group
"Owned"
Then
I should see project
"Public-project"
features/steps/groups.rb
View file @
05335a3c
...
...
@@ -255,6 +255,28 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
expect
(
page
).
to
have_xpath
(
"//span[@class='label label-warning']"
,
text:
'archived'
)
end
step
'I fill milestone name'
do
fill_in
'milestone_title'
,
with:
'v2.9.0'
end
step
'I click new milestone button'
do
click_link
"New Milestone"
end
step
'I press create mileston button'
do
click_button
"Create Milestone"
end
step
'milestone in each project should be created'
do
group
=
Group
.
find_by
(
name:
'Owned'
)
expect
(
page
).
to
have_content
"Milestone v2.9.0"
expect
(
group
.
projects
).
to
be_present
group
.
projects
.
each
do
|
project
|
expect
(
page
).
to
have_content
project
.
name
end
end
protected
def
assigned_to_me
(
key
)
...
...
features/steps/shared/paths.rb
View file @
05335a3c
...
...
@@ -31,6 +31,10 @@ module SharedPaths
visit
merge_requests_group_path
(
Group
.
find_by
(
name:
"Owned"
))
end
step
'I visit group "Owned" milestones page'
do
visit
group_milestones_path
(
Group
.
find_by
(
name:
"Owned"
))
end
step
'I visit group "Owned" members page'
do
visit
group_group_members_path
(
Group
.
find_by
(
name:
"Owned"
))
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