From bff5a36577f3b3049c4aac71277b164cfd91b8dc Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 25 Nov 2016 11:32:45 +0800 Subject: [PATCH] =?UTF-8?q?pull=20request=E5=90=84=E7=A7=8D=E6=83=85?= =?UTF-8?q?=E5=86=B5=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA=20=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E9=A1=B6=E5=A4=B4=E7=9A=84fork=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=96=B0=E9=A1=B5=E9=9D=A2=E5=8F=8A=E9=BC=A0?= =?UTF-8?q?=E6=A0=87=E7=BB=8F=E8=BF=87=E6=89=8B=E5=9E=8B=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 2 +- app/views/layouts/_base_project_top.html.erb | 4 ++-- app/views/pull_requests/_show.html.erb | 10 +--------- app/views/pull_requests/_show_container.html.erb | 11 +++++++++++ public/stylesheets/css/project.css | 4 ++-- 5 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 app/views/pull_requests/_show_container.html.erb diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index a71f9c105..e4a2dc9df 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -227,7 +227,7 @@ class PullRequestsController < ApplicationController # Gets the comments on a merge request. # # @example - # Gitlab.merge_request_comments(5, 1) + # Gitlab.merge_request_comments(5, 1) def pull_request_comments begin @comments = @g.merge_request_comments(@project.gpid, params[:id]).reverse diff --git a/app/views/layouts/_base_project_top.html.erb b/app/views/layouts/_base_project_top.html.erb index afd78117a..d6c704aa0 100644 --- a/app/views/layouts/_base_project_top.html.erb +++ b/app/views/layouts/_base_project_top.html.erb @@ -19,8 +19,8 @@
<% unless @project.forked_from_project_id.nil? %>
- forked from <%=link_to "#{get_fork_from_project(@project.forked_from_project_id).owner.try(:show_name)}/".html_safe, user_path(get_fork_from_project(@project.forked_from_project_id).owner), :class => "pro_new_username_fork fl" %> - <%=link_to get_fork_from_project(@project.forked_from_project_id).name, project_path(get_fork_from_project(@project.forked_from_project_id)), :class => "pro_new_username_fork fl" %> + forked from <%=link_to "#{get_fork_from_project(@project.forked_from_project_id).owner.try(:show_name)}/".html_safe, user_path(get_fork_from_project(@project.forked_from_project_id).owner), :class => "pro_new_username_fork fl", :target => "_blank" %> + <%=link_to get_fork_from_project(@project.forked_from_project_id).name, project_path(get_fork_from_project(@project.forked_from_project_id)), :class => "pro_new_username_fork fl", :target => "_blank" %>
<% end %> diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index a7dbc91f1..adf0ded0c 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -31,15 +31,7 @@ 改动已合并至 <%= @request.target_branch %> 分支 <% else %> - <% if is_project_manager?(User.current.id, @project.id) %> - <% if @request.state == "closed" %> - 该请求已被关闭 - <% else %> -
- 在管理员接受后,将由系统自动合并。<%= link_to "接受", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "linkBlue2", :remote => true %> -
- <% end %> - <% end %> + <%= render "show_container" %> <% end %> diff --git a/app/views/pull_requests/_show_container.html.erb b/app/views/pull_requests/_show_container.html.erb new file mode 100644 index 000000000..0e5356566 --- /dev/null +++ b/app/views/pull_requests/_show_container.html.erb @@ -0,0 +1,11 @@ +<% if @request.state == "closed" %> + 该请求已被关闭 +<% elsif @commits_count == 0 %> + 项目分支 <%= @request.source_branch %> 和 <%= @request.target_branch %> 似乎没有差异,请将新改动提交至源分支或者切换到其它目标分支 +<% else %> + <% if is_project_manager?(User.current.id, @project.id) %> +
+ 在管理员接受后,将由系统自动合并。<%= link_to "接受", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "linkBlue2", :remote => true %> +
+ <% end %> +<% end %> diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 33d6d1dbf..5af60925c 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -860,8 +860,8 @@ input.pro_newissue_con_check{ width: 15px; height: 15px;} .pro_new_top {padding-top:15px; border:1px solid #ddd; background-color:#fff; width: 998px;} .icons_newpro_lock{width: 22px; height: 23px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 -113px no-repeat;} .pro_new_name{width: 600px; } -a.pro_new_username { font-size: 20px; color: #3b94d6; line-height: 24px; cursor: default;} -a.pro_new_username_fork { font-size: 12px; color: #3b94d6; line-height: 24px; cursor: default;} +a.pro_new_username { font-size: 20px; color: #3b94d6; line-height: 24px;} +a.pro_new_username_fork { font-size: 12px; color: #3b94d6; line-height: 24px;} a.pro_new_proname{ overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;} a.pro_new_project_name{ width: 250px; overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;} a.pro_new_topbtn{ padding: 3px 7px; font-size: 12px; line-height: 20px; color: #333;vertical-align: middle;background-color: #fff; border: 1px solid #ddd; border-left: 0; border-top-right-radius: 3px; border-bottom-right-radius: 3px; color: #333;}