public
Clone URL: git://github.com/defunkt/exception_logger.git
Search Repo:
modify the plugin to use (and require) will_paginate
defunkt (author)
Sun Jan 13 12:00:59 -0800 2008
commit  dc223837ff05daafc77651a077ca45713642acde
tree    cc1104a8baf5b3541876f8850f601597408cadf8
parent  712d5efa383649c94e26d54a4aee324818aa97cc
...
1
2
 
 
...
 
1
2
3
0
@@ -1 +1,2 @@
0
-LoggedExceptionsController.view_paths = [File.join(directory, 'views')]
0
\ No newline at end of file
0
+WillPaginate.enable
0
+LoggedExceptionsController.view_paths = [File.join(directory, 'views')]
...
31
32
33
34
35
 
 
36
37
38
...
68
69
70
71
72
 
...
31
32
33
 
 
34
35
36
37
38
...
68
69
70
 
71
72
0
@@ -31,8 +31,8 @@ class LoggedExceptionsController < ActionController::Base
0
       conditions << 'controller_name = ? AND action_name = ?'
0
       parameters += params[:controller_actions_filter].split('/').collect(&:downcase)
0
     end
0
- @exception_pages, @exceptions = paginate :logged_exceptions, :order => 'created_at desc', :per_page => 30,
0
- :conditions => conditions.empty? ? nil : parameters.unshift(conditions * ' and ')
0
+ @exceptions = LoggedException.paginate :order => 'created_at desc', :per_page => 30,
0
+ :conditions => conditions.empty? ? nil : parameters.unshift(conditions * ' and '), :page => params[:page]
0
     
0
     respond_to do |format|
0
       format.html { redirect_to :action => 'index' unless action_name == 'index' }
0
@@ -68,4 +68,4 @@ class LoggedExceptionsController < ActionController::Base
0
       auth_data = request.env[auth_key].to_s.split unless auth_key.blank?
0
       return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]
0
     end
0
-end
0
\ No newline at end of file
0
+end
...
3
4
5
6
7
8
9
10
11
12
13
 
 
 
 
 
 
14
15
16
 
 
 
 
 
 
 
 
 
 
 
 
...
3
4
5
 
 
 
 
 
 
 
 
6
7
8
9
10
11
12
 
13
14
15
16
17
18
19
20
21
22
23
24
25
0
@@ -3,13 +3,22 @@ module LoggedExceptionsHelper
0
     [:query, :date_ranges_filter, :exception_names_filter, :controller_actions_filter].any? { |p| params[p] }
0
   end
0
 
0
- def pagination_remote_links(paginator, options={}, html_options={})
0
- name = options[:name] || ActionController::Pagination::DEFAULT_OPTIONS[:name]
0
- params = (options[:params] || ActionController::Pagination::DEFAULT_OPTIONS[:params]).clone
0
-
0
- pagination_links_each(paginator, options) do |n|
0
- params[name] = n
0
- link_to_function n.to_s, "ExceptionLogger.setPage(#{n})"
0
- end
0
+ def pagination_remote_links(collection)
0
+ will_paginate collection,
0
+ :renderer => 'LoggedExceptionsHelper::PaginationRenderer',
0
+ :prev_label => '',
0
+ :next_label => '',
0
+ :container => false
0
   end
0
-end
0
\ No newline at end of file
0
+
0
+ class PaginationRenderer < WillPaginate::LinkRenderer
0
+ def page_link_or_span(page, span_class = 'current', text = nil)
0
+ text ||= page.to_s
0
+ if page and page != current_page
0
+ @template.link_to_function text, "ExceptionLogger.setPage(#{page})"
0
+ else
0
+ @template.content_tag :span, text, :class => span_class
0
+ end
0
+ end
0
+ end
0
+end
...
1
2
3
4
5
 
 
6
7
8
...
48
49
50
51
 
52
53
 
54
55
56
57
58
59
 
...
1
2
3
 
 
4
5
6
7
8
...
48
49
50
 
51
52
 
53
54
55
56
57
 
58
59
0
@@ -1,8 +1,8 @@
0
 <div id="exceptions">
0
 <div class="pages">
0
   <%= link_to_remote 'Delete Visible', :url => { :action => 'destroy_all' }, :with => "ExceptionLogger.deleteAll()" %>
0
-<% if @exception_pages.page_count > 1 %>
0
-:: Pages: <strong><%= pagination_remote_links @exception_pages, :params => { :action => :index } %></strong>
0
+<% if @exceptions.page_count > 1 %>
0
+:: Pages: <strong><%= pagination_remote_links @exceptions %></strong>
0
 <% end %>
0
 </div>
0
 
0
@@ -48,11 +48,11 @@ if Date.today == exc.created_at.to_date
0
 
0
 </table>
0
 
0
-<% if @exception_pages.page_count > 1 %>
0
+<% if @exceptions.page_count > 1 %>
0
 <div class="pages pages-bottom">
0
-Pages: <strong><%= pagination_remote_links @exception_pages, :params => { :action => :index } %></strong>
0
+Pages: <strong><%= pagination_remote_links @exceptions %></strong>
0
 </div>
0
 <% end %>
0
 
0
 
0
-</div> <!-- #exceptions -->
0
\ No newline at end of file
0
+</div> <!-- #exceptions -->

Comments

    No one has commented yet.