will_paginate-bootstrap 0.2.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0ad035b3ba21f74d3c721c07103d7ed4e5005b04
4
+ data.tar.gz: c786be6bd7bb79da5bda6ca9a0bcd91fd8044aed
5
+ SHA512:
6
+ metadata.gz: 27855d1a81142bce77f7fd342173fdf1de0d5c7865fbcac1bbe1bdb82b0e12c23e4ce9c379e9551f39647262232c63eb1ea68bad042760fa9806e31c4b6b4d56
7
+ data.tar.gz: a4b25320a88f6072bf9db75252a48908965a989b79e4a262b974bb7239eebc848c75d630228bf1778e14a4a3bf5a99b3ca8378374f34b23fdcc5c3326d2517a1
data/README.markdown CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  This gem integrates the [Twitter Bootstrap](http://twitter.github.com/bootstrap/) [pagination component](http://twitter.github.com/bootstrap/components.html#pagination) with the [will_paginate](https://github.com/mislav/will_paginate) pagination gem.
8
8
 
9
- As with will_paginate itself, Rails and Sinatra are supported.
9
+ Just like will_paginate, Rails and Sinatra are supported.
10
10
 
11
11
  ## Install
12
12
 
@@ -34,18 +34,10 @@ As with will_paginate itself, Rails and Sinatra are supported.
34
34
  <%= will_paginate @collection, renderer: BootstrapPagination::Sinatra %>
35
35
  ```
36
36
 
37
- ## Bootstrap 3
38
-
39
- For Bootstrap 3, the markup required has changed slightly from version 2. You can pass the `bootstrap` option with a value >= 3 when calling `will_paginate` to generate Bootstrap 3 compatible markup. For example:
40
-
41
- ```ruby
42
- <%= will_paginate @collection, renderer: BootstrapPagination::Rails, bootstrap: 3 %>
43
- ```
44
-
45
- By default version 2 compatible markup will be generated.
46
-
47
37
  ## Compatibility
48
38
 
39
+ Starting at version 1.0, this gem no longer supports Bootstrap 2.
40
+
49
41
  <table>
50
42
  <tr>
51
43
  <th>Ruby</th>
@@ -56,7 +48,7 @@ By default version 2 compatible markup will be generated.
56
48
  <td>>= 3.0.3</td>
57
49
  </tr>
58
50
  <tr>
59
- <th>Bootstrap</th>
60
- <td>>= 2.0.0</td>
51
+ <th>Twitter Bootstrap</th>
52
+ <td>>= 3.0.0</td>
61
53
  </tr>
62
54
  </table>
data/example/app.rb CHANGED
@@ -2,34 +2,16 @@ require "sinatra"
2
2
  require "will_paginate-bootstrap"
3
3
  require "will_paginate/collection"
4
4
 
5
- CDN_PATHS = {
6
- 2 => "//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css",
7
- 3 => "//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css"
8
- }
9
-
10
- $menu = <<EOHTML
11
- <html>
12
- <head>
13
- <title>will_paginate-boostrap Example App</title>
14
- </head>
15
- <body>
16
- <ul>
17
- <h1>Which Twitter Boostrap version?</h1>
18
- <li><a href="/2">Bootstrap 2</a></li>
19
- <li><a href="/3">Bootstrap 3</a></li>
20
- </ul>
21
- </body>
22
- </html>
23
- EOHTML
5
+ CDN_PATH = "//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"
24
6
 
25
7
  $template = <<EOHTML
26
8
  <html>
27
9
  <head>
28
10
  <title>will_paginate-boostrap Example App</title>
29
- <link href="<%= href %>" rel="stylesheet">
11
+ <link href="<%= CDN_PATH %>" rel="stylesheet">
30
12
  </head>
31
13
  <body>
32
- <%= will_paginate @collection, renderer: BootstrapPagination::Sinatra, bootstrap: version %>
14
+ <%= will_paginate @collection, renderer: BootstrapPagination::Sinatra %>
33
15
  </body>
34
16
  </html>
35
17
  EOHTML
@@ -45,15 +27,6 @@ def build_collection
45
27
  end
46
28
 
47
29
  get "/" do
48
- erb $menu
49
- end
50
-
51
- get "/2" do
52
- build_collection
53
- erb $template, locals: {href: CDN_PATHS[2], version: 2}
54
- end
55
-
56
- get "/3" do
57
30
  build_collection
58
- erb $template, locals: {href: CDN_PATHS[3], version: 3}
31
+ erb $template
59
32
  end
@@ -15,11 +15,7 @@ module BootstrapPagination
15
15
  end
16
16
  end.join(@options[:link_separator])
17
17
 
18
- if @options[:bootstrap].to_i >= 3
19
- tag("ul", list_items, class: "pagination")
20
- else
21
- html_container(tag("ul", list_items))
22
- end
18
+ tag("ul", list_items, class: ul_class)
23
19
  end
24
20
 
25
21
  def container_attributes
@@ -30,6 +26,7 @@ module BootstrapPagination
30
26
 
31
27
  def page_number(page)
32
28
  link_options = @options[:link_options] || {}
29
+
33
30
  if page == current_page
34
31
  tag("li", tag("span", page), class: "active")
35
32
  else
@@ -37,6 +34,16 @@ module BootstrapPagination
37
34
  end
38
35
  end
39
36
 
37
+ def previous_or_next_page(page, text, classname)
38
+ link_options = @options[:link_options] || {}
39
+
40
+ if page
41
+ tag("li", link(text, page, link_options), class: classname)
42
+ else
43
+ tag("li", tag("span", text), class: "%s disabled" % classname)
44
+ end
45
+ end
46
+
40
47
  def gap
41
48
  tag("li", link(ELLIPSIS, "#"), class: "disabled")
42
49
  end
@@ -51,13 +58,8 @@ module BootstrapPagination
51
58
  previous_or_next_page(num, @options[:next_label], "next")
52
59
  end
53
60
 
54
- def previous_or_next_page(page, text, classname)
55
- link_options = @options[:link_options] || {}
56
- if page
57
- tag("li", link(text, page, link_options), class: classname)
58
- else
59
- tag("li", tag("span", text), class: "%s disabled" % classname)
60
- end
61
+ def ul_class
62
+ ["pagination", @options[:class]].compact.join(" ")
61
63
  end
62
64
  end
63
65
  end
@@ -1,3 +1,3 @@
1
1
  module BootstrapPagination
2
- VERSION = "0.2.5"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -24,13 +24,14 @@ describe "Bootstrap Renderer" do
24
24
  let(:collection_size) { 15 }
25
25
  let(:page) { (collection_size / 2.0).to_i }
26
26
  let(:collection) { 1.upto(collection_size).to_a }
27
- let(:version) { nil }
28
- let(:link_options) { nil}
27
+ let(:link_options) { nil }
28
+ let(:class_opt) { nil }
29
29
 
30
30
  let(:output) do
31
31
  will_paginate(
32
32
  collection.paginate(:page => page, :per_page => 1),
33
- renderer: MockRenderer, bootstrap: version, link_options: link_options
33
+ renderer: MockRenderer, link_options: link_options,
34
+ class: class_opt
34
35
  )
35
36
  end
36
37
 
@@ -72,25 +73,19 @@ describe "Bootstrap Renderer" do
72
73
  html.at_css('ul li.active span').wont_be_nil
73
74
  end
74
75
 
75
- describe "with markup for v2" do
76
- it "has an outer pagination div" do
77
- html.at_css('div.pagination').wont_be_nil
78
- end
79
-
80
- it "has an unordered list within the pagination div" do
81
- html.at_css('div.pagination ul').wont_be_nil
82
- end
76
+ it "has no outer pagination div" do
77
+ html.at_css('div.pagination').must_be_nil
83
78
  end
84
79
 
85
- describe "with markup for v3" do
86
- let(:version) { 3 }
80
+ it "has an unordered list with the pagination class" do
81
+ html.at_css('ul.pagination').wont_be_nil
82
+ end
87
83
 
88
- it "has no outer pagination div" do
89
- html.at_css('div.pagination').must_be_nil
90
- end
84
+ describe "when specifying a custom class" do
85
+ let(:class_opt) { "pagination-lg" }
91
86
 
92
- it "has an unordered list with the pagination class" do
93
- html.at_css('ul.pagination').wont_be_nil
87
+ it "applies the class to the ul" do
88
+ html.at_css("ul.pagination.pagination-lg").wont_be_nil
94
89
  end
95
90
  end
96
91
 
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "https://github.com/nickpad/will_paginate-bootstrap"
11
11
  s.summary = %q{Integrates the Twitter Bootstrap pagination component with will_paginate}
12
12
  s.description = %q{This gem integrates the Twitter Bootstrap pagination component with the will_paginate pagination gem. Supports Rails and Sinatra.}
13
+ s.license = "MIT"
13
14
 
14
15
  s.rubyforge_project = "will_paginate-bootstrap"
15
16
 
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: will_paginate-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nick Dainty
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-15 00:00:00.000000000 Z
11
+ date: 2013-10-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: will_paginate
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.0.3
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.0.3
30
27
  description: This gem integrates the Twitter Bootstrap pagination component with the
@@ -51,34 +48,28 @@ files:
51
48
  - spec/pagination_spec.rb
52
49
  - will_paginate-bootstrap.gemspec
53
50
  homepage: https://github.com/nickpad/will_paginate-bootstrap
54
- licenses: []
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
55
54
  post_install_message:
56
55
  rdoc_options: []
57
56
  require_paths:
58
57
  - lib
59
58
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
59
  requirements:
62
- - - ! '>='
60
+ - - '>='
63
61
  - !ruby/object:Gem::Version
64
62
  version: '0'
65
- segments:
66
- - 0
67
- hash: -2778479780677387390
68
63
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
64
  requirements:
71
- - - ! '>='
65
+ - - '>='
72
66
  - !ruby/object:Gem::Version
73
67
  version: '0'
74
- segments:
75
- - 0
76
- hash: -2778479780677387390
77
68
  requirements: []
78
69
  rubyforge_project: will_paginate-bootstrap
79
- rubygems_version: 1.8.23
70
+ rubygems_version: 2.0.3
80
71
  signing_key:
81
- specification_version: 3
72
+ specification_version: 4
82
73
  summary: Integrates the Twitter Bootstrap pagination component with will_paginate
83
74
  test_files:
84
75
  - spec/pagination_spec.rb