pagify 0.6.1 → 0.6.2

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.
data/CHANGES CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  == pagify 1.0 / ?
4
4
 
5
+ == pagify 0.6.2 / 2009-08-08
6
+ * no joke now, use pagify_links instead of would_paginate.
7
+ * now you can define your own pagify_links and call super
8
+ in ApplicationHelper.
9
+ * added a links_type option for rails helper,
10
+ telling which html helper method you would like.
11
+ default to HTML#links_full
12
+
5
13
  == pagify 0.6.1 / 2009-07-30
6
14
  * first rubyforge gem release!
7
15
  * rearranged require call.
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = pagify 0.6.1
1
+ = pagify 0.6.2
2
2
  by Lin Jen-Shin (aka godfat-真常[http://godfat.org])
3
3
  godfat (XD) godfat.org
4
4
 
@@ -27,7 +27,7 @@ by Lin Jen-Shin (aka godfat-真常[http://godfat.org])
27
27
  @photos = Photo.pagify(:page => params[:page])
28
28
 
29
29
  # in view:
30
- would_paginate(@photos)
30
+ pagify_links(@photos)
31
31
 
32
32
 
33
33
 
@@ -107,10 +107,10 @@ by Lin Jen-Shin (aka godfat-真常[http://godfat.org])
107
107
 
108
108
  == REQUIREMENTS:
109
109
 
110
- * ruby 1.8+ or 1.9.1
111
- * for Basic/Array Pager: only ruby is needed
112
- * for DataMapper Pager: dm-core and dm-aggregates 0.9.6 and above
113
- * for ActiveRecord Pager: activerecord 2.1.1 and above
110
+ * ruby 1.8+ or 1.9.1+
111
+ * for Basic/ArrayPager: only ruby is needed
112
+ * for DataMapperPager: dm-core and dm-aggregates 0.9.9+
113
+ * for ActiveRecordPager: activerecord 2.1.1+
114
114
 
115
115
  == INSTALL:
116
116
 
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ PROJ.rubyforge.name = 'ludy'
11
11
 
12
12
  PROJ.gem.development_dependencies << ['dm-core', '>=0.9.9'] <<
13
13
  ['dm-aggregates', '>=0.9.9'] <<
14
- ['activerecord', '>=2.0.0']
14
+ ['activerecord', '>=2.1.1']
15
15
 
16
16
  # supress warnings, there's too many warnings in dm-core
17
17
  PROJ.ruby_opts.delete '-w'
data/TODO CHANGED
@@ -1,8 +1,5 @@
1
1
  = pagify todo list
2
2
 
3
- == current
4
- * update README for better understanding, in use case
5
-
6
3
  == 1.0+
7
4
  * default chinese html setting
8
5
  * cooperate with DataMapper::Collection,
@@ -3,7 +3,23 @@ require 'pagify/helper/html'
3
3
 
4
4
  module Pagify::Helper::Rails
5
5
  def default_attributes
6
- super.merge(:query_name => :page, :wrapper_class => 'pagination')
6
+ super.merge(:query_name => :page, :wrapper_class => 'pagination',
7
+ :links_type => :links_full)
8
+ end
9
+
10
+ module ApplicationHelper
11
+ def pagify_links objs, &path
12
+ path = lambda{ request.path } unless block_given?
13
+ html = objs.pager.html
14
+ name = html.setting[:query_name]
15
+ type = html.setting[:links_type]
16
+ base = path.call
17
+ "<div class=\"#{html.setting[:wrapper_class]}\">" +
18
+ html.send(type, params[name]){ |p| base + "?#{name}=#{p}" } +
19
+ '</div>'
20
+ end
21
+
22
+ alias_method :would_paginate, :pagify_links
7
23
  end
8
24
  end
9
25
 
@@ -12,12 +28,5 @@ class Pagify::Helper::HTML
12
28
  end
13
29
 
14
30
  module ApplicationHelper
15
- def would_paginate objs, &path
16
- path = lambda{ request.path } unless block_given?
17
- html = objs.pager.html
18
- name = html.setting[:query_name]
19
- "<div class=\"#{html.setting[:wrapper_class]}\">" +
20
- html.links_full(params[name]){ |p| path.call + "?#{name}=#{p}" } +
21
- '</div>'
22
- end
31
+ include Pagify::Helper::Rails::ApplicationHelper
23
32
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Pagify
3
- VERSION = '0.6.1'
3
+ VERSION = '0.6.2'
4
4
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pagify}
5
- s.version = "0.6.1"
5
+ s.version = "0.6.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Lin Jen-Shin (aka godfat \347\234\237\345\270\270)"]
9
- s.date = %q{2009-07-30}
9
+ s.date = %q{2009-08-08}
10
10
  s.description = %q{ Pagination tools for Array(or custom class), DataMapper and ActiveRecord}
11
11
  s.email = %q{godfat (XD) godfat.org}
12
12
  s.extra_rdoc_files = ["CHANGES", "LICENSE", "NOTICE", "README", "TODO", "pagify.gemspec"]
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.rdoc_options = ["--charset=utf-8", "--inline-source", "--line-numbers", "--promiscuous", "--main", "README"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{ludy}
18
- s.rubygems_version = %q{1.3.4}
18
+ s.rubygems_version = %q{1.3.5}
19
19
  s.summary = %q{Pagination tools for Array(or custom class), DataMapper and ActiveRecord}
20
20
  s.test_files = ["test/test_active_record.rb", "test/test_array.rb", "test/test_basic.rb", "test/test_data_mapper.rb", "test/test_html.rb", "test/test_null.rb", "test/test_rails.rb"]
21
21
 
@@ -27,17 +27,17 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency(%q<bones>, [">= 2.5.1"])
28
28
  s.add_development_dependency(%q<dm-core>, [">= 0.9.9"])
29
29
  s.add_development_dependency(%q<dm-aggregates>, [">= 0.9.9"])
30
- s.add_development_dependency(%q<activerecord>, [">= 2.0.0"])
30
+ s.add_development_dependency(%q<activerecord>, [">= 2.1.1"])
31
31
  else
32
32
  s.add_dependency(%q<bones>, [">= 2.5.1"])
33
33
  s.add_dependency(%q<dm-core>, [">= 0.9.9"])
34
34
  s.add_dependency(%q<dm-aggregates>, [">= 0.9.9"])
35
- s.add_dependency(%q<activerecord>, [">= 2.0.0"])
35
+ s.add_dependency(%q<activerecord>, [">= 2.1.1"])
36
36
  end
37
37
  else
38
38
  s.add_dependency(%q<bones>, [">= 2.5.1"])
39
39
  s.add_dependency(%q<dm-core>, [">= 0.9.9"])
40
40
  s.add_dependency(%q<dm-aggregates>, [">= 0.9.9"])
41
- s.add_dependency(%q<activerecord>, [">= 2.0.0"])
41
+ s.add_dependency(%q<activerecord>, [">= 2.1.1"])
42
42
  end
43
43
  end
@@ -23,10 +23,14 @@ class TestRails < TestCase
23
23
  end
24
24
 
25
25
  def test_would_paginate
26
- assert_equal('<div class="pagination"><a href="/a/b?page=2">&lt; Previous</a> <a href="/a/b?page=4">Next &gt;</a><br /><a href="/a/b?page=1">&laquo; First</a> <a href="/a/b?page=2">2</a> 3 <a href="/a/b?page=4">4</a> <a href="/a/b?page=5">Last &raquo;</a></div>', would_paginate(@data))
26
+ assert_equal('<div class="pagination"><a href="/a/b?page=2">&lt; Previous</a> <a href="/a/b?page=4">Next &gt;</a><br /><a href="/a/b?page=1">&laquo; First</a> <a href="/a/b?page=2">2</a> 3 <a href="/a/b?page=4">4</a> <a href="/a/b?page=5">Last &raquo;</a></div>', pagify_links(@data))
27
+
28
+ @data.pager.html.setting[:links_type] = :links
29
+
30
+ assert_equal('<div class="pagination"><a href="/a/b?page=1">&laquo; First</a> <a href="/a/b?page=2">2</a> 3 <a href="/a/b?page=4">4</a> <a href="/a/b?page=5">Last &raquo;</a></div>', pagify_links(@data))
27
31
  end
28
32
 
29
33
  def test_custom_path
30
- assert_equal('<div class="pagination"><a href="XD?page=2">&lt; Previous</a> <a href="XD?page=4">Next &gt;</a><br /><a href="XD?page=1">&laquo; First</a> <a href="XD?page=2">2</a> 3 <a href="XD?page=4">4</a> <a href="XD?page=5">Last &raquo;</a></div>', would_paginate(@data){'XD'})
34
+ assert_equal('<div class="pagination"><a href="XD?page=2">&lt; Previous</a> <a href="XD?page=4">Next &gt;</a><br /><a href="XD?page=1">&laquo; First</a> <a href="XD?page=2">2</a> 3 <a href="XD?page=4">4</a> <a href="XD?page=5">Last &raquo;</a></div>', pagify_links(@data){'XD'})
31
35
  end
32
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Lin Jen-Shin (aka godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-30 00:00:00 +08:00
12
+ date: 2009-08-08 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 2.0.0
53
+ version: 2.1.1
54
54
  version:
55
55
  description: " Pagination tools for Array(or custom class), DataMapper and ActiveRecord"
56
56
  email: godfat (XD) godfat.org
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  requirements: []
150
150
 
151
151
  rubyforge_project: ludy
152
- rubygems_version: 1.3.4
152
+ rubygems_version: 1.3.5
153
153
  signing_key:
154
154
  specification_version: 3
155
155
  summary: Pagination tools for Array(or custom class), DataMapper and ActiveRecord