优化查看commits那个页面

hjq_course
Gan Yi.ang 10 years ago
parent ea47a8085a
commit f6bfd7824d

@ -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)

@ -40,7 +40,8 @@
</span>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1} %></font> 提交
<%=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}"} %></font> 提交
</span>
</div>
<% end %>

Loading…
Cancel
Save