相同分支和项目消息JS提示
This commit is contained in:
parent
3df8a46634
commit
8eaeea299a
|
@ -41,4 +41,10 @@ module PullRequestsHelper
|
|||
end
|
||||
end
|
||||
|
||||
# 判断是否允许创建Pull Request
|
||||
# 如果分支相同,并且项目相同则提示
|
||||
def judge_pr_allow
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -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 %>
|
||||
<select onchange="choice_branch(this.value, document.getElementById('pull_request_branch'), <%= @source_rev %>, <%= @forked_rev %>);" name="source_project" value="source_project" class="ml30 fontGrey3 fb fl" style = "padding:5px 0 5px 5px;">
|
||||
<option value="source_project_name"><%= @source_project_name %></option>
|
||||
<option value="forked_project_name"><%= @forked_project_name %></option>
|
||||
<select onchange="choice_branch(this.value, document.getElementById('pull_request_branch'), <%= @source_rev %>, <%= @forked_rev %>);" id="pull_request_project" name="source_project" value="source_project" class="ml30 fontGrey3 fb fl" style = "padding:5px 0 5px 5px;">
|
||||
<option name="<%= @project.id %>" value="source_project_name" ><%= @source_project_name %></option>
|
||||
<option name="<%= @forked_project.id %>" value="forked_project_name" ><%= @forked_project_name %></option>
|
||||
</select>
|
||||
<select name="target_branch" id="pull_request_branch" class = "ml30 fontGrey3 fb fl" style = "width:140px; padding:5px 0 5px 5px;">
|
||||
<% @source_rev.each do |rev| %>
|
||||
|
@ -25,8 +25,9 @@
|
|||
<% end %>
|
||||
</select>
|
||||
<% end %>
|
||||
<p id="pull_request_project_hidden" style="display: none"><%= @forked_project.nil? ? "" : @project.id %></p>
|
||||
<div class="cl"></div>
|
||||
<p id ="pull_request_branch_error" class="ml100 fontGrey2 mt5 c_red" style="display: none">同一个项目的源分支和目标分支不能相同</p>
|
||||
<p id ="pull_request_branch_error" class="ml100 fontGrey2 mt5 c_red" style="display: none">没有内容可以合并,请切换一个不同的分支</p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="new-merge-row b_grey" style="border-top:1px solid #ddd;">
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue