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
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
...
@@ -2,9 +2,8 @@ class Groups::MilestonesController < ApplicationController
layout
'group'
layout
'group'
def
index
def
index
@group
=
Group
.
find_by
(
path:
params
[
:group_id
])
@group
=
group
project_ids
=
@group
.
projects
project_milestones
=
Milestone
.
where
(
project_id:
@group
.
projects
)
project_milestones
=
Milestone
.
where
(
project_id:
project_ids
)
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
@group_milestones
=
case
params
[
:status
]
@group_milestones
=
case
params
[
:status
]
when
'all'
;
@group_milestones
when
'all'
;
@group_milestones
...
@@ -13,8 +12,32 @@ class Groups::MilestonesController < ApplicationController
...
@@ -13,8 +12,32 @@ class Groups::MilestonesController < ApplicationController
end
end
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
private
def
group
@group
||=
Group
.
find_by
(
path:
params
[
:group_id
])
end
def
status
(
state
)
def
status
(
state
)
@group_milestones
.
map
{
|
milestone
|
next
if
milestone
.
state
!=
state
;
milestone
}.
compact
@group_milestones
.
map
{
|
milestone
|
next
if
milestone
.
state
!=
state
;
milestone
}.
compact
end
end
...
...
app/models/group_milestone.rb
View file @
f0af302c
...
@@ -13,8 +13,8 @@ class GroupMilestone
...
@@ -13,8 +13,8 @@ class GroupMilestone
@milestones
@milestones
end
end
def
project
_name
s
def
projects
milestones
.
map
{
|
milestone
|
milestone
.
project
.
name
}
milestones
.
map
{
|
milestone
|
milestone
.
project
}
end
end
def
issue_count
def
issue_count
...
@@ -41,7 +41,8 @@ class GroupMilestone
...
@@ -41,7 +41,8 @@ class GroupMilestone
def
state
def
state
state
=
milestones
.
map
{
|
milestone
|
milestone
.
state
}
state
=
milestones
.
map
{
|
milestone
|
milestone
.
state
}
if
state
.
all?
{
|
milestone_state
|
milestone_state
==
'active'
}
if
state
.
count
(
"active"
)
==
state
.
size
'active'
'active'
else
else
'closed'
'closed'
...
...
app/views/groups/milestones/index.html.haml
View file @
f0af302c
...
@@ -23,9 +23,12 @@
...
@@ -23,9 +23,12 @@
-
else
-
else
-
@group_milestones
.
each
do
|
milestone
|
-
@group_milestones
.
each
do
|
milestone
|
%li
{
class:
"milestone milestone-#{milestone.state == 'closed' ? 'closed' : 'open'}"
,
id:
dom_id
(
milestone
.
milestones
.
first
)
}
%li
{
class:
"milestone milestone-#{milestone.state == 'closed' ? 'closed' : 'open'}"
,
id:
dom_id
(
milestone
.
milestones
.
first
)
}
-
unless
milestone
.
state
==
'closed'
.pull-right
.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
%h4
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
root_path
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
root_path
%div
%div
...
@@ -41,6 +44,6 @@
...
@@ -41,6 +44,6 @@
.progress-bar
{
style:
"width: #{milestone.percent_complete}%;"
}
.progress-bar
{
style:
"width: #{milestone.percent_complete}%;"
}
%div
%div
%br
%br
-
milestone
.
project
_names
.
each
do
|
name
|
-
milestone
.
project
s
.
each
do
|
project
|
%span
.label.label-default
%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