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
986695e1
Commit
986695e1
authored
Nov 13, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor global and group milestones logic
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
05335a3c
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
145 additions
and
156 deletions
+145
-156
app/controllers/concerns/global_milestones.rb
app/controllers/concerns/global_milestones.rb
+19
-0
app/controllers/dashboard/milestones_controller.rb
app/controllers/dashboard/milestones_controller.rb
+7
-22
app/controllers/groups/application_controller.rb
app/controllers/groups/application_controller.rb
+8
-3
app/controllers/groups/avatars_controller.rb
app/controllers/groups/avatars_controller.rb
+0
-2
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+0
-5
app/controllers/groups/milestones_controller.rb
app/controllers/groups/milestones_controller.rb
+19
-44
app/finders/milestones_finder.rb
app/finders/milestones_finder.rb
+13
-0
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+1
-1
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+1
-1
app/models/global_label.rb
app/models/global_label.rb
+17
-0
app/models/global_milestone.rb
app/models/global_milestone.rb
+13
-5
app/services/labels/group_service.rb
app/services/labels/group_service.rb
+0
-26
app/services/milestones/collection_service.rb
app/services/milestones/collection_service.rb
+1
-1
app/views/dashboard/milestones/index.html.haml
app/views/dashboard/milestones/index.html.haml
+3
-3
app/views/dashboard/milestones/show.html.haml
app/views/dashboard/milestones/show.html.haml
+18
-18
app/views/groups/milestones/index.html.haml
app/views/groups/milestones/index.html.haml
+3
-3
app/views/groups/milestones/new.html.haml
app/views/groups/milestones/new.html.haml
+1
-1
app/views/groups/milestones/show.html.haml
app/views/groups/milestones/show.html.haml
+21
-21
No files found.
app/controllers/concerns/global_milestones.rb
0 → 100644
View file @
986695e1
module
GlobalMilestones
extend
ActiveSupport
::
Concern
def
milestones
@milestones
=
MilestonesFinder
.
new
.
execute
(
@projects
,
params
)
@milestones
=
GlobalMilestone
.
build_collection
(
@milestones
)
@milestones
=
Kaminari
.
paginate_array
(
@milestones
).
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
end
def
milestone
milestones
=
Milestone
.
of_projects
(
@projects
).
where
(
title:
params
[
:title
])
if
milestones
.
present?
@milestone
=
GlobalMilestone
.
new
(
params
[
:title
],
milestones
)
else
render_404
end
end
end
app/controllers/dashboard/milestones_controller.rb
View file @
986695e1
class
Dashboard::MilestonesController
<
Dashboard
::
ApplicationController
class
Dashboard::MilestonesController
<
Dashboard
::
ApplicationController
before_action
:load_projects
include
GlobalMilestones
before_action
:projects
before_action
:milestones
,
only:
[
:index
]
before_action
:milestone
,
only:
[
:show
]
def
index
def
index
project_milestones
=
case
params
[
:state
]
when
'all'
;
state
when
'closed'
;
state
(
'closed'
)
else
state
(
'active'
)
end
@dashboard_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
@dashboard_milestones
=
Kaminari
.
paginate_array
(
@dashboard_milestones
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
end
end
def
show
def
show
project_milestones
=
Milestone
.
where
(
project_id:
@projects
).
order
(
"due_date ASC"
)
@dashboard_milestone
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
end
end
private
private
def
load_projects
def
projects
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
@projects
||=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
end
def
title
params
[
:title
]
end
def
state
(
state
=
nil
)
conditions
=
{
project_id:
@projects
}
conditions
.
reverse_merge!
(
state:
state
)
if
state
Milestone
.
where
(
conditions
).
order
(
"title ASC"
)
end
end
end
end
app/controllers/groups/application_controller.rb
View file @
986695e1
class
Groups::ApplicationController
<
ApplicationController
class
Groups::ApplicationController
<
ApplicationController
layout
'group'
layout
'group'
before_action
:group
private
private
def
group
@group
||=
Group
.
find_by
(
path:
params
[
:group_id
])
end
def
authorize_read_group!
def
authorize_read_group!
unless
@group
and
can?
(
current_user
,
:read_group
,
@group
)
unless
@group
and
can?
(
current_user
,
:read_group
,
@group
)
if
current_user
.
nil?
if
current_user
.
nil?
...
@@ -12,13 +17,13 @@ class Groups::ApplicationController < ApplicationController
...
@@ -12,13 +17,13 @@ class Groups::ApplicationController < ApplicationController
end
end
end
end
end
end
def
authorize_admin_group!
def
authorize_admin_group!
unless
can?
(
current_user
,
:admin_group
,
group
)
unless
can?
(
current_user
,
:admin_group
,
group
)
return
render_404
return
render_404
end
end
end
end
def
authorize_admin_group_member!
def
authorize_admin_group_member!
unless
can?
(
current_user
,
:admin_group_member
,
group
)
unless
can?
(
current_user
,
:admin_group_member
,
group
)
return
render_403
return
render_403
...
...
app/controllers/groups/avatars_controller.rb
View file @
986695e1
class
Groups::AvatarsController
<
ApplicationController
class
Groups::AvatarsController
<
ApplicationController
def
destroy
def
destroy
@group
=
Group
.
find_by
(
path:
params
[
:group_id
])
@group
.
remove_avatar!
@group
.
remove_avatar!
@group
.
save
@group
.
save
redirect_to
edit_group_path
(
@group
)
redirect_to
edit_group_path
(
@group
)
...
...
app/controllers/groups/group_members_controller.rb
View file @
986695e1
class
Groups::GroupMembersController
<
Groups
::
ApplicationController
class
Groups::GroupMembersController
<
Groups
::
ApplicationController
skip_before_action
:authenticate_user!
,
only:
[
:index
]
skip_before_action
:authenticate_user!
,
only:
[
:index
]
before_action
:group
# Authorize
# Authorize
before_action
:authorize_read_group!
before_action
:authorize_read_group!
...
@@ -80,10 +79,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
...
@@ -80,10 +79,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
protected
protected
def
group
@group
||=
Group
.
find_by
(
path:
params
[
:group_id
])
end
def
member_params
def
member_params
params
.
require
(
:group_member
).
permit
(
:access_level
,
:user_id
)
params
.
require
(
:group_member
).
permit
(
:access_level
,
:user_id
)
end
end
...
...
app/controllers/groups/milestones_controller.rb
View file @
986695e1
class
Groups::MilestonesController
<
Groups
::
ApplicationController
class
Groups::MilestonesController
<
Groups
::
ApplicationController
before_action
:authorize_group_milestone!
,
only: :update
include
GlobalMilestones
before_action
:group
def
index
before_action
:projects
project_milestones
=
before_action
:milestones
,
only:
[
:index
]
case
params
[
:state
]
before_action
:milestone
,
only:
[
:show
,
:update
]
when
'all'
;
state
before_action
:authorize_group_milestone!
,
only:
[
:create
,
:update
]
when
'closed'
;
state
(
'closed'
)
else
state
(
'active'
)
end
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
execute
def
index
@group_milestones
=
Kaminari
.
paginate_array
(
@group_milestones
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
end
end
def
new
def
new
@
group_milestone
=
OpenStruct
.
new
(
title:
nil
,
description:
nil
)
@
milestone
=
Milestone
.
new
end
end
def
create
def
create
...
@@ -26,55 +21,35 @@ class Groups::MilestonesController < Groups::ApplicationController
...
@@ -26,55 +21,35 @@ class Groups::MilestonesController < Groups::ApplicationController
Milestones
::
CreateService
.
new
(
project
,
current_user
,
milestone_params
).
execute
Milestones
::
CreateService
.
new
(
project
,
current_user
,
milestone_params
).
execute
end
end
redirect_to
group_milestone_path
(
@group
,
title
.
parameterize
,
title:
title
)
redirect_to
milestone_path
(
title
)
end
end
def
show
def
show
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
).
order
(
"due_date ASC"
)
@group_milestone
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
end
end
def
update
def
update
project_milestones
=
Milestone
.
where
(
project_id:
group
.
projects
).
order
(
"due_date ASC"
)
@milestone
.
milestones
.
each
do
|
milestone
|
@group_milestones
=
Milestones
::
GroupService
.
new
(
project_milestones
).
milestone
(
title
)
Milestones
::
UpdateService
.
new
(
milestone
.
project
,
current_user
,
milestone_params
).
execute
(
milestone
)
@group_milestones
.
milestones
.
each
do
|
milestone
|
Milestones
::
UpdateService
.
new
(
milestone
.
project
,
current_user
,
params
[
:milestone
]).
execute
(
milestone
)
end
end
respond_to
do
|
format
|
redirect_back_or_default
(
default:
milestone_path
(
@milestone
.
title
))
format
.
js
format
.
html
do
redirect_to
group_milestones_path
(
group
)
end
end
end
end
private
private
def
group
def
authorize_group_milestone!
@group
||=
Group
.
find_by
(
path:
params
[
:group_id
])
return
render_404
unless
can?
(
current_user
,
:admin_group
,
group
)
end
def
title
params
[
:title
]
end
end
def
state
(
state
=
nil
)
def
milestone_params
conditions
=
{
project_id:
group
.
projects
}
params
.
require
(
:milestone
).
permit
(
:title
,
:description
,
:due_date
,
:state_event
)
conditions
.
reverse_merge!
(
state:
state
)
if
state
Milestone
.
where
(
conditions
).
order
(
"title ASC"
)
end
end
def
authorize_group_milestone!
def
milestone_path
(
title
)
return
render_404
unless
can?
(
current_user
,
:admin_group
,
group
)
group_milestone_path
(
@group
,
title
.
parameterize
,
title:
title
)
end
end
def
milestone_params
def
projects
params
.
require
(
:milestone
).
permit
(
@projects
||=
@group
.
projects
:title
,
:description
,
:due_date
)
end
end
end
end
app/finders/milestones_finder.rb
0 → 100644
View file @
986695e1
class
MilestonesFinder
def
execute
(
projects
,
params
)
milestones
=
Milestone
.
of_projects
(
projects
)
milestones
=
milestones
.
order
(
"due_date ASC"
)
case
params
[
:state
]
when
'closed'
then
milestones
.
closed
when
'all'
then
milestones
else
milestones
.
active
end
end
end
app/helpers/labels_helper.rb
View file @
986695e1
...
@@ -100,7 +100,7 @@ module LabelsHelper
...
@@ -100,7 +100,7 @@ module LabelsHelper
Label
.
where
(
project_id:
@projects
)
Label
.
where
(
project_id:
@projects
)
end
end
grouped_labels
=
Labels
::
GroupService
.
new
(
labels
).
execute
grouped_labels
=
GlobalLabel
.
build_collection
(
labels
)
grouped_labels
.
unshift
(
Label
::
None
)
grouped_labels
.
unshift
(
Label
::
None
)
grouped_labels
.
unshift
(
Label
::
Any
)
grouped_labels
.
unshift
(
Label
::
Any
)
...
...
app/helpers/milestones_helper.rb
View file @
986695e1
...
@@ -28,7 +28,7 @@ module MilestonesHelper
...
@@ -28,7 +28,7 @@ module MilestonesHelper
Milestone
.
where
(
project_id:
@projects
)
Milestone
.
where
(
project_id:
@projects
)
end
.
active
end
.
active
grouped_milestones
=
Milestones
::
GroupService
.
new
(
milestones
).
execute
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
grouped_milestones
.
unshift
(
Milestone
::
None
)
grouped_milestones
.
unshift
(
Milestone
::
None
)
grouped_milestones
.
unshift
(
Milestone
::
Any
)
grouped_milestones
.
unshift
(
Milestone
::
Any
)
...
...
app/models/g
roup
_label.rb
→
app/models/g
lobal
_label.rb
View file @
986695e1
class
G
roup
Label
class
G
lobal
Label
attr_accessor
:title
,
:labels
attr_accessor
:title
,
:labels
alias_attribute
:name
,
:title
alias_attribute
:name
,
:title
def
self
.
build_collection
(
labels
)
labels
=
labels
.
group_by
(
&
:title
)
labels
.
map
do
|
title
,
label
|
new
(
title
,
label
)
end
end
def
initialize
(
title
,
labels
)
def
initialize
(
title
,
labels
)
@title
=
title
@title
=
title
@labels
=
labels
@labels
=
labels
...
...
app/models/g
roup
_milestone.rb
→
app/models/g
lobal
_milestone.rb
View file @
986695e1
class
G
roup
Milestone
class
G
lobal
Milestone
attr_accessor
:title
,
:milestones
attr_accessor
:title
,
:milestones
alias_attribute
:name
,
:title
alias_attribute
:name
,
:title
def
self
.
build_collection
(
milestones
)
milestones
=
milestones
.
group_by
(
&
:title
)
milestones
.
map
do
|
title
,
milestones
|
new
(
title
,
milestones
)
end
end
def
initialize
(
title
,
milestones
)
def
initialize
(
title
,
milestones
)
@title
=
title
@title
=
title
@milestones
=
milestones
@milestones
=
milestones
...
@@ -10,7 +18,7 @@ class GroupMilestone
...
@@ -10,7 +18,7 @@ class GroupMilestone
def
safe_title
def
safe_title
@title
.
parameterize
@title
.
parameterize
end
end
def
projects
def
projects
milestones
.
map
{
|
milestone
|
milestone
.
project
}
milestones
.
map
{
|
milestone
|
milestone
.
project
}
end
end
...
@@ -60,15 +68,15 @@ class GroupMilestone
...
@@ -60,15 +68,15 @@ class GroupMilestone
end
end
def
issues
def
issues
@
group_
issues
||=
milestones
.
map
(
&
:issues
).
flatten
.
group_by
(
&
:state
)
@issues
||=
milestones
.
map
(
&
:issues
).
flatten
.
group_by
(
&
:state
)
end
end
def
merge_requests
def
merge_requests
@
group_
merge_requests
||=
milestones
.
map
(
&
:merge_requests
).
flatten
.
group_by
(
&
:state
)
@merge_requests
||=
milestones
.
map
(
&
:merge_requests
).
flatten
.
group_by
(
&
:state
)
end
end
def
participants
def
participants
@
group_
participants
||=
milestones
.
map
(
&
:participants
).
flatten
.
compact
.
uniq
@participants
||=
milestones
.
map
(
&
:participants
).
flatten
.
compact
.
uniq
end
end
def
opened_issues
def
opened_issues
...
...
app/services/labels/group_service.rb
deleted
100644 → 0
View file @
05335a3c
module
Labels
class
GroupService
<
::
BaseService
def
initialize
(
project_labels
)
@project_labels
=
project_labels
.
group_by
(
&
:title
)
end
def
execute
build
(
@project_labels
)
end
def
label
(
title
)
if
title
group_label
=
@project_labels
[
title
].
group_by
(
&
:title
)
build
(
group_label
).
first
else
nil
end
end
private
def
build
(
label
)
label
.
map
{
|
title
,
labels
|
GroupLabel
.
new
(
title
,
labels
)
}
end
end
end
app/services/milestones/
group
_service.rb
→
app/services/milestones/
collection
_service.rb
View file @
986695e1
module
Milestones
module
Milestones
class
Group
Service
<
Milestones
::
BaseService
class
Collection
Service
<
Milestones
::
BaseService
def
initialize
(
project_milestones
)
def
initialize
(
project_milestones
)
@project_milestones
=
project_milestones
.
group_by
(
&
:title
)
@project_milestones
=
project_milestones
.
group_by
(
&
:title
)
end
end
...
...
app/views/dashboard/milestones/index.html.haml
View file @
986695e1
...
@@ -10,10 +10,10 @@
...
@@ -10,10 +10,10 @@
.milestones
.milestones
%ul
.content-list
%ul
.content-list
-
if
@
dashboard_
milestones
.
blank?
-
if
@milestones
.
blank?
%li
%li
.nothing-here-block
No milestones to show
.nothing-here-block
No milestones to show
-
else
-
else
-
@
dashboard_
milestones
.
each
do
|
milestone
|
-
@milestones
.
each
do
|
milestone
|
=
render
'milestone'
,
milestone:
milestone
=
render
'milestone'
,
milestone:
milestone
=
paginate
@
dashboard_
milestones
,
theme:
"gitlab"
=
paginate
@milestones
,
theme:
"gitlab"
app/views/dashboard/milestones/show.html.haml
View file @
986695e1
-
page_title
@
dashboard_
milestone
.
title
,
"Milestones"
-
page_title
@milestone
.
title
,
"Milestones"
%h4
.page-title
%h4
.page-title
.issue-box
{
class:
"issue-box-#{@
dashboard_
milestone.closed? ? 'closed' : 'open'}"
}
.issue-box
{
class:
"issue-box-#{@milestone.closed? ? 'closed' : 'open'}"
}
-
if
@
dashboard_
milestone
.
closed?
-
if
@milestone
.
closed?
Closed
Closed
-
else
-
else
Open
Open
Milestone
#{
@
dashboard_
milestone
.
title
}
Milestone
#{
@milestone
.
title
}
%hr
%hr
-
if
(
@
dashboard_milestone
.
total_items_count
==
@dashboard_milestone
.
closed_items_count
)
&&
@dashboard_
milestone
.
active?
-
if
(
@
milestone
.
total_items_count
==
@milestone
.
closed_items_count
)
&&
@
milestone
.
active?
.alert.alert-success
.alert.alert-success
%span
All issues for this milestone are closed. You may close the milestone now.
%span
All issues for this milestone are closed. You may close the milestone now.
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
%th
Open issues
%th
Open issues
%th
State
%th
State
%th
Due date
%th
Due date
-
@
dashboard_
milestone
.
milestones
.
each
do
|
milestone
|
-
@milestone
.
milestones
.
each
do
|
milestone
|
%tr
%tr
%td
%td
=
link_to
"
#{
milestone
.
project
.
name_with_namespace
}
"
,
namespace_project_milestone_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone
)
=
link_to
"
#{
milestone
.
project
.
name_with_namespace
}
"
,
namespace_project_milestone_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone
)
...
@@ -39,46 +39,46 @@
...
@@ -39,46 +39,46 @@
.context
.context
%p
.lead
%p
.lead
Progress:
Progress:
#{
@
dashboard_
milestone
.
closed_items_count
}
closed
#{
@milestone
.
closed_items_count
}
closed
–
–
#{
@
dashboard_
milestone
.
open_items_count
}
open
#{
@milestone
.
open_items_count
}
open
=
milestone_progress_bar
(
@
dashboard_
milestone
)
=
milestone_progress_bar
(
@milestone
)
%ul
.nav.nav-tabs
%ul
.nav.nav-tabs
%li
.active
%li
.active
=
link_to
'#tab-issues'
,
'data-toggle'
=>
'tab'
do
=
link_to
'#tab-issues'
,
'data-toggle'
=>
'tab'
do
Issues
Issues
%span
.badge
=
@
dashboard_
milestone
.
issue_count
%span
.badge
=
@milestone
.
issue_count
%li
%li
=
link_to
'#tab-merge-requests'
,
'data-toggle'
=>
'tab'
do
=
link_to
'#tab-merge-requests'
,
'data-toggle'
=>
'tab'
do
Merge Requests
Merge Requests
%span
.badge
=
@
dashboard_
milestone
.
merge_requests_count
%span
.badge
=
@milestone
.
merge_requests_count
%li
%li
=
link_to
'#tab-participants'
,
'data-toggle'
=>
'tab'
do
=
link_to
'#tab-participants'
,
'data-toggle'
=>
'tab'
do
Participants
Participants
%span
.badge
=
@
dashboard_
milestone
.
participants
.
count
%span
.badge
=
@milestone
.
participants
.
count
.pull-right
.pull-right
=
link_to
'Browse Issues'
,
issues_dashboard_path
(
milestone_title:
@
dashboard_
milestone
.
title
),
class:
"btn edit-milestone-link btn-grouped"
=
link_to
'Browse Issues'
,
issues_dashboard_path
(
milestone_title:
@milestone
.
title
),
class:
"btn edit-milestone-link btn-grouped"
.tab-content
.tab-content
.tab-pane.active
#tab-issues
.tab-pane.active
#tab-issues
.row
.row
.col-md-6
.col-md-6
=
render
'issues'
,
title:
"Open"
,
issues:
@
dashboard_
milestone
.
opened_issues
=
render
'issues'
,
title:
"Open"
,
issues:
@milestone
.
opened_issues
.col-md-6
.col-md-6
=
render
'issues'
,
title:
"Closed"
,
issues:
@
dashboard_
milestone
.
closed_issues
=
render
'issues'
,
title:
"Closed"
,
issues:
@milestone
.
closed_issues
.tab-pane
#tab-merge-requests
.tab-pane
#tab-merge-requests
.row
.row
.col-md-6
.col-md-6
=
render
'merge_requests'
,
title:
"Open"
,
merge_requests:
@
dashboard_
milestone
.
opened_merge_requests
=
render
'merge_requests'
,
title:
"Open"
,
merge_requests:
@milestone
.
opened_merge_requests
.col-md-6
.col-md-6
=
render
'merge_requests'
,
title:
"Closed"
,
merge_requests:
@
dashboard_
milestone
.
closed_merge_requests
=
render
'merge_requests'
,
title:
"Closed"
,
merge_requests:
@milestone
.
closed_merge_requests
.tab-pane
#tab-participants
.tab-pane
#tab-participants
%ul
.bordered-list
%ul
.bordered-list
-
@
dashboard_
milestone
.
participants
.
each
do
|
user
|
-
@milestone
.
participants
.
each
do
|
user
|
%li
%li
=
link_to
user
,
title:
user
.
name
,
class:
"darken"
do
=
link_to
user
,
title:
user
.
name
,
class:
"darken"
do
=
image_tag
avatar_icon
(
user
,
32
),
class:
"avatar s32"
=
image_tag
avatar_icon
(
user
,
32
),
class:
"avatar s32"
...
...
app/views/groups/milestones/index.html.haml
View file @
986695e1
...
@@ -14,10 +14,10 @@
...
@@ -14,10 +14,10 @@
group are listed here.
group are listed here.
.milestones
.milestones
%ul
.content-list
%ul
.content-list
-
if
@
group_
milestones
.
blank?
-
if
@milestones
.
blank?
%li
%li
.nothing-here-block
No milestones to show
.nothing-here-block
No milestones to show
-
else
-
else
-
@
group_
milestones
.
each
do
|
milestone
|
-
@milestones
.
each
do
|
milestone
|
=
render
'milestone'
,
milestone:
milestone
=
render
'milestone'
,
milestone:
milestone
=
paginate
@
group_
milestones
,
theme:
"gitlab"
=
paginate
@milestones
,
theme:
"gitlab"
app/views/groups/milestones/new.html.haml
View file @
986695e1
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
This will create milestone in every selected project
This will create milestone in every selected project
%hr
%hr
=
form_for
@
group_milestone
,
as: :
milestone
,
url:
group_milestones_path
(
@group
),
html:
{
class:
'form-horizontal milestone-form gfm-form js-requires-input'
}
do
|
f
|
=
form_for
@milestone
,
url:
group_milestones_path
(
@group
),
html:
{
class:
'form-horizontal milestone-form gfm-form js-requires-input'
}
do
|
f
|
.row
.row
.col-md-6
.col-md-6
.form-group
.form-group
...
...
app/views/groups/milestones/show.html.haml
View file @
986695e1
-
page_title
@
group_
milestone
.
title
,
"Milestones"
-
page_title
@milestone
.
title
,
"Milestones"
=
render
"header_title"
=
render
"header_title"
%h4
.page-title
%h4
.page-title
.issue-box
{
class:
"issue-box-#{@
group_
milestone.closed? ? 'closed' : 'open'}"
}
.issue-box
{
class:
"issue-box-#{@milestone.closed? ? 'closed' : 'open'}"
}
-
if
@
group_
milestone
.
closed?
-
if
@milestone
.
closed?
Closed
Closed
-
else
-
else
Open
Open
Milestone
#{
@
group_
milestone
.
title
}
Milestone
#{
@milestone
.
title
}
.pull-right
.pull-right
-
if
can?
(
current_user
,
:admin_group
,
@group
)
-
if
can?
(
current_user
,
:admin_group
,
@group
)
-
if
@
group_
milestone
.
active?
-
if
@milestone
.
active?
=
link_to
'Close Milestone'
,
group_milestone_path
(
@group
,
@
group_milestone
.
safe_title
,
title:
@group_
milestone
.
title
,
milestone:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-sm btn-close"
=
link_to
'Close Milestone'
,
group_milestone_path
(
@group
,
@
milestone
.
safe_title
,
title:
@
milestone
.
title
,
milestone:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-sm btn-close"
-
else
-
else
=
link_to
'Reopen Milestone'
,
group_milestone_path
(
@group
,
@
group_milestone
.
safe_title
,
title:
@group_
milestone
.
title
,
milestone:
{
state_event: :activate
}),
method: :put
,
class:
"btn btn-sm btn-grouped btn-reopen"
=
link_to
'Reopen Milestone'
,
group_milestone_path
(
@group
,
@
milestone
.
safe_title
,
title:
@
milestone
.
title
,
milestone:
{
state_event: :activate
}),
method: :put
,
class:
"btn btn-sm btn-grouped btn-reopen"
%hr
%hr
-
if
(
@
group_milestone
.
total_items_count
==
@group_milestone
.
closed_items_count
)
&&
@group_
milestone
.
active?
-
if
(
@
milestone
.
total_items_count
==
@milestone
.
closed_items_count
)
&&
@
milestone
.
active?
.alert.alert-success
.alert.alert-success
%span
All issues for this milestone are closed. You may close the milestone now.
%span
All issues for this milestone are closed. You may close the milestone now.
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
%th
Open issues
%th
Open issues
%th
State
%th
State
%th
Due date
%th
Due date
-
@
group_
milestone
.
milestones
.
each
do
|
milestone
|
-
@milestone
.
milestones
.
each
do
|
milestone
|
%tr
%tr
%td
%td
=
link_to
"
#{
milestone
.
project
.
name
}
"
,
namespace_project_milestone_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone
)
=
link_to
"
#{
milestone
.
project
.
name
}
"
,
namespace_project_milestone_path
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone
)
...
@@ -47,46 +47,46 @@
...
@@ -47,46 +47,46 @@
.context
.context
%p
.lead
%p
.lead
Progress:
Progress:
#{
@
group_
milestone
.
closed_items_count
}
closed
#{
@milestone
.
closed_items_count
}
closed
–
–
#{
@
group_
milestone
.
open_items_count
}
open
#{
@milestone
.
open_items_count
}
open
=
milestone_progress_bar
(
@
group_
milestone
)
=
milestone_progress_bar
(
@milestone
)
%ul
.nav.nav-tabs
%ul
.nav.nav-tabs
%li
.active
%li
.active
=
link_to
'#tab-issues'
,
'data-toggle'
=>
'tab'
do
=
link_to
'#tab-issues'
,
'data-toggle'
=>
'tab'
do
Issues
Issues
%span
.badge
=
@
group_
milestone
.
issue_count
%span
.badge
=
@milestone
.
issue_count
%li
%li
=
link_to
'#tab-merge-requests'
,
'data-toggle'
=>
'tab'
do
=
link_to
'#tab-merge-requests'
,
'data-toggle'
=>
'tab'
do
Merge Requests
Merge Requests
%span
.badge
=
@
group_
milestone
.
merge_requests_count
%span
.badge
=
@milestone
.
merge_requests_count
%li
%li
=
link_to
'#tab-participants'
,
'data-toggle'
=>
'tab'
do
=
link_to
'#tab-participants'
,
'data-toggle'
=>
'tab'
do
Participants
Participants
%span
.badge
=
@
group_
milestone
.
participants
.
count
%span
.badge
=
@milestone
.
participants
.
count
.pull-right
.pull-right
=
link_to
'Browse Issues'
,
issues_group_path
(
@group
,
milestone_title:
@
group_
milestone
.
title
),
class:
"btn edit-milestone-link btn-grouped"
=
link_to
'Browse Issues'
,
issues_group_path
(
@group
,
milestone_title:
@milestone
.
title
),
class:
"btn edit-milestone-link btn-grouped"
.tab-content
.tab-content
.tab-pane.active
#tab-issues
.tab-pane.active
#tab-issues
.row
.row
.col-md-6
.col-md-6
=
render
'issues'
,
title:
"Open"
,
issues:
@
group_
milestone
.
opened_issues
=
render
'issues'
,
title:
"Open"
,
issues:
@milestone
.
opened_issues
.col-md-6
.col-md-6
=
render
'issues'
,
title:
"Closed"
,
issues:
@
group_
milestone
.
closed_issues
=
render
'issues'
,
title:
"Closed"
,
issues:
@milestone
.
closed_issues
.tab-pane
#tab-merge-requests
.tab-pane
#tab-merge-requests
.row
.row
.col-md-6
.col-md-6
=
render
'merge_requests'
,
title:
"Open"
,
merge_requests:
@
group_
milestone
.
opened_merge_requests
=
render
'merge_requests'
,
title:
"Open"
,
merge_requests:
@milestone
.
opened_merge_requests
.col-md-6
.col-md-6
=
render
'merge_requests'
,
title:
"Closed"
,
merge_requests:
@
group_
milestone
.
closed_merge_requests
=
render
'merge_requests'
,
title:
"Closed"
,
merge_requests:
@milestone
.
closed_merge_requests
.tab-pane
#tab-participants
.tab-pane
#tab-participants
%ul
.bordered-list
%ul
.bordered-list
-
@
group_
milestone
.
participants
.
each
do
|
user
|
-
@milestone
.
participants
.
each
do
|
user
|
%li
%li
=
link_to
user
,
title:
user
.
name
,
class:
"darken"
do
=
link_to
user
,
title:
user
.
name
,
class:
"darken"
do
=
image_tag
avatar_icon
(
user
,
32
),
class:
"avatar s32"
=
image_tag
avatar_icon
(
user
,
32
),
class:
"avatar s32"
...
...
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