will_paginate-bootstrap5 0.2.4

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3387de62f21d273065f10f59cc21b3b013970d69819fec07a72afabe7a0c0d21
4
+ data.tar.gz: 32871a9c277210cfba492805db59a7ee06fd96bee726621386af5ec8f2da5f24
5
+ SHA512:
6
+ metadata.gz: c6c661c9317925345d07b0fff67654d3442cd4d7cfd6f2f30e732deae92eef52e709a0abee0d1ea9b1fe7e6b6c11dd4e0ea7cc8fff5c75621a2409060a89f5d2
7
+ data.tar.gz: 7d4a201e5f9d38d9bb82b4888ae38f898321446441583e252c654cf2dcc9a5f506b9c71f2a192a66ae5b2da88a701f5768fa6abf0e1e6eed20a4b6f4a224c7c1
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in bootstrap-will_paginate.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+
2
+ Copyright (c) 2016 Ivan Palamarchuk
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the "Software"), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ the Software, and to permit persons to whom the Software is furnished to do so,
9
+ subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Nicholas Fine
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ ## [Will Paginate][wp] link renderer styles for [Twitter Bootstrap 5][bs]
2
+
3
+ ![ex](https://cloud.githubusercontent.com/assets/2103263/18925649/74eeb836-85bd-11e6-9be1-593a076e684c.png)
4
+
5
+ Rails Engine that extends [will_paginate][wp] stylings to match the pagination styling conventions
6
+ in Twitter's [Bootstrap][bs] 5 toolkit.
7
+
8
+ ### Installation
9
+
10
+ Add to your Gemfile:
11
+
12
+ gem 'will_paginate-bootstrap5'
13
+
14
+ ### Usage
15
+
16
+ Just like you would in the regular [will_paginate][wp]. If you've got a need to use the default will_paginate stylings,
17
+ pass an option like so:
18
+
19
+ <%= will_paginate @collection, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %>
20
+
21
+ The following options are available (in addition to the options available in will_paginate):
22
+
23
+ :list_classes = ['pagination'] # Array of classes
24
+ :aria_label = 'Page Navigation' # The aria label to use in the Nav tag
25
+ :previous_label = '&laquo;' # Previous page label
26
+ :next_label = '&raquo;' # Next page label
27
+
28
+ For example, to place the navigation section to the far right of the page, use this in your view:
29
+
30
+ <%= will_paginate @clients, list_classes: %w(pagination justify-content-end) %>
31
+
32
+ [wp]: http://github.com/mislav/will_paginate
33
+ [bs]: http://v4-alpha.getbootstrap.com/
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,79 @@
1
+ require 'will_paginate/view_helpers/action_view'
2
+
3
+ module WillPaginate
4
+ module ActionView
5
+ def will_paginate(collection = nil, options = {})
6
+ options, collection = collection, nil if collection.is_a? Hash
7
+ collection ||= infer_collection_from_controller
8
+
9
+ options = options.symbolize_keys
10
+ options[:renderer] ||= BootstrapLinkRenderer
11
+ options[:list_classes] ||= ['pagination']
12
+ options[:previous_label] ||= '&larr;'
13
+ options[:next_label] ||= '&rarr;'
14
+
15
+ super(collection, options)
16
+ end
17
+
18
+ class BootstrapLinkRenderer < LinkRenderer
19
+ ELLIPSIS = '&hellip;'
20
+
21
+ def to_html
22
+ list_items = pagination.map do |item|
23
+ case item
24
+ when Integer
25
+ page_number(item)
26
+ else
27
+ send(item)
28
+ end
29
+ end.join(@options[:link_separator])
30
+
31
+ list_wrapper = tag :ul, list_items, class: @options[:list_classes].join(' ').to_s
32
+ tag :nav, list_wrapper
33
+ end
34
+
35
+ def container_attributes
36
+ super.except(*[:link_options])
37
+ end
38
+
39
+ protected
40
+
41
+ def page_number(page)
42
+ link_options = @options[:link_options] || {}
43
+
44
+ if page == current_page
45
+ tag :li, tag(:span, page, class: 'page-link'), class: 'page-item active'
46
+ else
47
+ link_options.merge! class: 'page-link', rel: rel_value(page)
48
+ tag :li, link(page, page, link_options), class: 'page-item'
49
+ end
50
+ end
51
+
52
+ def previous_or_next_page(page, text, classname)
53
+ link_options = @options[:link_options] || {}
54
+
55
+ if page
56
+ link_wrapper = link(text, page, link_options.merge(class: 'page-link'))
57
+ tag :li, link_wrapper, class: 'page-item'
58
+ else
59
+ span_wrapper = tag(:span, text, class: 'page-link')
60
+ tag :li, span_wrapper, class: 'page-item disabled'
61
+ end
62
+ end
63
+
64
+ def gap
65
+ tag :li, tag(:i, ELLIPSIS, class: 'page-link'), class: 'page-item disabled'
66
+ end
67
+
68
+ def previous_page
69
+ num = @collection.current_page > 1 && @collection.current_page - 1
70
+ previous_or_next_page num, @options[:previous_label], 'previous'
71
+ end
72
+
73
+ def next_page
74
+ num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
75
+ previous_or_next_page num, @options[:next_label], 'next'
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,9 @@
1
+ require 'will_paginate-bootstrap4/version'
2
+ require 'will_paginate'
3
+
4
+ module Bootstrap
5
+ module WillPaginate
6
+ class Engine < ::Rails::Engine
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Bootstrap
2
+ module WillPaginate
3
+ VERSION = '0.2.4'
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'will_paginate-bootstrap4/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'will_paginate-bootstrap5'
7
+ s.version = Bootstrap::WillPaginate::VERSION
8
+ s.authors = ['Ivan Palamarchuk']
9
+ s.email = 'i.delef@gmail.com'
10
+ s.summary = %q{Format will_paginate html to match Twitter Bootstrap 5 styling.}
11
+ s.description = %q{Hooks into will_paginate to format the html to match Twitter Bootstrap 5 styling.}
12
+ s.homepage = 'https://github.com/delef/will_paginate-bootstrap5'
13
+ s.license = 'MIT'
14
+
15
+ s.required_ruby_version = '>= 1.9.2'
16
+ s.rubyforge_project = 'will_paginate-bootstrap5'
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ['lib']
22
+
23
+ s.add_runtime_dependency 'will_paginate', '~> 3.0', '>= 3.0.0'
24
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: will_paginate-bootstrap5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Palamarchuk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-05-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: will_paginate
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
+ description: Hooks into will_paginate to format the html to match Twitter Bootstrap
34
+ 5 styling.
35
+ email: i.delef@gmail.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - ".gitignore"
41
+ - Gemfile
42
+ - LICENSE.md
43
+ - MIT-LICENSE
44
+ - README.md
45
+ - Rakefile
46
+ - config/initializers/will_paginate.rb
47
+ - lib/will_paginate-bootstrap4.rb
48
+ - lib/will_paginate-bootstrap4/version.rb
49
+ - will_paginate-bootstrap5.gemspec
50
+ homepage: https://github.com/delef/will_paginate-bootstrap5
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.9.2
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubygems_version: 3.2.3
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: Format will_paginate html to match Twitter Bootstrap 5 styling.
73
+ test_files: []