From 182c861b30c2f71df4a174a1c601fafeb2c5e5b5 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 3 Aug 2016 11:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BApull=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 13 ++- app/views/pull_requests/_form.html.erb | 45 +++++------ app/views/pull_requests/_new.html.erb | 88 +++++++++++++++++++++ app/views/pull_requests/create.html.erb | 2 + app/views/pull_requests/index.html.erb | 2 +- app/views/pull_requests/new.html.erb | 82 +------------------ 6 files changed, 127 insertions(+), 105 deletions(-) create mode 100644 app/views/pull_requests/_new.html.erb create mode 100644 app/views/pull_requests/create.html.erb diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 94e2c180c..dddfda159 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -33,7 +33,18 @@ class PullRequestsController < ApplicationController description = params[:description] source_branch = params[:source_branch] target_branch = params[:target_branch] - g.create_merge_request(@project.gpid, :title => title, :description => description, :source_branch => source_branch, :target_branch => target_branch) + begin + request = @g.create_merge_request(@project.gpid, title, :description => description, :source_branch => source_branch, :target_branch => target_branch) + # respond_to do |format| + # format.html{redirect_to project_pull_requests_path} + # end + rescue Exception => e + @message = e.message + respond_to do |format| + format.html + end + end + @message end def show diff --git a/app/views/pull_requests/_form.html.erb b/app/views/pull_requests/_form.html.erb index 83518bcf7..2c3123748 100644 --- a/app/views/pull_requests/_form.html.erb +++ b/app/views/pull_requests/_form.html.erb @@ -1,22 +1,23 @@ - -
-
标题
-

标题以[WIP]WIP开头:以防还在进程中的合并请求在它完成之前被合并

-
-
描述
-

上传附件

-
-
-
-
源分支
-
-
目标分支
-
-

修改分支

-
-
-
- 提交请求 - 取消 -
-
\ No newline at end of file +<%= form_tag(url_for(:controller => 'pull_requests', :action => 'create', :project_id => @project.id), :id => 'pull_request_form', :method => "post") do %> +
+
标题
+

标题以[WIP]WIP开头:以防还在进程中的合并请求在它完成之前被合并

+
+
描述
+ +
+
+
+
源分支
+
+
目标分支
+
+

修改分支

+
+
+
+ 提交请求 + <%= link_to "返回", project_pull_requests_path(:project_id => @project.id), :class => "fr linkGrey2 mt5 mr10" %> +
+
+<% end %> diff --git a/app/views/pull_requests/_new.html.erb b/app/views/pull_requests/_new.html.erb new file mode 100644 index 000000000..8b2b31964 --- /dev/null +++ b/app/views/pull_requests/_new.html.erb @@ -0,0 +1,88 @@ +<% if @message %> +
+ <%= @message %> +
+<% end %> + +
+
新的合并请求
+
+ dev_huang 合并至 master修改分支 +
+
+
+<%= render :partial => "pull_requests/form" %> + +
根据最近提交时间排列
+
+
+ 2016-08-02 +

1次提交

+
+
+ 第一次提交 +

黄井泉创建于24小时前

+
+ + + + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
9999<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
100100<div class="mt10">
111- <div class="fl mr5 fontGrey3">
111+ <div class="fl mr20 fontGrey3 w80">
+
+
+ + \ No newline at end of file diff --git a/app/views/pull_requests/create.html.erb b/app/views/pull_requests/create.html.erb new file mode 100644 index 000000000..f51a0e654 --- /dev/null +++ b/app/views/pull_requests/create.html.erb @@ -0,0 +1,2 @@ +<%= render :partial => "pull_requests/new" %> + diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index d81308f19..37ea937fd 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -4,7 +4,7 @@
  • 合并1
  • 关闭1
  • 全部3
  • - 新建请求 + <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
    diff --git a/app/views/pull_requests/new.html.erb b/app/views/pull_requests/new.html.erb index 7c09d3159..8df8982b3 100644 --- a/app/views/pull_requests/new.html.erb +++ b/app/views/pull_requests/new.html.erb @@ -1,82 +1,2 @@ -
    -
    新的合并请求
    -
    - dev_huang 合并至 master修改分支 -
    -
    -
    -<%= render :partial => "pull_requests/form" %> - -
    根据最近提交时间排列
    -
    -
    - 2016-08-02 -

    1次提交

    -
    -
    - 第一次提交 -

    黄井泉创建于24小时前

    -
    -
    - 5202e2ef -

    浏览文件

    -
    -
    -
    -
    - - -
    - - - - - - - - - - - - - - - - - - - - - -
    9999<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
    100100<div class="mt10">
    111- <div class="fl mr5 fontGrey3">
    111+ <div class="fl mr20 fontGrey3 w80">
    -
    -
    +<%= render :partial => "pull_requests/new" %> - \ No newline at end of file