Commit f417a265 authored by randx's avatar randx

Finalize milestones for Merge Requests

parent d4e070cf
......@@ -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
......@@ -675,3 +675,11 @@ pre {
margin-bottom: 0;
margin-top:4px;
}
.float-link {
float:left;
margin-right:15px;
.s16 {
margin-right:5px;
}
}
......@@ -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|
......
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
......@@ -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
require Rails.root.join("app/models/commit")
require Rails.root.join("app/roles/static_model")
class MergeRequest < ActiveRecord::Base
include IssueCommonality
......
......@@ -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
......
......@@ -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'
......@@ -31,10 +31,10 @@
%h5
Progress:
%small
#{@milestone.issues.closed.count} closed
#{@milestone.closed_items_count} closed
&ndash;
#{@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}
&ndash;
= 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}
&ndash;
= link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request]
%br
.span6
%table
%thead
%th Participants
- @users.each do |user|
%tr
%td
= image_tag gravatar_icon(user.email, 24), width: "24"
&nbsp;
= user.name
%hr
%h6 Participants:
%div
- @users.each do |user|
= link_to tm_path(user.tm_of(@project)), class: 'float-link' do
= user.avatar_image
= user.name
.clearfix
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment