自身分支创建PR修改

This commit is contained in:
huang 2016-08-05 14:19:09 +08:00
parent 4ec8cc9a50
commit b62ac02c15
2 changed files with 4 additions and 4 deletions

View File

@ -60,7 +60,7 @@ class PullRequestsController < ApplicationController
target_branch = params[:target_branch] target_branch = params[:target_branch]
begin begin
# 如果传送了目标项目ID则PR请求发至目标项目 # 如果传送了目标项目ID则PR请求发至目标项目
if params[:forked_project_id] if params[:forked_project_id] && params[:source_project] == "forked_project_name"
target_project_id = params[:target_project_id] target_project_id = params[:target_project_id]
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id) request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id)
else else

View File

@ -15,13 +15,13 @@
<% if @forked_project.nil? %> <% 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" %> <%= 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 %> <% else %>
<select onchange="choice_branch(this.value, document.getElementById('pull_request_branch'), <%= @source_rev %>, <%= @forked_rev %>);" name="source_branch" value="source_branch" class="ml30 fontGrey3 fb fl" style = "padding:5px 0 5px 5px;"> <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="source_project_name"><%= @source_project_name %></option>
<option value="forked_project_name"><%= @forked_project_name %></option> <option value="forked_project_name"><%= @forked_project_name %></option>
</select> </select>
<select name="branch" id="pull_request_branch" class = "ml30 fontGrey3 fb fl" style = "width:140px; padding:5px 0 5px 5px;"> <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| %> <% @source_rev.each do |rev| %>
<option value="source_project_name"><%= rev %></option> <option value="<%= rev %>"><%= rev %></option>
<% end %> <% end %>
</select> </select>
<% end %> <% end %>