socialforge/app/views/pull_requests/_form.html.erb

61 lines
3.1 KiB
Plaintext
Raw Normal View History

2016-08-04 10:08:13 +08:00
<%= form_tag(url_for(:controller => 'pull_requests', :action => 'create', :project_id => @project.id), :id => 'pull_request_form', :method => "post", :remote => true) do %>
2016-08-03 11:07:49 +08:00
<div class="new-merge-wrap">
<div class="merge-option-name fl mt8">标题</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>
2016-08-03 11:07:49 +08:00
<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(@rev), :name => "source_branch", :value => "source_branch", :class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;" %>
2016-08-03 17:37:37 +08:00
<!--<select name="source_branch" value="source_branch" class="ml30 fontGrey3 fb fl"><option>master</option><option>develop</option><option>rep_quality</option></select>-->
2016-08-03 11:07:49 +08:00
<div class="cl mb10"></div>
<div class="merge-option-name fl" style="padding:5px 0">目标分支</div>
2016-08-04 18:30:04 +08:00
<% unless @target_project.blank? %>
<%= select_tag :branch, options_for_select(@target_project), :name => "target_project", :value => "target_project", :class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;", :id => "targetProject" %>
<% end %>
<%= select_tag :branch, options_for_select(@rev), :name => "target_branch", :value => "target_branch", :class => "ml30 fontGrey3 fb fl", :style => "padding:5px 0 5px 5px;", :id => "targetBranch" %>
2016-08-04 18:30:04 +08:00
2016-08-03 17:37:37 +08:00
<!--<select name="target_branch" value="source_branch" class="ml30 fontGrey3 fb fl"><option>master</option><option>hjq_course</option><option>hjq_beidou</option><option>develop</option><option>dev_huang</option></select>-->
2016-08-03 11:07:49 +08:00
<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>
2016-08-03 11:07:49 +08:00
<%= 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>