新版pull 新建功能

This commit is contained in:
huang 2016-10-21 10:32:38 +08:00
parent 4b2f0d4bca
commit 733a91d160
5 changed files with 117 additions and 41 deletions

View File

@ -1,41 +1,51 @@
<%= 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), :id => "source_branch", :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), :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 %>);" 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| %>
<option value="<%= rev %>"><%= rev %></option>
<div class="new_roadmap_conbox mb10" >
<div class="new_roadmap_info_top clear ">
<h4 class=" new_roadmap_listtitle"> 新建Pull Request </h4>
</div>
<%= 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="clear new_roadmap_listbox">
<ul class="PullReques_new_box ">
<li class="mb10 clear">
<label class=" fl PullReques_label">&nbsp;源分支&nbsp;&nbsp;:&nbsp;</label>
<%= select_tag :branch, options_for_select(@source_rev), :id => "source_branch", :name => "source_branch", :value => "source_branch", :class => "fl PullReques_minselect" %>
<label class=" fl ml10 ">&nbsp; 合并到目标分支&nbsp;&nbsp;:&nbsp;</label>
<% if @forked_project.nil? %>
<%= select_tag :branch, options_for_select(@source_rev), :id => "pull_request_branch", :name => "target_branch", :value => "target_branch",:class => "fl PullReques_minselect ml5" %>
<% else %>
<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="fl PullReques_minselect">
<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 = "fl PullReques_minselect ml5" >
<% @source_rev.each do |rev| %>
<option value="<%= rev %>"><%= rev %></option>
<% end %>
</select>
<% 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>
<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 %>
<p id="pull_request_project_hidden" style="display: none"><%= @forked_project.nil? ? "" : @project.id %></p>
</li>
<div class="alert alert-blue mb10" id ="pull_request_branch_error" style="display: none">
<span class="c_orange">您选择的源分支和目标分支为似乎没有差异,请将新改动提交至源分支或者切换到其它目标分支</span>
</div>
<li class="mb10 clear">
<label class=" fl PullReques_label"><span class="c_red f12">*</span>&nbsp;标题&nbsp;&nbsp;:&nbsp;</label>
<input type="text" id="pr_name" name="title" class="fl PullReques_maxinput" placeholder="请输入合并请求的标题" />
</li>
<div class="c_orange pl62 mb4" id ="pull_request_title" style="display: none">
标题不能为空
</div>
<li class=" clear">
<label class=" fl PullReques_label">&nbsp;描述&nbsp;&nbsp;:&nbsp;</label>
<textarea type="text" name="description" class="PullReques_textarea fl mb10" placeholder="在此输入合并请求的描述"></textarea>
</li>
<li class="mb10 clear">
<%= link_to "返回", project_pull_requests_path(:project_id => @project.id), :class => "btn btn-grey fr" %>
<a href="javascript:void(0);" class="btn btn-blue fr mr5" onclick="pull_request_commit()">确定</a>
</li>
</ul>
</div>
<% end %>
</div>
<script>
function regex_pr_name()
@ -74,7 +84,7 @@
//提交pull request
function pull_request_commit()
{
if(regex_pr_name() && regex_branch())
if(regex_branch() && regex_pr_name())
{
$("#pull_request_form").submit();
}

View File

@ -1,3 +1,28 @@
<%= render :partial => "pull_requests/pull_request_container" %>
<%= render :partial => "pull_requests/new" %>
<div id="pull_request_new_form">
<div id="create_pull_request_error">
<%= render :partial => "pull_requests/error_message" %>
</div>
<%= render :partial => "pull_requests/form" %>
</div>
<script>
// $("#pull_request_new_form").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
$("#changed-files").toggle(function(){
$("#changed-files-detail").show();
},function(){
$("#changed-files-detail").hide();
});
$(".merge-record li a").click(function(){
$(".merge-record li a").removeClass("active");
$(this).addClass("active");
var index = $(".merge-record li a").index(this);
$("#merge_record_0, #merge_record_1").hide();
$("#merge_record_" + index).show();
});
</script>

View File

@ -214,6 +214,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.pl10 {padding-left:10px;}
.pr5 {padding-right:5px;}
.pr10{padding-right: 10px;}
.pl62 {padding-left: 62px;}
.pl15{ padding-left:15px;}
.pt5{ padding-top:5px;}
.pt10{ padding-top:10px;}

View File

@ -970,4 +970,43 @@ select.new_roadmap_select{border:1px solid #dbdbdb; color: #666;}
.new_roadmap_table tbody tr td{ height:40px; line-height:40px; border-bottom:1px solid #e5e5e5; color:#888;}
.new_roadmap_table td{ padding:0 5px;}
/*模板图标20161020byLB*/
.muban-icons-clock{ background: url("/images/new_project/icons_issue.png") 0 -224px no-repeat; display: inline-block; width: 19px; height: 13px;}
.muban-icons-clock{ background: url("/images/new_project/icons_issue.png") 0 -224px no-repeat; display: inline-block; width: 19px; height: 13px;}
/* pullreques 20161020byLB */
.pullreques_category{ height: 35px; line-height: 35px;background: #f0f0f0; }
.pullreques span{ float: left;}
a.sortupbtn{ background: url(/images/sy/liststyle.png) 0 3px no-repeat;width:12px;height:17px; display:block; margin-right:10px; cursor:pointer;}
a.sortdownbtn{background: url(/images/sy/liststyle.png) 0 -12px no-repeat; width:12px; height:17px;display:block;cursor:pointer; }
.icons_pullreques{background: url(/images/project/icons_issue.png) 0 -270px no-repeat; display: inline-block; width: 25px; height: 25px;}
.pullreques_blueicon{ background: url(/images/project/icons_issue.png) 0 -299px no-repeat; display: inline-block; width: 43px; height: 16px;}
.pullreques_greyicon{ background: url(/images/project/icons_issue.png) 0 -322px no-repeat; display: inline-block; width: 43px; height: 16px;}
.pullreques_greyicon02{ background: url(/images/project/icons_issue.png) 0 -344px no-repeat; display: inline-block; width:32px; height: 16px;}
.pullreques_reply_textarea{ width: 100%; padding:0; height: 60px; color: #666;}
.pullreques_reply_list li{ padding:15px 0; border-top: 1px dashed #ddd; }
.pullreques_reply_user_img{ width:50px;height:50px; -webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;}
a.pullreques_reply_name{ font-weight: bold; color: #333;}
.pullreques_reply_txt{ width: 900px;color: #666;}
.pullreques_pull_top { width: 100%; height: 40px; line-height: 40px; background: #f4f4f4; border-top:1px solid #e1e1e1;border-bottom:1px solid #e1e1e1;}
a.pullreques_pull_name{display: block; margin-left: 10px;max-width:80px; color:#3b94d6; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;}
.pullreques_pull_list li{ height: 30px; line-height: 30px; }
.pullreques_pull_txt{display: block; margin-left: 10px;max-width:740px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;}
.pullreques_change_list li{height: 40px; line-height: 40px;border-bottom:1px solid #e1e1e1; }
.pullreques_change_list li:last-child{ border-bottom: none;}
.pullreques_icons_add{background: url(/images/project/icons_issue.png) 0 -374px no-repeat; display: inline-block; width: 19px; height: 16px;}
.pullreques_icons_del{background: url(/images/project/icons_issue.png) 0 -399px no-repeat; display: inline-block; width: 19px; height: 16px;}
.pullreques_icons_new{background: url(/images/project/icons_issue.png) 0 -421px no-repeat; display: inline-block; width: 19px; height: 16px;}
.PullReques_minselect{border:1px solid #e1e1e1; height: 30px; line-height: 30px; width: 262px;color: #666;}
.PullReques_maxinput{ width:900px;border:1px solid #e1e1e1; height: 30px; line-height: 30px; color: #666;}
.PullReques_textarea{width:900px;border:1px solid #e1e1e1; height: 80px; line-height: 1.9; color: #666;}
.PullReques_new_box li{ height: 30px; line-height: 30px; color: #666;}
.PullReques_label{ width: 60px; text-align: right;}
.PullReques_new_box input:focus,select:focus{border:1px solid #e1e1e1;}
/*模板form 20161013byLB*/
textarea.muban_textarea{ width: 98.5%;border:1px solid #ddd; background:#fff; color:#666; padding:5px;}
/*提示条20161020byLB*/
.alert{ padding:10px;border: 1px solid transparent; text-align: center;}
.alert-blue{ background-color: #d9edf7;border-color: #bce8f1; color: #3a87ad;}
.alert-orange{ background-color: #fff9e9;border-color: #f6d0b1; color:#ee4a20;}
.close{padding: 0;cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; font-size: 21px; font-weight: bold;line-height: 1; color: #000000; text-shadow: 0 1px 0 #ffffff; opacity: 0.3;}
.close:hover{opacity: 0.5;}

View File

@ -142,6 +142,7 @@ h4{ font-size:14px; }
.mb20{ margin-bottom:20px;}
.mb30 {margin-bottom:30px;}
.mb40 {margin-bottom:40px;}
.pl62 {padding-left: 62px;}
.pl10 {padding-left:10px;}
.pl15{ padding-left:15px;}
.pl5{ padding-left:5px;}