67 lines
3.3 KiB
Plaintext
67 lines
3.3 KiB
Plaintext
<%= form_tag(url_for(:controller => 'pull_requests', :action => 'create', :project_id => @project.id, :forked_project_id => @forked_project.try(:gpid)), :id => 'pull_request_form', :method => "post", :remote => true) do %>
|
|
<div class="new-merge-wrap">
|
|
<div class="merge-option-name fl mt8"><span class="c_red">*</span>标题</div><input type="text" id="pr_name" name="title" class="merge-title-input fl ml30" />
|
|
<p id ="pull_request_title" class="fl ml100 fontGrey2 mt5 c_red" style="display: none">标题不能为空</p>
|
|
<div class="cl mb10"></div>
|
|
<div class="merge-option-name fl">描述</div><textarea type="text" name="description" class="merge-description-input fl ml30"></textarea>
|
|
<!--<p class="fl ml100 f12 mt5"><a href="javascript:void(0);" class="AnnexBtn fl mr10">上传附件</a></p>-->
|
|
<div class="cl"></div>
|
|
</div>
|
|
<div class="new-merge-wrap borderBottomNone">
|
|
<div class="merge-option-name fl" style="padding:5px 0">源分支</div>
|
|
<%= select_tag :branch, options_for_select(@source_rev), :name => "source_branch", :value => "source_branch", :class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %>
|
|
<div class="cl mb10"></div>
|
|
<div class="merge-option-name fl" style="padding:5px 0">目标分支</div>
|
|
<% if @forked_project.nil? %>
|
|
<%= select_tag :branch, options_for_select(@source_rev), :name => "target_branch", :value => "target_branch",:class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;", :id => "targetBranch" %>
|
|
<% 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>
|
|
<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| %>
|
|
<option value="<%= rev %>"><%= rev %></option>
|
|
<% end %>
|
|
</select>
|
|
<% end %>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<div class="new-merge-row b_grey" style="border-top:1px solid #ddd;">
|
|
<a href="javascript:void(0);" class="BlueCirBtn fl ml10" onclick="pull_request_commit()">提交请求</a>
|
|
<%= link_to "返回", project_pull_requests_path(:project_id => @project.id), :class => "fr linkGrey2 mt5 mr10" %>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<script>
|
|
function regex_pr_name()
|
|
{
|
|
var name = $.trim($("#pr_name").val());
|
|
if(name.length == 0)
|
|
{
|
|
$("#pull_request_title").show();
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
$("#pull_request_title").hide();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
//提交pull request
|
|
function pull_request_commit()
|
|
{
|
|
if(regex_pr_name())
|
|
{
|
|
$("#pull_request_form").submit();
|
|
}
|
|
}
|
|
|
|
//切换项目时,替换分支
|
|
$("#targetProject").change(function(){
|
|
var defaultBranch = $("#targetBranch option:first-child").val();
|
|
$("#targetBranch").val(defaultBranch);
|
|
});
|
|
</script> |