From 8eaeea299ae7ca7f5ff5e784faf9f0c7c1544e19 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 11 Aug 2016 15:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=90=8C=E5=88=86=E6=94=AF=E5=92=8C?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=B6=88=E6=81=AFJS=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/pull_requests_helper.rb | 6 ++++++ app/views/pull_requests/_form.html.erb | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/helpers/pull_requests_helper.rb b/app/helpers/pull_requests_helper.rb index 03c8358ab..07b022358 100644 --- a/app/helpers/pull_requests_helper.rb +++ b/app/helpers/pull_requests_helper.rb @@ -41,4 +41,10 @@ module PullRequestsHelper end end + # 判断是否允许创建Pull Request + # 如果分支相同,并且项目相同则提示 + def judge_pr_allow + + end + end diff --git a/app/views/pull_requests/_form.html.erb b/app/views/pull_requests/_form.html.erb index d5de31723..a276ea65c 100644 --- a/app/views/pull_requests/_form.html.erb +++ b/app/views/pull_requests/_form.html.erb @@ -15,9 +15,9 @@ <% if @forked_project.nil? %> <%= select_tag :branch, options_for_select(@source_rev), :id => "pull_request_branch", :name => "target_branch", :value => "target_branch",:class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %> <% else %> - + + <% end %> +
- +
@@ -56,7 +57,9 @@ { var source_branch = $.trim($("#source_branch").val()); var target_branch = $.trim($("#pull_request_branch").val()); - if(source_branch == target_branch) + var target_project = $.trim($("#pull_request_project").children().attr("name")); + var target_forked_project = $.trim($("#pull_request_project_hidden").text()); + if(target_project == target_forked_project && source_branch == target_branch) { $("#pull_request_branch_error").show(); return false; @@ -71,7 +74,7 @@ //提交pull request function pull_request_commit() { - if(regex_pr_name()) + if(regex_pr_name() && regex_branch()) { $("#pull_request_form").submit(); }