From 21747d02a2413607c722070c29d1cfc9f6a76af9 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 4 Aug 2016 11:13:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BAPR=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=8EJS=E8=B7=B3=E8=BD=ACHTML=E8=B7=B3=E8=BD=AC=EF=BC=8C?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=A1=B5=E9=9D=A2=E5=B1=80=E9=83=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0=EF=BC=8C=E5=8F=8A=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 4 +-- app/views/pull_requests/_new.html.erb | 19 +++++------ app/views/pull_requests/_show.html.erb | 43 +++++++++++++++++++++++++ app/views/pull_requests/create.js.erb | 2 +- app/views/pull_requests/new.html.erb | 3 +- app/views/pull_requests/show.html.erb | 44 +------------------------- app/views/pull_requests/show.js.erb | 1 + 7 files changed, 58 insertions(+), 58 deletions(-) create mode 100644 app/views/pull_requests/_show.html.erb create mode 100644 app/views/pull_requests/show.js.erb diff --git a/Gemfile b/Gemfile index 1c1edfd35..6ee66a592 100644 --- a/Gemfile +++ b/Gemfile @@ -50,10 +50,10 @@ gem 'elasticsearch-model' gem 'elasticsearch-rails' #rails 3.2.22.2 bug -gem "test-unit", "~>3.0" +# gem "test-unit", "~>3.0" ### profile -gem 'oneapm_rpm' +# gem 'oneapm_rpm' group :development do gem 'grape-swagger' diff --git a/app/views/pull_requests/_new.html.erb b/app/views/pull_requests/_new.html.erb index 16f299ca5..54c7434b0 100644 --- a/app/views/pull_requests/_new.html.erb +++ b/app/views/pull_requests/_new.html.erb @@ -1,19 +1,16 @@ -
+
+
<%= render :partial => "pull_requests/error_message" %> -
+
-
-
新的合并请求
- - - - +
+
新的合并请求
+
+ <%= render :partial => "pull_requests/form" %>
-<%= render :partial => "pull_requests/form" %> - \ No newline at end of file diff --git a/app/views/pull_requests/create.js.erb b/app/views/pull_requests/create.js.erb index 36c9368af..ce5f50ac0 100644 --- a/app/views/pull_requests/create.js.erb +++ b/app/views/pull_requests/create.js.erb @@ -1 +1 @@ -$("#create_pull_request_error").html('<%= escape_javascript(render :partial => "pull_requests/error_message") %>'); \ No newline at end of file +$("#create_pull_request_error").html('<%= escape_javascript(render :partial => "pull_requests/error_message") %>'); diff --git a/app/views/pull_requests/new.html.erb b/app/views/pull_requests/new.html.erb index 47ba66f09..e7494708c 100644 --- a/app/views/pull_requests/new.html.erb +++ b/app/views/pull_requests/new.html.erb @@ -1,2 +1,3 @@ <%= render :partial => "pull_requests/pull_request_container" %> -<%= render :partial => "pull_requests/new" %> \ No newline at end of file +<%= render :partial => "pull_requests/new" %> + diff --git a/app/views/pull_requests/show.html.erb b/app/views/pull_requests/show.html.erb index 2564dda77..8cbbdc081 100644 --- a/app/views/pull_requests/show.html.erb +++ b/app/views/pull_requests/show.html.erb @@ -1,44 +1,2 @@ <%= render :partial => "pull_requests/pull_request_container" %> -
- 待处理合并请求 由<%= 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 %>

-
- 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> -
- <%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn" %> -
-
- -
根据最近提交时间排列
-
- <%= render :partial => "pull_requests/pull_request_commits" %> -
-
- <%= render :partial => "pull_requests/pull_request_changes" %> -
- - \ No newline at end of file +<%= render :partial => "pull_requests/show" %> \ No newline at end of file diff --git a/app/views/pull_requests/show.js.erb b/app/views/pull_requests/show.js.erb new file mode 100644 index 000000000..af5935536 --- /dev/null +++ b/app/views/pull_requests/show.js.erb @@ -0,0 +1 @@ +$("#pull_request_new_form").html('<%= escape_javascript(render :partial => "pull_requests/show") %>'); \ No newline at end of file From 1f5c4a800f4c6a1ae57e8d0c5c4ae087c650a8e6 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 4 Aug 2016 11:35:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=97=B6=E5=80=99=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_pull_request_commits.html.erb | 3 +- app/views/pull_requests/_show.html.erb | 44 ++++++++++++------- app/views/pull_requests/show.html.erb | 4 -- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/app/views/pull_requests/_pull_request_commits.html.erb b/app/views/pull_requests/_pull_request_commits.html.erb index ffccccd8d..a7f6b5aa7 100644 --- a/app/views/pull_requests/_pull_request_commits.html.erb +++ b/app/views/pull_requests/_pull_request_commits.html.erb @@ -3,10 +3,11 @@
<%= format_date(commit.created_at) %> +

<%= link_to commit.author_name, user_path(get_user_by_mail(commit.author_email)), :class => "link-blue" %>创建于<%= time_tag(commit.created_at) %>前

<%= commit.title %> -

<%= link_to commit.author_name, user_path(get_user_by_mail(commit.author_email)), :class => "link-blue" %>创建于24小时前

+
diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index 3015a4d7a..7ebdc1dde 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -4,23 +4,33 @@
<%= @request.title %>

<%= @request.description %>

-
- 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> -
- <%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn" %> -
-
-
    -
  • <%= 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" %> -
+<% if @commits_count == 0 && @changes_count == 0 %> +
+ 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> +
+ <%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %>
+

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

+
+
+<% else %> +
+ 请求将 <%= @request.source_branch %> 合并至 <%= @request.target_branch %> +
+ <%= link_to "接受请求", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "BlueCirBtn" %> +
+
+
    +
  • <%= 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 %>