foundation-will_paginate 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/foundation-will_paginate.gemspec +19 -0
- data/lib/foundation-will_paginate.rb +7 -0
- data/lib/foundation-will_paginate/helper.rb +9 -0
- data/lib/foundation-will_paginate/renderer.rb +31 -0
- data/lib/foundation-will_paginate/version.rb +5 -0
- metadata +56 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Mark McConachie
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Foundation::WillPaginate
|
2
|
+
|
3
|
+
Integrates Zurb Foundation's [pagination styles](http://foundation.zurb.com/docs/navigation.php) with [will_paginate](https://github.com/mislav/will_paginate).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'foundation-will_paginate'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install foundation-will_paginate
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
In your view where you would usually use
|
22
|
+
|
23
|
+
```
|
24
|
+
<%= will_paginate @posts %>
|
25
|
+
```
|
26
|
+
|
27
|
+
Now use
|
28
|
+
|
29
|
+
```
|
30
|
+
<%= foundation_paginate @posts %>
|
31
|
+
```
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'foundation-will_paginate/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "foundation-will_paginate"
|
8
|
+
gem.version = Foundation::WillPaginate::VERSION
|
9
|
+
gem.authors = ["Mark McConachie"]
|
10
|
+
gem.email = ["mark@markmcconachie.com"]
|
11
|
+
gem.description = %q{foundation-will_paginate provides a renderer and a view helper to let foundation and will_paginate work together}
|
12
|
+
gem.summary = %q{foundation pagination with will_paginate}
|
13
|
+
gem.homepage = "https://github.com/markmcconachie/foundation-will_paginate"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Foundation
|
2
|
+
module WillPaginate
|
3
|
+
module Helper
|
4
|
+
def foundation_paginate(pages)
|
5
|
+
will_paginate(pages, :class => 'pagination', :inner_window => 2, :outer_window => 0, :renderer => Foundation::WillPaginate::Renderer, :previous_label => '«'.html_safe, :next_label => '»'.html_safe)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'will_paginate/view_helpers/action_view'
|
2
|
+
|
3
|
+
module Foundation
|
4
|
+
module WillPaginate
|
5
|
+
class Renderer < ::WillPaginate::ActionView::LinkRenderer
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def gap
|
10
|
+
tag :li, link(super, '#'), :class => 'unavailable'
|
11
|
+
end
|
12
|
+
|
13
|
+
def page_number(page)
|
14
|
+
tag :li, link(page, page, :rel => rel_value(page)), :class => ('current' if page == current_page)
|
15
|
+
end
|
16
|
+
|
17
|
+
def previous_or_next_page(page, text, classname)
|
18
|
+
tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('unavailable' unless page)].join(' ')
|
19
|
+
end
|
20
|
+
|
21
|
+
def html_container(html)
|
22
|
+
tag(:ul, html, container_attributes)
|
23
|
+
end
|
24
|
+
|
25
|
+
def gap
|
26
|
+
tag :li, link(super, '#'), :class => 'unavailable'
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foundation-will_paginate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mark McConachie
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: foundation-will_paginate provides a renderer and a view helper to let
|
15
|
+
foundation and will_paginate work together
|
16
|
+
email:
|
17
|
+
- mark@markmcconachie.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- foundation-will_paginate.gemspec
|
28
|
+
- lib/foundation-will_paginate.rb
|
29
|
+
- lib/foundation-will_paginate/helper.rb
|
30
|
+
- lib/foundation-will_paginate/renderer.rb
|
31
|
+
- lib/foundation-will_paginate/version.rb
|
32
|
+
homepage: https://github.com/markmcconachie/foundation-will_paginate
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.23
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: foundation pagination with will_paginate
|
56
|
+
test_files: []
|