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
Tatuya Kamada
gitlab-ce
Commits
4ca8a175
Commit
4ca8a175
authored
Jun 26, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter group milestones.
parent
0723bf1a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
26 deletions
+42
-26
app/controllers/groups/milestones_controller.rb
app/controllers/groups/milestones_controller.rb
+10
-0
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+1
-2
app/models/group_milestone.rb
app/models/group_milestone.rb
+9
-0
app/views/groups/_filter.html.haml
app/views/groups/_filter.html.haml
+2
-2
app/views/groups/milestones/index.html.haml
app/views/groups/milestones/index.html.haml
+20
-22
No files found.
app/controllers/groups/milestones_controller.rb
View file @
4ca8a175
...
@@ -6,6 +6,16 @@ class Groups::MilestonesController < ApplicationController
...
@@ -6,6 +6,16 @@ class Groups::MilestonesController < ApplicationController
project_ids
=
@group
.
projects
project_ids
=
@group
.
projects
project_milestones
=
Milestone
.
where
(
project_id:
project_ids
)
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
]
when
'all'
;
@group_milestones
when
'closed'
;
status
(
'closed'
)
else
status
(
'active'
)
end
end
end
private
def
status
(
state
)
@group_milestones
.
map
{
|
milestone
|
next
if
milestone
.
state
!=
state
;
milestone
}.
compact
end
end
end
app/helpers/groups_helper.rb
View file @
4ca8a175
...
@@ -35,8 +35,7 @@ module GroupsHelper
...
@@ -35,8 +35,7 @@ module GroupsHelper
def
group_filter_path
(
entity
,
options
=
{})
def
group_filter_path
(
entity
,
options
=
{})
exist_opts
=
{
exist_opts
=
{
state:
params
[
:state
],
status:
params
[
:status
]
scope:
params
[
:scope
]
}
}
options
=
exist_opts
.
merge
(
options
)
options
=
exist_opts
.
merge
(
options
)
...
...
app/models/group_milestone.rb
View file @
4ca8a175
...
@@ -38,4 +38,13 @@ class GroupMilestone
...
@@ -38,4 +38,13 @@ class GroupMilestone
rescue
ZeroDivisionError
rescue
ZeroDivisionError
100
100
end
end
def
state
state
=
milestones
.
map
{
|
milestone
|
milestone
.
state
}
if
state
.
all?
{
|
milestone_state
|
milestone_state
==
'active'
}
'active'
else
'closed'
end
end
end
end
app/views/groups/_filter.html.haml
View file @
4ca8a175
=
form_tag
group_filter_path
(
entity
),
method:
'get'
do
=
form_tag
group_filter_path
(
entity
),
method:
'get'
do
%fieldset
%fieldset
%ul
.nav.nav-pills.nav-stacked
%ul
.nav.nav-pills.nav-stacked
%li
{
class:
(
"active"
if
!
params
[
:status
]
)}
%li
{
class:
(
"active"
if
(
params
[
:status
]
==
'active'
||
!
params
[
:status
])
)}
=
link_to
group_filter_path
(
entity
,
status:
nil
)
do
=
link_to
group_filter_path
(
entity
,
status:
'active'
)
do
Active
Active
%li
{
class:
(
"active"
if
params
[
:status
]
==
'closed'
)}
%li
{
class:
(
"active"
if
params
[
:status
]
==
'closed'
)}
=
link_to
group_filter_path
(
entity
,
status:
'closed'
)
do
=
link_to
group_filter_path
(
entity
,
status:
'closed'
)
do
...
...
app/views/groups/milestones/index.html.haml
View file @
4ca8a175
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
.fixed.sidebar-expand-button.hidden-lg.hidden-md
.fixed.sidebar-expand-button.hidden-lg.hidden-md
%i
.icon-list.icon-2x
%i
.icon-list.icon-2x
.col-md-3.responsive-side
.col-md-3.responsive-side
=
render
'groups/filter'
,
entity:
'milestone
s
'
=
render
'groups/filter'
,
entity:
'milestone'
.col-md-9
.col-md-9
.panel.panel-default
.panel.panel-default
%ul
.well-list
%ul
.well-list
...
@@ -22,27 +22,25 @@
...
@@ -22,27 +22,25 @@
.nothing-here-block
No milestones to show
.nothing-here-block
No milestones to show
-
else
-
else
-
@group_milestones
.
each
do
|
milestone
|
-
@group_milestones
.
each
do
|
milestone
|
%li
{
class:
"milestone milestone-open"
,
id:
1
}
%li
{
class:
"milestone milestone-#{milestone.state == 'closed' ? 'closed' : 'open'}"
,
id:
dom_id
(
milestone
.
milestones
.
first
)
}
.pull-right
-
unless
milestone
.
state
==
'closed'
=
link_to
'Close Milestone'
,
root_path
,
method: :put
,
remote:
true
,
class:
"btn btn-small btn-remove"
.pull-right
=
link_to
'Close Milestone'
,
root_path
,
method: :put
,
remote:
true
,
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
-
if
false
%div
%span
.muted
Empty
-
else
%div
%div
%div
=
link_to
root_path
do
=
link_to
root_path
do
=
pluralize
milestone
.
issue_count
,
'Issue'
=
pluralize
milestone
.
issue_count
,
'Issue'
=
link_to
root_path
do
=
link_to
root_path
do
=
pluralize
milestone
.
merge_requests_count
,
'Merge Request'
=
pluralize
milestone
.
merge_requests_count
,
'Merge Request'
%span
.light
#{
milestone
.
percent_complete
}
% complete
%span
.light
#{
milestone
.
percent_complete
}
% complete
.progress.progress-info
.progress.progress-info
.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_names
.
each
do
|
name
|
%span
.label.label-default
%span
.label.label-default
=
name
=
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