ochko-flow_pagination 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/Manifest +6 -0
- data/README.rdoc +67 -0
- data/Rakefile +10 -0
- data/flow_pagination.gemspec +30 -0
- data/init.rb +1 -0
- data/lib/flow_pagination.rb +40 -0
- metadata +80 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Iván "Mexpolk" Torres
|
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/Manifest
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
= FlowPagination
|
2
|
+
|
3
|
+
FlowPagination link renderer plugin for Mislav's
|
4
|
+
{WillPaginate}[http://github.com/mislav/will_paginate/tree/master]
|
5
|
+
plugin (Twitter like pagination).
|
6
|
+
|
7
|
+
Instead of showing page links, this plugin/gem change the rendering of
|
8
|
+
WillPaginate to display, at the bottom of the page's records, the "More" button.
|
9
|
+
And when clicked it will add the next set of records (next page) right below
|
10
|
+
the previous ones.
|
11
|
+
|
12
|
+
== Requirements
|
13
|
+
|
14
|
+
* Mislav's {WillPaginate}[http://github.com/mislav/will_paginate/tree/master]
|
15
|
+
plugin/gem.
|
16
|
+
|
17
|
+
== Installation
|
18
|
+
|
19
|
+
I've created a category listing (index action) to give a basic example.
|
20
|
+
|
21
|
+
Configure +WillPaginate+ and +FlowPagination+ gems (config/environment.rb):
|
22
|
+
|
23
|
+
Rails::Initializer.run do |config|
|
24
|
+
|
25
|
+
config.gem 'mislav-will_paginate', :lib => 'will_paginate'
|
26
|
+
config.gem 'ochko-flow_pagination', :lib => 'flow_pagination'
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
To install these gems type the following rake task:
|
31
|
+
|
32
|
+
rake gems:install
|
33
|
+
|
34
|
+
=== Install It as a Plugin
|
35
|
+
|
36
|
+
script/plugin install git://github.com/mislav/will_paginate.git
|
37
|
+
script/plugin install git://github.com/ochko/flow_pagination.git
|
38
|
+
|
39
|
+
== Usage
|
40
|
+
|
41
|
+
There's flow_pagination_example[http://github.com/mexpolk/flow_pagination_example/tree/master]
|
42
|
+
application to see this gem in action.
|
43
|
+
|
44
|
+
Enjoy!
|
45
|
+
|
46
|
+
== License
|
47
|
+
|
48
|
+
Copyright (c) 2010 Ochirkhuyag.L
|
49
|
+
|
50
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
51
|
+
a copy of this software and associated documentation files (the
|
52
|
+
"Software"), to deal in the Software without restriction, including
|
53
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
54
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
55
|
+
permit persons to whom the Software is furnished to do so, subject to
|
56
|
+
the following conditions:
|
57
|
+
|
58
|
+
The above copyright notice and this permission notice shall be
|
59
|
+
included in all copies or substantial portions of the Software.
|
60
|
+
|
61
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
62
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
63
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
64
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
65
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
66
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
67
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'echoe'
|
2
|
+
|
3
|
+
Echoe.new('flow_pagination', '1.1') do |e|
|
4
|
+
e.description = "FlowPagination link renderer plugin for Mislav's WillPaginate plugin (Twitter like pagination)."
|
5
|
+
e.url = "http://github.com/mexpolk/flow_pagination"
|
6
|
+
e.author = "Ivan Torres"
|
7
|
+
e.email = "mexpolk@gmail.com"
|
8
|
+
e.ignore_pattern = ["tmp/*", "script/*"]
|
9
|
+
e.development_dependencies = []
|
10
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{ochko-flow_pagination}
|
5
|
+
s.version = "1.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Ochirkhuyag.L", "Ivan Torres"]
|
9
|
+
s.date = %q{2010-05-19}
|
10
|
+
s.description = %q{FlowPagination link renderer plugin for Mislav's WillPaginate plugin (Twitter like pagination).}
|
11
|
+
s.email = %q{ochkoo@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/flow_pagination.rb"]
|
13
|
+
s.files = ["Manifest", "README.rdoc", "Rakefile", "init.rb", "lib/flow_pagination.rb", "MIT-LICENSE", "flow_pagination.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/ochko/flow_pagination}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Flow_pagination", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{flow_pagination}
|
18
|
+
s.rubygems_version = %q{1.3.5}
|
19
|
+
s.summary = %q{FlowPagination link renderer plugin for Mislav's WillPaginate plugin (Twitter like pagination).}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'flow_pagination'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module FlowPagination
|
2
|
+
|
3
|
+
# FlowPagination renderer for (Mislav) WillPaginate Plugin
|
4
|
+
class LinkRenderer < WillPaginate::LinkRenderer
|
5
|
+
|
6
|
+
# Render flow navigation
|
7
|
+
def to_html
|
8
|
+
flow_pagination = ''
|
9
|
+
|
10
|
+
if self.current_page < self.last_page
|
11
|
+
flow_pagination = @template.button_to_remote(
|
12
|
+
@template.t('flow_pagination.button', :default => 'More'),
|
13
|
+
:url => url_for(self.next_page),
|
14
|
+
:method => @template.request.request_method)
|
15
|
+
end
|
16
|
+
|
17
|
+
@template.content_tag(:div, flow_pagination, :id => 'flow_pagination')
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
# Get current page number
|
24
|
+
def current_page
|
25
|
+
@collection.current_page
|
26
|
+
end
|
27
|
+
|
28
|
+
# Get last page number
|
29
|
+
def last_page
|
30
|
+
@last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get next page number
|
34
|
+
def next_page
|
35
|
+
@collection.next_page
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ochko-flow_pagination
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
version: "1.2"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Ochirkhuyag.L
|
13
|
+
- Ivan Torres
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-05-19 00:00:00 +09:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: FlowPagination link renderer plugin for Mislav's WillPaginate plugin (Twitter like pagination).
|
23
|
+
email: ochkoo@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README.rdoc
|
30
|
+
- lib/flow_pagination.rb
|
31
|
+
files:
|
32
|
+
- Manifest
|
33
|
+
- README.rdoc
|
34
|
+
- Rakefile
|
35
|
+
- init.rb
|
36
|
+
- lib/flow_pagination.rb
|
37
|
+
- MIT-LICENSE
|
38
|
+
- flow_pagination.gemspec
|
39
|
+
has_rdoc: true
|
40
|
+
homepage: http://github.com/ochko/flow_pagination
|
41
|
+
licenses: []
|
42
|
+
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options:
|
45
|
+
- --line-numbers
|
46
|
+
- --inline-source
|
47
|
+
- --title
|
48
|
+
- Flow_pagination
|
49
|
+
- --main
|
50
|
+
- README.rdoc
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
hash: 11
|
68
|
+
segments:
|
69
|
+
- 1
|
70
|
+
- 2
|
71
|
+
version: "1.2"
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project: flow_pagination
|
75
|
+
rubygems_version: 1.3.7
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: FlowPagination link renderer plugin for Mislav's WillPaginate plugin (Twitter like pagination).
|
79
|
+
test_files: []
|
80
|
+
|