先建pull request及局部刷新
This commit is contained in:
parent
2e91da4f28
commit
a62ede1a33
|
@ -47,17 +47,12 @@ class PullRequestsController < ApplicationController
|
|||
target_branch = params[:target_branch]
|
||||
begin
|
||||
request = @g.create_merge_request(@project.gpid, title, :description => description, :source_branch => source_branch, :target_branch => target_branch)
|
||||
e.message
|
||||
respond_to do |format|
|
||||
format.html{redirect_to project_pull_requests_path(request.id, :source_branch => source_branch, :target_branch => target_branch)}
|
||||
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
||||
end
|
||||
rescue Exception => e
|
||||
@message = e.message
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
@message
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<% if @message %>
|
||||
<div class="flash error">
|
||||
<%= @message %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_tag(url_for(:controller => 'pull_requests', :action => 'create', :project_id => @project.id), :id => 'pull_request_form', :method => "post") do %>
|
||||
<%= form_tag(url_for(:controller => 'pull_requests', :action => 'create', :project_id => @project.id), :id => 'pull_request_form', :method => "post", :remote => true) do %>
|
||||
<div class="new-merge-wrap">
|
||||
<div class="merge-option-name fl mt8">标题</div><input type="text" name="title" class="merge-title-input fl ml30" />
|
||||
<!--<p class="fl ml100 fontGrey2 mt5">标题以<span class="c_red">[WIP]</span>或<span class="c_red">WIP</span>开头:以防还在进程中的合并请求在它完成之前被合并</p>-->
|
||||
|
@ -13,7 +13,7 @@
|
|||
<!--<select name="source_branch" value="source_branch" class="ml30 fontGrey3 fb fl"><option>master</option><option>develop</option><option>rep_quality</option></select>-->
|
||||
<div class="cl mb10"></div>
|
||||
<div class="merge-option-name fl">目标分支</div>
|
||||
<%= select_tag :branch, options_for_select(@rev), :name => "source_branch", :value => "source_branch", :class => "ml30 fontGrey3 fb fl" %>
|
||||
<%= select_tag :branch, options_for_select(@rev), :name => "target_branch", :value => "target_branch", :class => "ml30 fontGrey3 fb fl" %>
|
||||
<!--<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>-->
|
||||
<div class="cl"></div>
|
||||
<p class="fl ml100 mt10"><a href="javascript:void(0);" class="fr linkGrey2">修改分支</a></p>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<% if @message %>
|
||||
<div class="flash error">
|
||||
<%= @message %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="create_pull_request_error">
|
||||
<%= render :partial => "pull_requests/error_message" %>
|
||||
</div>
|
||||
|
||||
<div id="new-merge-request" class="new-merge-request">
|
||||
<div class="f14 fontGrey3 fb mb10">新的合并请求</div>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#create_pull_request_error").html('<%= escape_javascript(render :partial => "pull_requests/error_message") %>');
|
Loading…
Reference in New Issue