From 0a9224d036dd2b8e08820b453ff6d1e4584a772c Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 3 Aug 2016 14:43:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E6=AC=A1=E8=AF=B7=E6=B1=82=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/pull_requests_controller.rb | 9 ++-- .../_pull_request_changes.html.erb | 32 +++++++++++++ .../_pull_request_commits.html.erb | 16 +++++++ .../pull_requests/pull_request_commits.js.erb | 1 + app/views/pull_requests/show.html.erb | 47 +------------------ .../lib/gitlab/client/merge_requests.rb | 2 +- 6 files changed, 57 insertions(+), 50 deletions(-) create mode 100644 app/views/pull_requests/_pull_request_changes.html.erb create mode 100644 app/views/pull_requests/_pull_request_commits.html.erb diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 8d49207ee..9eb870b92 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,6 +1,6 @@ class PullRequestsController < ApplicationController before_filter :find_project_and_repository - before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pll_request, :pull_request_commits, :pull_request_changes] + before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes] layout "base_projects" # 返回json格式 @@ -49,6 +49,7 @@ class PullRequestsController < ApplicationController def show @request = @g.merge_request(@project.gpid, params[:id]) + @commits = @g.merge_request_commits(@project.gpid, params[:id].to_i) end # Accept a merge request. @@ -63,7 +64,7 @@ class PullRequestsController < ApplicationController # @return [Gitlab::ObjectifiedHash] def accept_pull_request commit_id = parmas[:commit_id] - status = @g.accept_pull_rquest(@project.gpid, commit_id) + status = @g.accept_merge_rquest(@project.gpid, commit_id) if status == '200' # 需跳入的地方 end @@ -71,12 +72,12 @@ class PullRequestsController < ApplicationController # 获取某次请求的提交次数 def pull_request_commits - + @commits = @g.merge_request_commits(@project.gpid, params[:id].to_i) end # 获取某次请求的改动 def pull_request_changes - + @changes = @g.merge_request_changes(@project.gpid, params[:id]) end private diff --git a/app/views/pull_requests/_pull_request_changes.html.erb b/app/views/pull_requests/_pull_request_changes.html.erb new file mode 100644 index 000000000..465e985b9 --- /dev/null +++ b/app/views/pull_requests/_pull_request_changes.html.erb @@ -0,0 +1,32 @@ +
Showing 3 changed files with 3 additions and 3 deletions +
    +
  1. app/views/organizations/_org_course_homework.html.erb
  2. +
  3. app/views/users/_course_homework.html.erb
  4. +
  5. app/views/users/_user_homework_detail.html.erb
  6. +
+
+
app/views/organizations/_org_course_homework.html.erb
+
+ + + + + + + + + + + + + + + + + + + + + +
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/_pull_request_commits.html.erb b/app/views/pull_requests/_pull_request_commits.html.erb new file mode 100644 index 000000000..cd6fb1f34 --- /dev/null +++ b/app/views/pull_requests/_pull_request_commits.html.erb @@ -0,0 +1,16 @@ +<% @commits.each do |commit| %> +
+ <%= format_date(commit.created_at) %> + +
+
+ <%= commit.title %> +

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

+
+
+ + <%= link_to truncate(commit.short_id, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank" %> + +
+
+<% end %> diff --git a/app/views/pull_requests/pull_request_commits.js.erb b/app/views/pull_requests/pull_request_commits.js.erb index e69de29bb..53363a12e 100644 --- a/app/views/pull_requests/pull_request_commits.js.erb +++ b/app/views/pull_requests/pull_request_commits.js.erb @@ -0,0 +1 @@ +$("#merge_record_0").html('<%= render :partial => "pull_requests/pull_request_commits" %>'); \ No newline at end of file diff --git a/app/views/pull_requests/show.html.erb b/app/views/pull_requests/show.html.erb index 7b489908f..e8beb3e0d 100644 --- a/app/views/pull_requests/show.html.erb +++ b/app/views/pull_requests/show.html.erb @@ -17,53 +17,10 @@
根据最近提交时间排列
-
- 2016-08-02 -

1次提交

-
-
- 第一次提交 -

黄井泉创建于24小时前

-
-
- 5202e2ef -

浏览文件

-
-
+ <%= render :partial => "pull_requests/pull_request_commits" %>
- - -
- - - - - - - - - - - - - - - - - - - - - -
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/pull_request_changes" %>