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
...
@@ -2,8 +2,7 @@ class Groups::MilestonesController < ApplicationController
layout
'group'
layout
'group'
def
index
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
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
@group_milestones
=
case
params
[
:status
]
@group_milestones
=
case
params
[
:status
]
when
'all'
;
@group_milestones
when
'all'
;
@group_milestones
...
@@ -12,16 +11,17 @@ class Groups::MilestonesController < ApplicationController
...
@@ -12,16 +11,17 @@ class Groups::MilestonesController < ApplicationController
end
end
end
end
def
show
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
)
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
end
def
update
def
update
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
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
title
=
params
[
:id
].
gsub
(
"-"
,
"."
)
@group_milestones
.
each
do
|
group_milestone
|
@group_milestones
.
each
do
|
milestone
|
next
unless
group_milestone
.
title
==
title
Milestones
::
UpdateService
.
new
(
milestone
.
project
,
current_user
,
params
[
:milestone
]).
execute
(
milestone
)
group_milestone
.
milestones
.
each
do
|
milestone
|
Milestones
::
UpdateService
.
new
(
milestone
.
project
,
current_user
,
params
[
:milestone
]).
execute
(
milestone
)
end
end
end
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -38,6 +38,10 @@ class Groups::MilestonesController < ApplicationController
...
@@ -38,6 +38,10 @@ class Groups::MilestonesController < ApplicationController
@group
||=
Group
.
find_by
(
path:
params
[
:group_id
])
@group
||=
Group
.
find_by
(
path:
params
[
:group_id
])
end
end
def
title
params
[
:id
].
gsub
(
"-"
,
"."
)
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/services/milestones/group_service.rb
View file @
b6425f33
...
@@ -8,5 +8,13 @@ module Milestones
...
@@ -8,5 +8,13 @@ module Milestones
@project_milestones
.
map
{
|
title
,
milestone
|
GroupMilestone
.
new
(
title
,
milestone
)
}
@project_milestones
.
map
{
|
title
,
milestone
|
GroupMilestone
.
new
(
title
,
milestone
)
}
end
end
def
milestone
(
title
)
if
title
@project_milestones
[
title
]
else
nil
end
end
end
end
end
end
app/views/groups/milestones/index.html.haml
View file @
b6425f33
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
-
else
-
else
=
link_to
'Close Milestone'
,
group_milestone_path
(
@group
,
safe_title
,
milestone:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-small btn-remove"
=
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
),
group_milestone_path
(
@group
,
safe_title
)
%div
%div
%div
%div
=
link_to
root_path
do
=
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