PUll request代码简化及reverse评论
This commit is contained in:
parent
41ad5ca444
commit
3df8a46634
|
@ -95,7 +95,7 @@ class PullRequestsController < ApplicationController
|
|||
@commits_count = @commits.count
|
||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||
@changes_count = @changes.count
|
||||
@comments = @g.merge_request_comments(@project.gpid, params[:id])
|
||||
@comments = @g.merge_request_comments(@project.gpid, params[:id]).reverse
|
||||
@comments_count = @comments.count
|
||||
|
||||
@limit = 10
|
||||
|
@ -178,7 +178,7 @@ class PullRequestsController < ApplicationController
|
|||
# Gitlab.merge_request_comments(5, 1)
|
||||
def pull_request_comments
|
||||
begin
|
||||
@comments = @g.merge_request_comments(@project.gpid, params[:id])
|
||||
@comments = @g.merge_request_comments(@project.gpid, params[:id]).reverse
|
||||
@comments_count = @comments.count
|
||||
|
||||
@limit = 10
|
||||
|
@ -198,6 +198,7 @@ class PullRequestsController < ApplicationController
|
|||
# merge_request_id (required) - The ID of MR
|
||||
def pull_request_commits
|
||||
begin
|
||||
@type = params[:type]
|
||||
@commits = @g.merge_request_commits(@project.gpid, params[:id])
|
||||
@commits_count = @commits.count
|
||||
|
||||
|
@ -218,6 +219,7 @@ class PullRequestsController < ApplicationController
|
|||
# merge_request_id (required) - The ID of MR
|
||||
def pull_request_changes
|
||||
begin
|
||||
@type = params[:type]
|
||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||
@changes_count = @changes.count
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% unless @changes.blank? %>
|
||||
<% if !@changes.blank? && @type == "3" %>
|
||||
<% @changes.each do |cd| %>
|
||||
<div class="showing-changes-row fontGrey2" style="width:710px;">
|
||||
<a class="linkGrey3" id="changed-files">
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<a href="javascript:void(0);" class="BlueCirBtn mt10" onclick="pull_request_commit()">提交请求</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% @comments.reverse.each do |comment| %>
|
||||
<% @comments.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.created_at) %>前</span>
|
||||
|
|
|
@ -1,29 +1,32 @@
|
|||
<div class="new-merge-row b_grey fontGrey2"><span class="ml10"> 根据最近提交时间排列</span></div>
|
||||
<% @commits.each do |commit| %>
|
||||
<div class="new-merge-wrap">
|
||||
<div class="merge-commit-time">
|
||||
<img width="16" class="ui-datepicker-trigger mr15" style="cursor:default; margin-top:3px; margin-left:0;" /><span class="fontGrey3"><%= format_date(commit.created_at) %></span>
|
||||
<!--<p class="mt10 fontGrey2">1次提交</p>-->
|
||||
<p class="mt10 fontGrey2"><%= link_to commit.author_name, user_path(get_user_by_mail(commit.author_email)), :class => "link-blue" %> 创建于<%= time_tag(commit.created_at) %>前</p>
|
||||
</div>
|
||||
<div class="merge-commit-detail">
|
||||
<span class="fontGrey3 fb"><%= commit.title %></span>
|
||||
<% if !@commits.blank? && @type == "2" %>
|
||||
<% @commits.each do |commit| %>
|
||||
<div class="new-merge-wrap">
|
||||
<div class="merge-commit-time">
|
||||
<img width="16" class="ui-datepicker-trigger mr15" style="cursor:default; margin-top:3px; margin-left:0;" /><span class="fontGrey3"><%= format_date(commit.created_at) %></span>
|
||||
<!--<p class="mt10 fontGrey2">1次提交</p>-->
|
||||
<p class="mt10 fontGrey2"><%= link_to commit.author_name, user_path(get_user_by_mail(commit.author_email)), :class => "link-blue" %> 创建于<%= time_tag(commit.created_at) %>前</p>
|
||||
</div>
|
||||
<div class="merge-commit-detail">
|
||||
<span class="fontGrey3 fb"><%= commit.title %></span>
|
||||
|
||||
</div>
|
||||
<div class="merge-commit-code">
|
||||
</div>
|
||||
<div class="merge-commit-code">
|
||||
<span class="fontGrey3">
|
||||
<%= link_to truncate(commit.short_id, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank" %>
|
||||
</span>
|
||||
</div>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
|
||||
|
|
|
@ -40,19 +40,22 @@
|
|||
</div>
|
||||
|
||||
<ul class="merge-record" style="border-top:1px solid #ddd;">
|
||||
<li><%= link_to "留言<span class='project-number-dot'>#{@comments_count}</span>".html_safe, pull_request_comments_project_pull_request_path(@request.id, :project_id => @project.id), :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), :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), :remote => true %></li>
|
||||
<li><%= link_to "留言<span class='project-number-dot'>#{@comments_count}</span>".html_safe, pull_request_comments_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 => "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 => "3"), :remote => true %></li>
|
||||
</ul>
|
||||
<div id="merge_record_0">
|
||||
<%= render :partial => "pull_requests/pull_request_comments" %>
|
||||
</div>
|
||||
<% if @type == nil || @type == "1" %>
|
||||
<div id="merge_record_0">
|
||||
<%= render :partial => "pull_requests/pull_request_comments" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="merge_record_1" class="undis">
|
||||
<%= render :partial => "pull_requests/pull_request_commits" %>
|
||||
</div>
|
||||
<div id="merge_record_2" class="undis">
|
||||
<%= render :partial => "pull_requests/pull_request_changes" %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue