pull request 列表页面添加分页
This commit is contained in:
parent
dcdc09d864
commit
867434531d
|
@ -21,6 +21,13 @@ class PullRequestsController < ApplicationController
|
|||
@requests_opened_count = @requests.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
|
||||
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@count = type_count(type, @requests_opened_count, @requests_merged_count, @requests_closed_count)
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
@offset ||= @pages.offset
|
||||
@requests = paginateHelper @requests, 10
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
|
|
|
@ -25,4 +25,15 @@ module PullRequestsHelper
|
|||
end
|
||||
end
|
||||
|
||||
def type_count type, requests_opened_count, requests_merged_count, requests_closed_count
|
||||
case type
|
||||
when nil, "1"
|
||||
requests_opened_count
|
||||
when "2"
|
||||
requests_merged_count
|
||||
when "3"
|
||||
requests_closed_count
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,4 +12,13 @@
|
|||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div style="text-align:center;">
|
||||
<div class="pages" style="width:auto; display:inline-block;">
|
||||
<ul id="homework_pository_ref_pages">
|
||||
<%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -13,6 +13,7 @@
|
|||
<%= render "pull_requests/pull_requests_list" %>
|
||||
</ul>
|
||||
|
||||
|
||||
<script>
|
||||
$("#mergeBanner").parent().css("width","730px");
|
||||
|
||||
|
|
|
@ -523,7 +523,7 @@ a:hover.upload_btn_grey{background:#8a8a8a;}
|
|||
.project-merge-banner li a {padding:14px; font-size:14px; color:#555; display:inline-block;}
|
||||
.project-number-dot {display:inline-block; min-width:10px; padding:3px 5px; font-size:12px; color:#888; line-height:1; vertical-align:middle; white-space:nowrap; text-align:center; background-color:#eee; border-radius:10px; margin-left:5px;}
|
||||
.project-merge-content {}
|
||||
.project-merge-content li {padding:10px; margin:0 -10px; background-color:#f9f9f9; border-bottom:1px solid #e5e5e5;}
|
||||
.project-merge-content>li {padding:10px; margin:0 -10px; background-color:#f9f9f9; border-bottom:1px solid #e5e5e5;}
|
||||
.no-merge-content {padding:10px 15px; color:#888;}
|
||||
.new-merge-request {border-bottom:1px solid #ddd; padding-bottom:10px;}
|
||||
.new-merge-wrap {font-size:13px; color:#484848; border-bottom:1px solid #ddd; padding:10px 0;}
|
||||
|
|
Loading…
Reference in New Issue