will_paginate-bootstrap 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -11,16 +11,14 @@ As with will_paginate itself, Rails and Sinatra are supported.
11
11
  ### Rails
12
12
 
13
13
  1. Load the Bootstrap CSS in your template.
14
- 2. `require "will_paginate/bootstrap"` (`config/initializers/will_paginate.rb` would be a good place to put this).
15
- 3. In your view, use the `:renderer => BootstrapPagination::Rails` option with the `will_paginate` helper, for example:
14
+ 2. In your view, use the `:renderer => BootstrapPagination::Rails` option with the `will_paginate` helper, for example:
16
15
 
17
16
  `<%= will_paginate @collection, :renderer => BootstrapPagination::Rails %>`
18
17
 
19
18
  ### Sinatra
20
19
 
21
20
  1. Load the Bootstrap CSS in your template.
22
- 2. `require "will_paginate/bootstrap"` in your Sinatra app.
23
- 3. In your view, use the `:renderer => BootstrapPagination::Sinatra` option with the `will_paginate` helper, for example:
21
+ 2. In your view, use the `:renderer => BootstrapPagination::Sinatra` option with the `will_paginate` helper, for example:
24
22
 
25
23
  `<%= will_paginate @collection, :renderer => BootstrapPagination::Sinatra %>`
26
24
 
@@ -1,3 +1,3 @@
1
1
  module BootstrapPagination
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1 @@
1
+ require "will_paginate/bootstrap"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: will_paginate-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-11 00:00:00.000000000 Z
12
+ date: 2012-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: will_paginate
16
- requirement: &70312336639340 !ruby/object:Gem::Requirement
16
+ requirement: &70136986584340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 3.0.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70312336639340
24
+ version_requirements: *70136986584340
25
25
  description: This gem integrates the Twitter Bootstrap pagination component with the
26
26
  will_paginate pagination gem. Supports Rails and Sinatra.
27
27
  email:
@@ -37,9 +37,9 @@ files:
37
37
  - Rakefile
38
38
  - lib/bootstrap_pagination/action_view.rb
39
39
  - lib/bootstrap_pagination/bootstrap_renderer.rb
40
- - lib/bootstrap_pagination/link_renderer.rb
41
40
  - lib/bootstrap_pagination/sinatra.rb
42
41
  - lib/bootstrap_pagination/version.rb
42
+ - lib/will_paginate-bootstrap.rb
43
43
  - lib/will_paginate/bootstrap.rb
44
44
  - pagination.png
45
45
  - spec/pagination_spec.rb
@@ -58,7 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
58
  version: '0'
59
59
  segments:
60
60
  - 0
61
- hash: 4530517534669726234
61
+ hash: 1014543729292566297
62
62
  required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  version: '0'
68
68
  segments:
69
69
  - 0
70
- hash: 4530517534669726234
70
+ hash: 1014543729292566297
71
71
  requirements: []
72
72
  rubyforge_project: will_paginate-bootstrap
73
73
  rubygems_version: 1.8.11
@@ -1,55 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require "bootstrap_pagination/version"
4
-
5
- module BootstrapPagination
6
- # Contains functionality shared by all renderer classes.
7
- module LinkRenderer
8
- ELLIPSIS = '…'
9
-
10
- def to_html
11
- list_items = pagination.map do |item|
12
- case item
13
- when Fixnum
14
- page_number(item)
15
- else
16
- send(item)
17
- end
18
- end
19
-
20
- html_container(tag('ul', list_items.join(@options[:link_separator])))
21
- end
22
-
23
- protected
24
-
25
- def page_number(page)
26
- if page == current_page
27
- tag('li', link(page, page), :class => 'active')
28
- else
29
- tag('li', link(page, page, :rel => rel_value(page)))
30
- end
31
- end
32
-
33
- def gap
34
- tag('li', link(ELLIPSIS, '#'), :class => 'disabled')
35
- end
36
-
37
- def previous_page
38
- num = @collection.current_page > 1 && @collection.current_page - 1
39
- previous_or_next_page(num, @options[:previous_label], 'prev')
40
- end
41
-
42
- def next_page
43
- num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
44
- previous_or_next_page(num, @options[:next_label], 'next')
45
- end
46
-
47
- def previous_or_next_page(page, text, classname)
48
- if page
49
- tag('li', link(text, page), :class => classname)
50
- else
51
- tag('li', link(text, '#'), :class => "%s disabled" % classname)
52
- end
53
- end
54
- end
55
- end