roda-will_paginate 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79215160b3e0556a9701b65bea40f5047701e89a
4
- data.tar.gz: bf98c095ce9d06a028070bfcfecf67342802c98e
3
+ metadata.gz: 5bdfd414531d689d5f71485867f90666dc5db596
4
+ data.tar.gz: b70cb7da49c1028275a1b101293dc72f623d743a
5
5
  SHA512:
6
- metadata.gz: 30cbb2e9d1d3ec4f5909f98c8ade512da48bbaad807d6db40ad5ed86d17604b93b4ce31fcf487edfaf7b7a3a82c74043c2add79540b65cf7b4b907dc04a25722
7
- data.tar.gz: 0df8e3a434d9debb82e8a49556e6dc77107729a803c30061da1f8d521604bf3c55b4237bf12b016b16d188ead8d29280a78eab2ffd9d3caad429a66712501618
6
+ metadata.gz: cae20d962437b66410851ae47459e2a0381440b3d6fcf78967be0334483fc9dc78d715e3fdf375399e2de4af3145d7f6364b0925abccdc2095cc52c3403d9260
7
+ data.tar.gz: caddd0d40fef8d03c5f1bc9b1767b0ae5b6979ea9fb4f820a6e42edb3b506a5f6359ca0a19c990bd252df5403b85d7efe930fd2cbe098a5c17079ec3dd2a340b
data/README.md CHANGED
@@ -26,11 +26,17 @@ Add the plugin directive to your app
26
26
  plugin :will_paginate
27
27
  ```
28
28
 
29
- On your views you can use the same method you would use on a Rails app ie. `<%= will_paginate @collection %>` to include pagination links.
29
+ On your views you can use the same method you would use on a Rails app ie.
30
+
31
+ ```ruby
32
+ <%= will_paginate @collection %>
33
+ ```
34
+
35
+ to include pagination links.
30
36
 
31
37
  In case you would like to customize the generated links you need to implement a renderer.
32
38
 
33
- ## Bootstrap Pagination Renderer:
39
+ ## Twitter Bootstrap Pagination:
34
40
 
35
41
  We include a customized renderer if you are working with Twitter bootstrap, just:
36
42
 
@@ -40,11 +46,41 @@ require 'roda/will_paginate/bootstrap_pagination_renderer'
40
46
 
41
47
  in you application and then specify the renderer to Will Paginate:
42
48
 
49
+ ```
50
+ <%= will_paginate @collection, renderer: :bootstrap %>
51
+
52
+ ```
53
+
54
+ or
55
+
43
56
  ```
44
57
  <%= will_paginate @collection, renderer: Roda::WillPaginate::BootstrapPaginationRenderer %>
45
58
 
46
59
  ```
47
60
 
61
+ Alternative you can set it in the plugin configuration to avoid repeating it
62
+ in each helper call:
63
+
64
+ ```ruby
65
+ plugin :will_paginate, renderer: :bootstrap
66
+ ```
67
+
68
+ or
69
+
70
+ ```ruby
71
+ plugin :will_paginate, renderer: Roda::WillPaginate::BootstrapPaginationRenderer
72
+ ```
73
+
74
+ ## Custom renderers
75
+
76
+ Please take a look at the [Will Paginate](https://github.com/mislav/will_paginate) docs to see how renderers work.
77
+
78
+ If you have a custom renderer named Foo you can namespace it inside `Roda::WillPaginate::FooRenderer` and then use the symbol `:foo` to refer to it. For example:
79
+
80
+ ```ruby
81
+ plugin :will_paginate, renderer: :foo
82
+ ```
83
+
48
84
  ## Contributing
49
85
 
50
86
  1. Fork it ( https://github.com/manuca/roda-will_paginate/fork )
@@ -3,12 +3,24 @@ require 'will_paginate/view_helpers/link_renderer'
3
3
  class Roda
4
4
  module RodaPlugins
5
5
  module WillPaginate
6
+
7
+ def self.configure(app, opts = {})
8
+ app.opts[:will_paginate] = opts.dup
9
+
10
+ opts = app.opts[:will_paginate]
11
+ opts[:renderer] ||= ::Roda::WillPaginate::LinkRenderer
12
+
13
+ if opts[:renderer].is_a?(Symbol)
14
+ c_name = "Roda::WillPaginate::#{opts[:renderer].to_s.capitalize}PaginationRenderer"
15
+ opts[:renderer] = const_get(c_name)
16
+ end
17
+ end
18
+
6
19
  module InstanceMethods
7
20
  include ::WillPaginate::ViewHelpers
8
21
 
9
22
  def will_paginate(collection, options = {}) #:nodoc:
10
- options = options.merge(:renderer => ::Roda::WillPaginate::LinkRenderer) unless options[:renderer]
11
- super(collection, options)
23
+ super(collection, opts[:will_paginate].merge(options))
12
24
  end
13
25
  end
14
26
  end
@@ -1,5 +1,5 @@
1
1
  class Roda
2
2
  module WillPaginate
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-will_paginate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Barros Reyes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roda