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
d4e070cf
Commit
d4e070cf
authored
Oct 29, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve styles. Add merge request completness to milestone percentage
parent
ecdf778e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
23 deletions
+37
-23
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+5
-0
app/contexts/merge_requests_load_context.rb
app/contexts/merge_requests_load_context.rb
+10
-8
app/models/milestone.rb
app/models/milestone.rb
+9
-1
app/views/milestones/_milestone.html.haml
app/views/milestones/_milestone.html.haml
+13
-14
No files found.
app/assets/stylesheets/common.scss
View file @
d4e070cf
...
...
@@ -670,3 +670,8 @@ pre {
padding
:
0
;
}
}
.milestone
.progress
{
margin-bottom
:
0
;
margin-top
:
4px
;
}
app/contexts/merge_requests_load_context.rb
View file @
d4e070cf
# Build collection of Merge Requests
# based on filtering passed via params for @project
class
MergeRequestsLoadContext
<
BaseContext
def
execute
type
=
params
[
:f
]
merge_requests
=
@
project
.
merge_requests
merge_requests
=
project
.
merge_requests
merge_requests
=
case
type
when
'all'
then
merge_requests
when
'closed'
then
merge_requests
.
closed
when
'assigned-to-me'
then
merge_requests
.
opened
.
assigned
(
current_user
)
else
merge_requests
.
opened
end
.
page
(
params
[
:page
]).
per
(
20
)
end
merge_requests
.
includes
(
:author
,
:project
).
order
(
"closed, created_at desc"
)
@merge_requests
=
merge_requests
merge_requests
=
merge_requests
.
page
(
params
[
:page
]).
per
(
20
)
merge_requests
=
merge_requests
.
includes
(
:author
,
:project
).
order
(
"closed, created_at desc"
)
# Filter by specific assignee_id (or lack thereof)?
if
params
[
:assignee_id
].
present?
@
merge_requests
=
merge_requests
.
where
(
assignee_id:
(
params
[
:assignee_id
]
==
'0'
?
nil
:
params
[
:assignee_id
]))
merge_requests
=
merge_requests
.
where
(
assignee_id:
(
params
[
:assignee_id
]
==
'0'
?
nil
:
params
[
:assignee_id
]))
end
# Filter by specific milestone_id (or lack thereof)?
if
params
[
:milestone_id
].
present?
@
merge_requests
=
merge_requests
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
'0'
?
nil
:
params
[
:milestone_id
]))
merge_requests
=
merge_requests
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
'0'
?
nil
:
params
[
:milestone_id
]))
end
@merge_requests
merge_requests
end
end
app/models/milestone.rb
View file @
d4e070cf
...
...
@@ -16,8 +16,16 @@ class Milestone < ActiveRecord::Base
User
.
where
(
id:
issues
.
pluck
(
:assignee_id
))
end
def
percent_complete
def
issues_
percent_complete
((
self
.
issues
.
closed
.
count
*
100
)
/
self
.
issues
.
count
).
abs
end
def
merge_requests_percent_complete
((
self
.
merge_requests
.
closed
.
count
*
100
)
/
self
.
merge_requests
.
count
).
abs
end
def
percent_complete
(
issues_percent_complete
+
merge_requests_percent_complete
)
/
2
rescue
ZeroDivisionError
100
end
...
...
app/views/milestones/_milestone.html.haml
View file @
d4e070cf
%li
{
class:
"milestone"
,
id:
dom_id
(
milestone
)
}
.right
-
if
milestone
.
issues
.
any?
%span
.btn.small.disabled.grouped
=
pluralize
milestone
.
issues
.
count
,
'issues'
-
if
milestone
.
issues
.
count
>
0
=
link_to
'Browse Issues'
,
project_issues_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"btn small grouped"
-
if
milestone
.
merge_requests
.
any?
%span
.btn.small.disabled.grouped
=
pluralize
milestone
.
issues
.
count
,
'Merge Requests'
-
if
milestone
.
merge_requests
.
count
>
0
=
link_to
'Browse Merge Requests'
,
project_merge_requests_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"btn small grouped"
-
if
can?
current_user
,
:admin_milestone
,
milestone
.
project
=
link_to
'Edit'
,
edit_project_milestone_path
(
milestone
.
project
,
milestone
),
class:
"btn small edit-milestone-link grouped"
=
link_to
edit_project_milestone_path
(
milestone
.
project
,
milestone
),
class:
"btn small edit-milestone-link grouped"
do
%i
.icon-edit
Edit
%h4
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
project_milestone_path
(
milestone
.
project
,
milestone
)
,
class:
"row_title"
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
project_milestone_path
(
milestone
.
project
,
milestone
)
%small
=
milestone
.
expires_at
%br
.progress.progress-success.span
3
.row
.progress.progress-success.span
4
.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
%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
%strong
=
pluralize
milestone
.
issues
.
count
,
'Merge Request'
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