public
Rubygem
Fork of mislav/will_paginate
Description: Most awesome pagination solution for Rails
Homepage: http://github.com/mislav/will_paginate/wikis
Clone URL: git://github.com/carllerche/will_paginate.git
Adapted to bootstrap on merb
Carl Lerche (author)
Thu Jun 19 11:46:38 -0700 2008
commit  6d70bb5a4bb0164b1ec04eb32b8a145974555a97
tree    eacfa19c7038023dd87f27ab3449e09b3f2b2af2
parent  853609ce634977e757945cf32b5560b906bfd057
...
10
11
12
13
 
14
15
16
17
 
 
 
 
 
18
19
20
...
26
27
28
 
 
 
 
 
 
29
30
31
...
82
83
84
85
 
 
 
86
...
10
11
12
 
13
14
15
16
17
18
19
20
21
22
23
24
25
...
31
32
33
34
35
36
37
38
39
40
41
42
...
93
94
95
 
96
97
98
99
0
@@ -10,11 +10,16 @@ require 'active_support'
0
 module WillPaginate
0
   class << self
0
     # shortcut for <tt>enable_actionpack; enable_activerecord</tt>
0
- def enable
0
+ def enable_rails
0
       enable_actionpack
0
       enable_activerecord
0
     end
0
     
0
+ def enable_merb
0
+ enable_merb_core
0
+ enable_activerecord
0
+ end
0
+
0
     # mixes in WillPaginate::ViewHelpers in ActionView::Base
0
     def enable_actionpack
0
       return if ActionView::Base.instance_methods.include? 'will_paginate'
0
@@ -26,6 +31,12 @@ module WillPaginate
0
       end
0
     end
0
     
0
+ def enable_merb_core
0
+ return if Merb::Controller.instance_methods.include? 'will_paginate'
0
+ require 'will_paginate/view_helpers'
0
+ Merb::Controller.class_eval { include ViewHelpers }
0
+ end
0
+
0
     # mixes in WillPaginate::Finder in ActiveRecord::Base and classes that deal
0
     # with associations
0
     def enable_activerecord
0
@@ -82,5 +93,7 @@ module WillPaginate
0
 end
0
 
0
 if defined?(Rails) and defined?(ActiveRecord) and defined?(ActionController)
0
- WillPaginate.enable
0
+ WillPaginate.enable_rails
0
+elsif defined?(Merb)
0
+ WillPaginate.enable_merb
0
 end
...
218
219
220
221
 
222
223
224
...
291
292
293
294
 
295
296
297
...
313
314
315
316
 
317
318
319
...
322
323
324
325
 
326
327
328
...
218
219
220
 
221
222
223
224
...
291
292
293
 
294
295
296
297
...
313
314
315
 
316
317
318
319
...
322
323
324
 
325
326
327
328
0
@@ -218,7 +218,7 @@ module WillPaginate
0
       links.push page_link_or_span(@collection.next_page, 'disabled next_page', @options[:next_label])
0
       
0
       html = links.join(@options[:separator])
0
- @options[:container] ? @template.content_tag(:div, html, html_attributes) : html
0
+ @options[:container] ? @template.tag(:div, html, html_attributes) : html
0
     end
0
 
0
     # Returns the subset of +options+ this instance was initialized with that
0
@@ -291,7 +291,7 @@ module WillPaginate
0
     end
0
 
0
     def page_span(page, text, attributes = {})
0
- @template.content_tag :span, text, attributes
0
+ @template.tag :span, text, attributes
0
     end
0
 
0
     # Returns URL params for +page_link_or_span+, taking the current GET params
0
@@ -313,7 +313,7 @@ module WillPaginate
0
           @url_params[param_name] = page_one ? 1 : 2
0
         end
0
 
0
- url = @template.url_for(@url_params)
0
+ url = @template.url(@url_params)
0
         return url if page_one
0
         
0
         if complex
0
@@ -322,7 +322,7 @@ module WillPaginate
0
         else
0
           @url_string = url
0
           @url_params[param_name] = 3
0
- @template.url_for(@url_params).split(//).each_with_index do |char, i|
0
+ @template.url(@url_params).split(//).each_with_index do |char, i|
0
             if char == '3' and url[i, 1] == '2'
0
               @url_string[i] = '@'
0
               break

Comments

    No one has commented yet.