完成pull request 关闭功能

This commit is contained in:
huang 2016-08-09 10:29:18 +08:00
parent 26c11693fd
commit d1b4e83fee
2 changed files with 5 additions and 1 deletions

View File

@ -14,9 +14,12 @@ class PullRequestsController < ApplicationController
@requests = @g.merge_requests(@project.gpid).select{|request| request.state == "opened" || request.state == "reopened"}
when "2"
@requests = @g.merge_requests(@project.gpid).select{|request| request.state == "merged"}
when "3"
@requests = @g.merge_requests(@project.gpid).select{|request| request.state == "closed"}
end
@requests_opened_count = @requests.count
@requests_merged_count = params[:type] ? @requests.count : @g.merge_requests(@project.gpid).select{|request| request.state == "merged"}.count
@requests_merged_count = @g.merge_requests(@project.gpid).select{|request| request.state == "merged"}.count
@requests_closed_count = @g.merge_requests(@project.gpid).select{|request| request.state == "closed"}.count
respond_to do |format|
format.html
format.js

View File

@ -2,6 +2,7 @@
<ul id="mergeBanner" class="project-merge-banner">
<li class="active"><%= link_to "待处理<span class='project-number-dot'>#{@requests_opened_count}</span>".html_safe, project_pull_requests_path(:type => "1"), :remote => true %></li>
<li><%= link_to "已处理<span class='project-number-dot'>#{@requests_merged_count}</span>".html_safe, project_pull_requests_path(:type => "2"), :remote => true %></li>
<li><%= link_to "已关闭<span class='project-number-dot'>#{@requests_closed_count}</span>".html_safe, project_pull_requests_path(:type => "3"), :remote => true %></li>
<%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
<div class="cl"></div>