##// END OF EJS Templates
added pagination on revisions list...
Jean-Philippe Lang -
r378:e951209d6824
parent child
Show More
@@ -47,7 +47,16 class RepositoriesController < ApplicationController
47 @entry = @repository.scm.entry(@path, @rev)
47 @entry = @repository.scm.entry(@path, @rev)
48 show_error and return unless @entry
48 show_error and return unless @entry
49 end
49 end
50 @changesets = @repository.changesets_for_path(@path)
50 @repository.changesets_with_path @path do
51 @changeset_count = @repository.changesets.count
52 @changeset_pages = Paginator.new self, @changeset_count,
53 25,
54 params['page']
55 @changesets = @repository.changesets.find(:all,
56 :limit => @changeset_pages.items_per_page,
57 :offset => @changeset_pages.current.offset)
58 end
59 render :action => "revisions", :layout => false if request.xhr?
51 end
60 end
52
61
53 def entry
62 def entry
@@ -36,6 +36,15 class Repository < ActiveRecord::Base
36 super if root_url.blank?
36 super if root_url.blank?
37 end
37 end
38
38
39 def changesets_with_path(path="")
40 path = "/#{path}%"
41 path = url.gsub(/^#{root_url}/, '') + path if root_url && root_url != url
42 path.squeeze!("/")
43 Changeset.with_scope(:find => { :include => :changes, :conditions => ["#{Change.table_name}.path LIKE ?", path] }) do
44 yield
45 end
46 end
47
39 def changesets_for_path(path="")
48 def changesets_for_path(path="")
40 path = "/#{path}%"
49 path = "/#{path}%"
41 path = url.gsub(/^#{root_url}/, '') + path if root_url && root_url != url
50 path = url.gsub(/^#{root_url}/, '') + path if root_url && root_url != url
@@ -15,7 +15,9
15 <h3>Revisions</h3>
15 <h3>Revisions</h3>
16
16
17 <%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :changesets => @changesets, :entry => @entry }%>
17 <%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :changesets => @changesets, :entry => @entry }%>
18 <p><%= lwr(:label_modification, @changesets.length) %></p>
18
19 <p><%= pagination_links_full @changeset_pages %>
20 [ <%= @changeset_pages.current.first_item %> - <%= @changeset_pages.current.last_item %> / <%= @changeset_count %> ]</p>
19
21
20 <% content_for :header_tags do %>
22 <% content_for :header_tags do %>
21 <%= stylesheet_link_tag "scm" %>
23 <%= stylesheet_link_tag "scm" %>
General Comments 0
You need to be logged in to leave comments. Login now