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
f417a265
Commit
f417a265
authored
Oct 29, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finalize milestones for Merge Requests
parent
d4e070cf
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
25 deletions
+57
-25
app/assets/javascripts/milestones.js.coffee
app/assets/javascripts/milestones.js.coffee
+7
-0
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+8
-0
app/controllers/milestones_controller.rb
app/controllers/milestones_controller.rb
+1
-1
app/decorators/user_decorator.rb
app/decorators/user_decorator.rb
+11
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-0
app/models/merge_request.rb
app/models/merge_request.rb
+1
-0
app/models/milestone.rb
app/models/milestone.rb
+9
-5
app/views/milestones/_milestone.html.haml
app/views/milestones/_milestone.html.haml
+3
-3
app/views/milestones/show.html.haml
app/views/milestones/show.html.haml
+13
-16
No files found.
app/assets/javascripts/milestones.js.coffee
View file @
f417a265
...
...
@@ -5,3 +5,10 @@ $ ->
$
(
'.milestone-issue-filter li'
).
toggleClass
(
'active'
)
$
(
'.milestone-issue-filter tr[data-closed]'
).
toggleClass
(
'hide'
)
false
$
(
'.milestone-merge-requests-filter tr[data-closed]'
).
addClass
(
'hide'
)
$
(
'.milestone-merge-requests-filter ul.nav li a'
).
click
->
$
(
'.milestone-merge-requests-filter li'
).
toggleClass
(
'active'
)
$
(
'.milestone-merge-requests-filter tr[data-closed]'
).
toggleClass
(
'hide'
)
false
app/assets/stylesheets/common.scss
View file @
f417a265
...
...
@@ -675,3 +675,11 @@ pre {
margin-bottom
:
0
;
margin-top
:
4px
;
}
.float-link
{
float
:left
;
margin-right
:
15px
;
.s16
{
margin-right
:
5px
;
}
}
app/controllers/milestones_controller.rb
View file @
f417a265
...
...
@@ -31,7 +31,7 @@ class MilestonesController < ProjectResourceController
def
show
@issues
=
@milestone
.
issues
@users
=
@milestone
.
participants
@users
=
UserDecorator
.
decorate
(
@milestone
.
participants
)
@merge_requests
=
@milestone
.
merge_requests
respond_to
do
|
format
|
...
...
app/decorators/user_decorator.rb
0 → 100644
View file @
f417a265
class
UserDecorator
<
ApplicationDecorator
decorates
:user
def
avatar_image
size
=
16
h
.
image_tag
h
.
gravatar_icon
(
self
.
email
,
size
),
class:
"avatar
#{
"s
#{
size
}
"
}
"
,
width:
size
end
def
tm_of
(
project
)
project
.
team_member_by_id
(
self
.
id
)
end
end
app/helpers/projects_helper.rb
View file @
f417a265
...
...
@@ -10,5 +10,9 @@ module ProjectsHelper
def
link_to_project
project
link_to
project
.
name
,
project
end
def
tm_path
team_member
project_team_member_path
(
@project
,
team_member
)
end
end
app/models/merge_request.rb
View file @
f417a265
require
Rails
.
root
.
join
(
"app/models/commit"
)
require
Rails
.
root
.
join
(
"app/roles/static_model"
)
class
MergeRequest
<
ActiveRecord
::
Base
include
IssueCommonality
...
...
app/models/milestone.rb
View file @
f417a265
...
...
@@ -16,16 +16,20 @@ class Milestone < ActiveRecord::Base
User
.
where
(
id:
issues
.
pluck
(
:assignee_id
))
end
def
issues_percent_complete
((
self
.
issues
.
closed
.
count
*
100
)
/
self
.
issues
.
count
).
abs
def
open_items_count
self
.
issues
.
opened
.
count
+
self
.
merge_requests
.
opened
.
count
end
def
merge_requests_percent_complete
((
self
.
merge_requests
.
closed
.
count
*
100
)
/
self
.
merge_requests
.
count
).
abs
def
closed_items_count
self
.
issues
.
closed
.
count
+
self
.
merge_requests
.
closed
.
count
end
def
total_items_count
self
.
issues
.
count
+
self
.
merge_requests
.
count
end
def
percent_complete
(
issues_percent_complete
+
merge_requests_percent_complete
)
/
2
(
(
closed_items_count
*
100
)
/
total_items_count
).
abs
rescue
ZeroDivisionError
100
end
...
...
app/views/milestones/_milestone.html.haml
View file @
f417a265
...
...
@@ -9,13 +9,13 @@
%small
=
milestone
.
expires_at
.row
.progress.progress-
success
.span4
.progress.progress-
info
.span4
.bar
{
style:
"width: #{milestone.percent_complete}%;"
}
.span6
-
if
milestone
.
issues
.
any?
=
link_to
project_issues_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"
padded
"
do
=
link_to
project_issues_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"
btn very_small
"
do
%strong
=
pluralize
milestone
.
issues
.
count
,
'Issue'
-
if
milestone
.
merge_requests
.
any?
=
link_to
project_merge_requests_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"
padded
"
do
=
link_to
project_merge_requests_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"
btn very_small
"
do
%strong
=
pluralize
milestone
.
issues
.
count
,
'Merge Request'
app/views/milestones/show.html.haml
View file @
f417a265
...
...
@@ -31,10 +31,10 @@
%h5
Progress:
%small
#{
@milestone
.
issues
.
closed
.
count
}
closed
#{
@milestone
.
closed_items_
count
}
closed
–
#{
@milestone
.
issues
.
opened
.
count
}
open
.progress.progress-
success
#{
@milestone
.
open_items_
count
}
open
.progress.progress-
info
.bar
{
style:
"width: #{@milestone.percent_complete}%;"
}
...
...
@@ -58,10 +58,9 @@
%span
.badge.badge-info
##{issue.id}
–
=
link_to_gfm
truncate
(
issue
.
title
,
length:
60
),
[
@project
,
issue
]
%br
.span6
%table
.milestone-merge
_
requests-filter
%table
.milestone-merge
-
requests-filter
%thead
%th
%ul
.nav.nav-pills
...
...
@@ -74,15 +73,13 @@
%span
.badge.badge-info
##{merge_request.id}
–
=
link_to_gfm
truncate
(
merge_request
.
title
,
length:
60
),
[
@project
,
merge_request
]
%br
.span6
%table
%thead
%th
Participants
%hr
%h6
Participants:
%div
-
@users
.
each
do
|
user
|
%tr
%td
=
image_tag
gravatar_icon
(
user
.
email
,
24
),
width:
"24"
=
link_to
tm_path
(
user
.
tm_of
(
@project
)),
class:
'float-link'
do
=
user
.
avatar_image
=
user
.
name
.clearfix
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