详情页面提供分页(评论、变更、提交)
This commit is contained in:
parent
867434531d
commit
4f3b41f323
|
@ -97,6 +97,13 @@ class PullRequestsController < ApplicationController
|
|||
@changes_count = @changes.count
|
||||
@comments = @g.merge_request_comments(@project.gpid, params[:id])
|
||||
@comments_count = @comments.count
|
||||
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@count = @comments_count
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
@offset ||= @pages.offset
|
||||
@comments = paginateHelper @comments, 10
|
||||
end
|
||||
|
||||
# Accept a merge request.
|
||||
|
@ -171,6 +178,14 @@ class PullRequestsController < ApplicationController
|
|||
def pull_request_comments
|
||||
begin
|
||||
@comments = @g.merge_request_comments(@project.gpid, params[:id])
|
||||
@comments_count = @comments.count
|
||||
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@count = @comments_count
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
@offset ||= @pages.offset
|
||||
@comments = paginateHelper @comments, 10
|
||||
rescue Exception => e
|
||||
@message = e.message
|
||||
end
|
||||
|
@ -184,6 +199,13 @@ class PullRequestsController < ApplicationController
|
|||
begin
|
||||
@commits = @g.merge_request_commits(@project.gpid, params[:id])
|
||||
@commits_count = @commits.count
|
||||
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@count = @commits_count
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
@offset ||= @pages.offset
|
||||
@commits = paginateHelper @commits, 10
|
||||
rescue Exception => e
|
||||
@message = e.message
|
||||
end
|
||||
|
@ -197,6 +219,13 @@ class PullRequestsController < ApplicationController
|
|||
begin
|
||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||
@changes_count = @changes.count
|
||||
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@count = @changes_count
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
@offset ||= @pages.offset
|
||||
@changes = paginateHelper @changes, 10
|
||||
rescue Exception => e
|
||||
@message = e.message
|
||||
end
|
||||
|
|
|
@ -29,5 +29,13 @@
|
|||
</table>
|
||||
</div>
|
||||
<% 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 %>
|
||||
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
<% @comments.each do |comment| %>
|
||||
<div class="merge-discussion-input">
|
||||
<%= form_tag(url_for(:controller => 'pull_requests', :action => 'create_pull_request_comment', :project_id => @project.id), :id => 'pull_request_comment_form', :method => "post", :remote => true) do %>
|
||||
<textarea id="pull_request_comment" name="pull_request_comment"></textarea>
|
||||
<span id ="pr_comment_tip" class="fontGrey2 c_red" style="display: none">内容不能为空</span>
|
||||
<a href="javascript:void(0);" class="BlueCirBtn mt10" onclick="pull_request_commit()">提交请求</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% @comments.reverse.each do |comment| %>
|
||||
<div class="merge-discussion-content merge-discussion-automatic">
|
||||
<%= link_to comment.author.try(:username), user_path(get_user_by_login_and(comment.author.try(:username))), :class => "link-blue mr15 fl" %>
|
||||
<span class="fl fontGrey2"><%#= time_tag(comment.author.try(:created_at)) %>前</span>
|
||||
|
@ -6,12 +13,13 @@
|
|||
<div class="merge-discussion-detail"><%= comment.note %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="merge-discussion-input">
|
||||
<%= form_tag(url_for(:controller => 'pull_requests', :action => 'create_pull_request_comment', :project_id => @project.id), :id => 'pull_request_comment_form', :method => "post", :remote => true) do %>
|
||||
<textarea id="pull_request_comment" name="pull_request_comment"></textarea>
|
||||
<span id ="pr_comment_tip" class="fontGrey2 c_red" style="display: none">内容不能为空</span>
|
||||
<a href="javascript:void(0);" class="BlueCirBtn mt10" onclick="pull_request_commit()">提交请求</a>
|
||||
<% 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>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -18,3 +18,12 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<% 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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue