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
Kazuhiko Shiozaki
gitlab-ce
Commits
b6425f33
Commit
b6425f33
authored
Jun 26, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get one group milestone based on milestone title.
parent
f0af302c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
+22
-10
app/controllers/groups/milestones_controller.rb
app/controllers/groups/milestones_controller.rb
+13
-9
app/services/milestones/group_service.rb
app/services/milestones/group_service.rb
+8
-0
app/views/groups/milestones/index.html.haml
app/views/groups/milestones/index.html.haml
+1
-1
No files found.
app/controllers/groups/milestones_controller.rb
View file @
b6425f33
...
...
@@ -2,8 +2,7 @@ class Groups::MilestonesController < ApplicationController
layout
'group'
def
index
@group
=
group
project_milestones
=
Milestone
.
where
(
project_id:
@group
.
projects
)
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
...
...
@@ -12,16 +11,17 @@ class Groups::MilestonesController < ApplicationController
end
end
def
show
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
)
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
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
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
@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
@group_milestones
.
each
do
|
milestone
|
Milestones
::
UpdateService
.
new
(
milestone
.
project
,
current_user
,
params
[
:milestone
]).
execute
(
milestone
)
end
respond_to
do
|
format
|
...
...
@@ -38,6 +38,10 @@ class Groups::MilestonesController < ApplicationController
@group
||=
Group
.
find_by
(
path:
params
[
:group_id
])
end
def
title
params
[
:id
].
gsub
(
"-"
,
"."
)
end
def
status
(
state
)
@group_milestones
.
map
{
|
milestone
|
next
if
milestone
.
state
!=
state
;
milestone
}.
compact
end
...
...
app/services/milestones/group_service.rb
View file @
b6425f33
...
...
@@ -8,5 +8,13 @@ module Milestones
@project_milestones
.
map
{
|
title
,
milestone
|
GroupMilestone
.
new
(
title
,
milestone
)
}
end
def
milestone
(
title
)
if
title
@project_milestones
[
title
]
else
nil
end
end
end
end
app/views/groups/milestones/index.html.haml
View file @
b6425f33
...
...
@@ -30,7 +30,7 @@
-
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
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
group_milestone_path
(
@group
,
safe_title
)
%div
%div
=
link_to
root_path
do
...
...
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