先建pull request及局部刷新

This commit is contained in:
huang 2016-08-04 10:08:13 +08:00
parent 2e91da4f28
commit a62ede1a33
5 changed files with 12 additions and 13 deletions

View File

@ -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

View File

@ -0,0 +1,5 @@
<% if @message %>
<div class="flash error">
<%= @message %>
</div>
<% end %>

View File

@ -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>

View File

@ -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>

View File

@ -0,0 +1 @@
$("#create_pull_request_error").html('<%= escape_javascript(render :partial => "pull_requests/error_message") %>');