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
f0af302c
Commit
f0af302c
authored
Jun 26, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close and reopen group milestones.
parent
4ca8a175
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
11 deletions
+38
-11
app/controllers/groups/milestones_controller.rb
app/controllers/groups/milestones_controller.rb
+26
-3
app/models/group_milestone.rb
app/models/group_milestone.rb
+4
-3
app/views/groups/milestones/index.html.haml
app/views/groups/milestones/index.html.haml
+8
-5
No files found.
app/controllers/groups/milestones_controller.rb
View file @
f0af302c
...
...
@@ -2,9 +2,8 @@ class Groups::MilestonesController < ApplicationController
layout
'group'
def
index
@group
=
Group
.
find_by
(
path:
params
[
:group_id
])
project_ids
=
@group
.
projects
project_milestones
=
Milestone
.
where
(
project_id:
project_ids
)
@group
=
group
project_milestones
=
Milestone
.
where
(
project_id:
@group
.
projects
)
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
@group_milestones
=
case
params
[
:status
]
when
'all'
;
@group_milestones
...
...
@@ -13,8 +12,32 @@ class Groups::MilestonesController < ApplicationController
end
end
def
update
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
)
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
title
=
params
[
:id
].
gsub
(
"-"
,
"."
)
@group_milestones
.
each
do
|
group_milestone
|
next
unless
group_milestone
.
title
==
title
group_milestone
.
milestones
.
each
do
|
milestone
|
Milestones
::
UpdateService
.
new
(
milestone
.
project
,
current_user
,
params
[
:milestone
]).
execute
(
milestone
)
end
end
respond_to
do
|
format
|
format
.
js
format
.
html
do
redirect_to
group_milestones_path
(
group
)
end
end
end
private
def
group
@group
||=
Group
.
find_by
(
path:
params
[
:group_id
])
end
def
status
(
state
)
@group_milestones
.
map
{
|
milestone
|
next
if
milestone
.
state
!=
state
;
milestone
}.
compact
end
...
...
app/models/group_milestone.rb
View file @
f0af302c
...
...
@@ -13,8 +13,8 @@ class GroupMilestone
@milestones
end
def
project
_name
s
milestones
.
map
{
|
milestone
|
milestone
.
project
.
name
}
def
projects
milestones
.
map
{
|
milestone
|
milestone
.
project
}
end
def
issue_count
...
...
@@ -41,7 +41,8 @@ class GroupMilestone
def
state
state
=
milestones
.
map
{
|
milestone
|
milestone
.
state
}
if
state
.
all?
{
|
milestone_state
|
milestone_state
==
'active'
}
if
state
.
count
(
"active"
)
==
state
.
size
'active'
else
'closed'
...
...
app/views/groups/milestones/index.html.haml
View file @
f0af302c
...
...
@@ -23,9 +23,12 @@
-
else
-
@group_milestones
.
each
do
|
milestone
|
%li
{
class:
"milestone milestone-#{milestone.state == 'closed' ? 'closed' : 'open'}"
,
id:
dom_id
(
milestone
.
milestones
.
first
)
}
-
unless
milestone
.
state
==
'closed'
.pull-right
=
link_to
'Close Milestone'
,
root_path
,
method: :put
,
remote:
true
,
class:
"btn btn-small btn-remove"
-
safe_title
=
milestone
.
title
.
gsub
(
"."
,
"-"
)
-
if
milestone
.
state
==
'closed'
=
link_to
'Reopen Milestone'
,
group_milestone_path
(
@group
,
safe_title
,
milestone:
{
state_event: :activate
}),
method: :put
,
class:
"btn btn-small btn-grouped"
-
else
=
link_to
'Close Milestone'
,
group_milestone_path
(
@group
,
safe_title
,
milestone:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-small btn-remove"
%h4
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
root_path
%div
...
...
@@ -41,6 +44,6 @@
.progress-bar
{
style:
"width: #{milestone.percent_complete}%;"
}
%div
%br
-
milestone
.
project
_names
.
each
do
|
name
|
-
milestone
.
project
s
.
each
do
|
project
|
%span
.label.label-default
=
name
=
project
.
name
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