详情页面提供分页(评论、变更、提交)
This commit is contained in:
parent
867434531d
commit
4f3b41f323
|
@ -97,6 +97,13 @@ class PullRequestsController < ApplicationController
|
||||||
@changes_count = @changes.count
|
@changes_count = @changes.count
|
||||||
@comments = @g.merge_request_comments(@project.gpid, params[:id])
|
@comments = @g.merge_request_comments(@project.gpid, params[:id])
|
||||||
@comments_count = @comments.count
|
@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
|
end
|
||||||
|
|
||||||
# Accept a merge request.
|
# Accept a merge request.
|
||||||
|
@ -171,6 +178,14 @@ class PullRequestsController < ApplicationController
|
||||||
def pull_request_comments
|
def pull_request_comments
|
||||||
begin
|
begin
|
||||||
@comments = @g.merge_request_comments(@project.gpid, params[:id])
|
@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
|
rescue Exception => e
|
||||||
@message = e.message
|
@message = e.message
|
||||||
end
|
end
|
||||||
|
@ -184,6 +199,13 @@ class PullRequestsController < ApplicationController
|
||||||
begin
|
begin
|
||||||
@commits = @g.merge_request_commits(@project.gpid, params[:id])
|
@commits = @g.merge_request_commits(@project.gpid, params[:id])
|
||||||
@commits_count = @commits.count
|
@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
|
rescue Exception => e
|
||||||
@message = e.message
|
@message = e.message
|
||||||
end
|
end
|
||||||
|
@ -197,6 +219,13 @@ class PullRequestsController < ApplicationController
|
||||||
begin
|
begin
|
||||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||||
@changes_count = @changes.count
|
@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
|
rescue Exception => e
|
||||||
@message = e.message
|
@message = e.message
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,5 +29,13 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% 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 %>
|
<% 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">
|
<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" %>
|
<%= 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>
|
<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 class="merge-discussion-detail"><%= comment.note %></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="merge-discussion-input">
|
<div style="text-align:center;">
|
||||||
<%= 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 %>
|
<div class="pages" style="width:auto; display:inline-block;">
|
||||||
<textarea id="pull_request_comment" name="pull_request_comment"></textarea>
|
<ul id="homework_pository_ref_pages">
|
||||||
<span id ="pr_comment_tip" class="fontGrey2 c_red" style="display: none">内容不能为空</span>
|
<%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
|
||||||
<a href="javascript:void(0);" class="BlueCirBtn mt10" onclick="pull_request_commit()">提交请求</a>
|
</ul>
|
||||||
<% end %>
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -18,3 +18,12 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% 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