flow_pagination 1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.
@@ -0,0 +1,6 @@
1
+ Manifest
2
+ README.rdoc
3
+ Rakefile
4
+ init.rb
5
+ lib/flow_pagination.rb
6
+ MIT-LICENSE
@@ -0,0 +1,70 @@
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
+ :source => 'http://gems.github.com'
27
+
28
+ config.gem 'mexpolk-flow_pagination', :lib => 'flow_pagination',
29
+ :source => 'http://gems.github.com'
30
+ [...]
31
+ end
32
+
33
+ To install these gems type the following rake task:
34
+
35
+ rake gems:install
36
+
37
+ === Install It as a Plugin
38
+
39
+ script/plugin install git://github.com/mislav/will_paginate.git
40
+ script/plugin install git://github.com/mexpolk/flow_pagination.git
41
+
42
+ == Usage
43
+
44
+ There's flow_pagination_example[http://github.com/mexpolk/flow_pagination_example/tree/master]
45
+ application to see this gem in action.
46
+
47
+ Enjoy!
48
+
49
+ == License
50
+
51
+ Copyright (c) 2009 Iván Torres
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining
54
+ a copy of this software and associated documentation files (the
55
+ "Software"), to deal in the Software without restriction, including
56
+ without limitation the rights to use, copy, modify, merge, publish,
57
+ distribute, sublicense, and/or sell copies of the Software, and to
58
+ permit persons to whom the Software is furnished to do so, subject to
59
+ the following conditions:
60
+
61
+ The above copyright notice and this permission notice shall be
62
+ included in all copies or substantial portions of the Software.
63
+
64
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
65
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
66
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
67
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
68
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
69
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
70
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -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{flow_pagination}
5
+ s.version = "1.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Ivan Torres"]
9
+ s.date = %q{2009-08-12}
10
+ s.description = %q{FlowPagination link renderer plugin for Mislav's WillPaginate plugin (Twitter like pagination).}
11
+ s.email = %q{mexpolk@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/mexpolk/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,42 @@
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 => { :controller => @template.controller_name,
14
+ :action => @template.action_name,
15
+ :params => @template.params.merge!(:page => self.next_page)},
16
+ :method => @template.request.request_method)
17
+ end
18
+
19
+ @template.content_tag(:div, flow_pagination, :id => 'flow_pagination')
20
+
21
+ end
22
+
23
+ protected
24
+
25
+ # Get current page number
26
+ def current_page
27
+ @collection.current_page
28
+ end
29
+
30
+ # Get last page number
31
+ def last_page
32
+ @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)
33
+ end
34
+
35
+ # Get next page number
36
+ def next_page
37
+ @collection.next_page
38
+ end
39
+
40
+ end
41
+
42
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flow_pagination
3
+ version: !ruby/object:Gem::Version
4
+ version: "1.1"
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Torres
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-12 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: FlowPagination link renderer plugin for Mislav's WillPaginate plugin (Twitter like pagination).
17
+ email: mexpolk@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ - lib/flow_pagination.rb
25
+ files:
26
+ - Manifest
27
+ - README.rdoc
28
+ - Rakefile
29
+ - init.rb
30
+ - lib/flow_pagination.rb
31
+ - MIT-LICENSE
32
+ - flow_pagination.gemspec
33
+ has_rdoc: true
34
+ homepage: http://github.com/mexpolk/flow_pagination
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options:
39
+ - --line-numbers
40
+ - --inline-source
41
+ - --title
42
+ - Flow_pagination
43
+ - --main
44
+ - README.rdoc
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "1.2"
58
+ version:
59
+ requirements: []
60
+
61
+ rubyforge_project: flow_pagination
62
+ rubygems_version: 1.3.5
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: FlowPagination link renderer plugin for Mislav's WillPaginate plugin (Twitter like pagination).
66
+ test_files: []
67
+