modify commit count show

This commit is contained in:
houxiang 2015-11-18 16:11:51 +08:00
parent 9350841d50
commit fe3fbacdbc
5 changed files with 39 additions and 5 deletions

View File

@ -271,11 +271,37 @@ update
alias_method :browse, :show
#add by houxiang
def get_commits(id)
g = Gitlab.client
tmp_commit = g.commits(id,page:0)
commits = []
i=0
while tmp_commit!=[]
commits = commits+tmp_commit
i=i+1
tmp_commit = g.commits(id,page:i)
end
commits_count = commits.length
return commits_count
end
def changes
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
g = Gitlab.client
@commits = g.commits(@project.gpid, page:params[:page])
limit = 20
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
@commits_count = get_commits(@project.gpid)
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
@commit = g.commit(@project.gpid,@rev)
# @changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}")
#@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)

View File

@ -20,7 +20,7 @@
<% next if e.forge_act_type.safe_constantize.nil?
act = e.forge_act;
next if act.nil? %>
<!--缺陷动态-->
<!--缺陷动态-->\
<% if e.forge_act_type == "Issue" %>
<div class="problem_main">
<a class="problem_pic fl"><%= image_tag(url_to_avatar(act.author), :width => "42", :height => "42") %></a>
@ -111,4 +111,4 @@
<% end %>
<% end %>
<% end %>
<%= paginate @events_pages, :left => 3, :right => 3 %>
<%= paginate @events_pages, :left => 3, :right => 3 %>

View File

@ -13,6 +13,7 @@
<!--<th><%= l(:field_comments) %></th>-->
<!--</tr></thead>-->
<tbody>
<% show_diff = revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |changeset| %>
@ -48,4 +49,9 @@
<%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
</p>
<ul class="wlist">
<%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% end %>

View File

@ -14,7 +14,9 @@
<%= render_properties(@properties) %>
<div class="mt10">
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @commits, :entry => @entry }) unless @commits.empty? %>
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path ,:revisions => @commits, :entry => @entry ,:commits_pages =>@commits_pages , :commits_count => @commits_count}) unless @commits.empty? %>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>

View File

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