From f6bfd7824d296f915b327aabfceaa67ffea85d3d Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Thu, 19 Nov 2015 14:42:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E7=9C=8Bcommits?= =?UTF-8?q?=E9=82=A3=E4=B8=AA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 15 +++++++-------- app/views/repositories/show.html.erb | 3 ++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 3993368a7..3129dbf02 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -354,17 +354,16 @@ update def get_commits(id) g = Gitlab.client - tmp_commit = g.commits(id,page:0) - commits = [] + tmp_commit_count = g.commits(id,page:0).count + commit_count = 0 i=0 - while tmp_commit!=[] - commits = commits+tmp_commit + while tmp_commit_count!=0 + commit_count = commit_count+tmp_commit_count i=i+1 - tmp_commit = g.commits(id,page:i) + tmp_commit_count = g.commits(id,page:i).count end - commits_count = commits.length - return commits_count + return commit_count end @@ -377,7 +376,7 @@ update @commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s) - @commits_count = get_commits(@project.gpid) + @commits_count = params[:commit_count].to_i @commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page] @commit = g.commit(@project.gpid,@rev) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index e8596b717..7aac3af1d 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -40,7 +40,8 @@ - <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1} %> 提交 + <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %> 提交 + <% end %>