bootstrap_pagination 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2a2e7f0120f193b5a69ab60dde03dc2aada1c90b
4
+ data.tar.gz: 9b461b8d9898dcfcdb54000b0887f5de53e7a0a0
5
+ SHA512:
6
+ metadata.gz: 29a5220960d23cbdce3b31ff866578ce7ef2e0d23d818b2fd401f333efa74190acd182e145f6d663d24240020c29191afb9e5ab360a32f9d544fbe4760678b61
7
+ data.tar.gz: 069ccde9a6fcc982c48d8b43645bf2b1a62b9eb2e3263abe8a623e1098b4cfc14eb7123f97b5915c9fe51ba253457df29dd00c248c33b8c4734b496b8410b396
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Vexil
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # Bootstrap Pagination
2
+
3
+ Bootstrap Pagination is a nice-looking link alternative to be used with will_paginate.
4
+ <br>
5
+ :exclamation: At the moment, only Rails is supported. :exclamation:
6
+ <br>
7
+ `version 1.0.1`
8
+
9
+ ## Sample:
10
+ <img src="http://i.imgur.com/b37rzfu.png">
11
+
12
+ ## How to use:
13
+ First, install the gem by running the command `gem install bootstrap_pagination`
14
+ <br>
15
+
16
+ After you have installed, use the gem as followed:
17
+
18
+ ```
19
+ <%= will_paginate @collection, renderer: BootstrapPagination::LinkRenderer %>
20
+ ```
21
+
22
+ Or, with HAML
23
+ ```ruby
24
+ = will_paginate @collection, renderer: BootstrapPagination::LinkRenderer
25
+ ```
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,18 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require 'bootstrap_pagination/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "bootstrap_pagination"
6
+ spec.version = BootstrapPaginationVersion::VERSION
7
+ spec.authors = ["Vexil"]
8
+ spec.email = ["vexilmc@gmail.com"]
9
+ spec.summary = %q{Bootstrap Buttons Pagination}
10
+ spec.description = %q{Bootstrap button pagination for ruby on rails, to be used with will_paginate}
11
+ spec.homepage = "https://github.com/Vexil/bootstrap_pagination"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files`.split("\n")
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_runtime_dependency "will_paginate", ">= 3.0.3"
18
+ end
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ rm *.gem
3
+ gem uninstall bootstrap_pagination
4
+ gem build bootstrap_pagination.gemspec
5
+ gem install bootstrap_pagination-1.0.2.gem
@@ -0,0 +1,5 @@
1
+ require 'bootstrap_pagination/pagination'
2
+ require 'bootstrap_pagination/version'
3
+
4
+ module BootstrapPagination
5
+ end
@@ -0,0 +1,62 @@
1
+ require "will_paginate/view_helpers/action_view"
2
+ module BootstrapPagination
3
+ class LinkRenderer < WillPaginate::ActionView::LinkRenderer
4
+ protected
5
+ # Get the link for the current page
6
+ def page_number(page)
7
+ unless page == current_page
8
+ link(page, page)
9
+ else
10
+ link(page, "#", :class => 'btn btn-default active')
11
+ end
12
+ end
13
+
14
+ # Gap method '...' for will_paginate
15
+ def gap
16
+ text = @template.will_paginate_translate(:page_gap) { '&hellip;' }
17
+ %(<a class="btn btn-default disabled">#{text}</a>)
18
+ end
19
+
20
+ # Gets the next page method for will_paginate
21
+ def next_page
22
+ num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
23
+ previous_or_next_page(num, "&raquo;")
24
+ end
25
+
26
+ # Gets the previous page method for will_paginate
27
+ def previous_page
28
+ num = @collection.current_page > 1 && @collection.current_page - 1
29
+ previous_or_next_page(num, "&laquo;")
30
+ end
31
+
32
+ # Previous or next page method for will_paginate
33
+ def previous_or_next_page(page, text)
34
+ if page
35
+ link(text, page, :class => 'btn btn-default')
36
+ else
37
+ link(text, "#", :class => 'btn btn-default disabled')
38
+ end
39
+ end
40
+
41
+ # Get the html container for the pagination links
42
+ def html_container(html)
43
+ tag(:div, html, :class => "btn-group")
44
+ end
45
+
46
+ private
47
+ # Get the link for will_paginate : Used for rendering out the pagination
48
+ def link(text, target, attributes = {})
49
+ if target.is_a? Fixnum
50
+ target = url(target)
51
+ end
52
+
53
+ unless target == "#"
54
+ attributes[:href] ||= target
55
+ end
56
+
57
+ attributes.delete(:classname)
58
+ attributes[:class] ||= "btn btn-default"
59
+ tag(:a, text, attributes)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,3 @@
1
+ module BootstrapPaginationVersion
2
+ VERSION = "1.0.2"
3
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bootstrap_pagination
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Vexil
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-24 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.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.3
27
+ description: Bootstrap button pagination for ruby on rails, to be used with will_paginate
28
+ email:
29
+ - vexilmc@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - LICENSE.txt
37
+ - README.md
38
+ - Rakefile
39
+ - bootstrap_pagination.gemspec
40
+ - buildGem.sh
41
+ - lib/bootstrap_pagination.rb
42
+ - lib/bootstrap_pagination/pagination.rb
43
+ - lib/bootstrap_pagination/version.rb
44
+ homepage: https://github.com/Vexil/bootstrap_pagination
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.2.2
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Bootstrap Buttons Pagination
68
+ test_files: []