添加统计数目

dev_blankdatabase
huang 9 years ago
parent b8cccdffda
commit 22a8adb64e

@ -51,6 +51,9 @@ class PullRequestsController < ApplicationController
@type = params[:type] @type = params[:type]
@request = @g.merge_request(@project.gpid, params[:id]) @request = @g.merge_request(@project.gpid, params[:id])
@commits = @g.merge_request_commits(@project.gpid, params[:id].to_i) @commits = @g.merge_request_commits(@project.gpid, params[:id].to_i)
@commits_count = @commits.count
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
@changes_count = @changes.count
end end
# Accept a merge request. # Accept a merge request.
@ -79,7 +82,8 @@ class PullRequestsController < ApplicationController
# 获取某次请求的改动 # 获取某次请求的改动
def pull_request_changes def pull_request_changes
@changes = @g.merge_request_changes(@project.gpid, params[:id]) @changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
@changes_count = @changes.count
end end
private private

@ -1,7 +1,7 @@
<% if @changes %> <% unless @changes.blank? %>
<% @changes.try(:changes).each do |cd| %> <% @changes.each do |cd| %>
<div class="showing-changes-row fontGrey2"> <div class="showing-changes-row fontGrey2">
<a href="javascript:void()" class="linkGrey3" id="changed-files"> <a class="linkGrey3" id="changed-files">
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= cd['new_path'] %> <img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= cd['new_path'] %>
</a> </a>
</div> </div>

@ -12,8 +12,8 @@
</div> </div>
</div> </div>
<ul class="merge-record" style="border-top:1px solid #ddd;"> <ul class="merge-record" style="border-top:1px solid #ddd;">
<li><%= link_to "提交<span class='project-number-dot'>1</span>".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %></li> <li><%= link_to "提交<span class='project-number-dot'>#{@commits_count}</span>".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %></li>
<li><%= link_to "改动<span class='project-number-dot'>1</span>".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %></li> <li><%= link_to "改动<span class='project-number-dot'>#{@changes_count}</span>".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %></li>
</ul> </ul>
<div class="new-merge-row b_grey fontGrey2"><span class="ml10"> 根据最近提交时间排列</span></div> <div class="new-merge-row b_grey fontGrey2"><span class="ml10"> 根据最近提交时间排列</span></div>
<div id="merge_record_0"> <div id="merge_record_0">

Loading…
Cancel
Save