diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index efa060434..2d77c21d4 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -75,10 +75,13 @@ class PullRequestsController < ApplicationController # @param [Integer] id The ID of a merge request. # @return [Gitlab::ObjectifiedHash] def accept_pull_request - commit_id = parmas[:commit_id] - status = @g.accept_merge_rquest(@project.gpid, commit_id) - if status == '200' - # 需跳入的地方 + begin + status = @g.accept_merge_rquest(@project.gpid, params[:id]) + respond_to do |format| + format.js{redirect_to project_pull_request_path(status.id, :project_id => @project.id)} + end + rescue Exception => e + @message = e.message end end diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index 0ba02d9b4..4aac6193c 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -1,45 +1,52 @@ -
- <%= @request.state == "merged" ? "已合并" : "待处理" %>合并请求 由<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %>提交 · 最后编辑时间<%= time_tag(@request.updated_at) %> - -
+
+ <%= render :partial => "pull_requests/error_message" %>
-
<%= @request.title %>

<%= @request.description %>

-<% if @commits_count == 0 && @changes_count == 0 %> -
- 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> -
- <%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %>
-

请将新改动提交至源分支或者切换到其它目标分支

+ +
+
+ <%= @request.state == "merged" ? "已合并" : "待处理" %>合并请求 由<%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %>提交 · 最后编辑时间<%= time_tag(@request.updated_at) %> + +
+
+
<%= @request.title %>

<%= @request.description %>

+ <% if @commits_count == 0 && @changes_count == 0 %> +
+ 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> +
+ <%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %>
+

请将新改动提交至源分支或者切换到其它目标分支

+
-
-<% else %> - <% if @request.state == "merged" %> + <% else %> + <% if @request.state == "merged" %> - 6666 - <% else %> -
- 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> -
- <%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn" %> + 6666 + <% else %> +
+ 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> +
+ <%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :remote => true, :class => "BlueCirBtn" %> +
-
- <% end %> -
    -
  • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %>
  • -
  • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %>
  • -
-
根据最近提交时间排列
-
- <%= render :partial => "pull_requests/pull_request_commits" %> -
-
- <%= render :partial => "pull_requests/pull_request_changes" %> -
-<% end %> + <% end %> +
    +
  • <%= link_to "提交#{@commits_count}".html_safe, pull_request_commits_project_pull_request_path(@request.id, :project_id => @project.id, :type => 1), :remote => true, :class => "active" %>
  • +
  • <%= link_to "改动#{@changes_count}".html_safe, pull_request_changes_project_pull_request_path(@request.id, :project_id => @project.id, :type => 2), :remote => true %>
  • +
+
根据最近提交时间排列
+
+ <%= render :partial => "pull_requests/pull_request_commits" %> +
+
+ <%= render :partial => "pull_requests/pull_request_changes" %> +
+ <% end %> +
+