pagify 0.7.1 → 0.8.0
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/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/CHANGES.md +78 -0
- data/CONTRIBUTORS +2 -0
- data/Gemfile +14 -0
- data/README.md +157 -0
- data/Rakefile +12 -30
- data/{TODO → TODO.md} +5 -3
- data/lib/pagify/helper/detail/setting.rb +1 -1
- data/lib/pagify/helper/html.rb +24 -11
- data/lib/pagify/pagifier/active_record.rb +7 -1
- data/lib/pagify/version.rb +1 -1
- data/pagify.gemspec +69 -29
- data/task/.gitignore +1 -0
- data/task/gemgem.rb +265 -0
- data/test/helper.rb +1 -8
- data/test/helper_web.rb +3 -3
- data/test/test_active_record.rb +21 -9
- data/test/test_array.rb +7 -2
- data/test/test_basic.rb +7 -2
- data/test/test_data_mapper.rb +10 -3
- data/test/test_html.rb +33 -15
- data/test/test_innate.rb +8 -2
- data/test/test_null.rb +5 -1
- data/test/test_rails.rb +8 -2
- metadata +42 -115
- data/CHANGES +0 -56
- data/NOTICE +0 -5
- data/README +0 -152
- data/spec/pagify_spec.rb +0 -8
- data/spec/spec_helper.rb +0 -17
data/test/test_innate.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'helper'
|
4
|
+
require_relative 'helper_web'
|
5
|
+
else
|
6
|
+
require 'test/helper'
|
7
|
+
require 'test/helper_web'
|
8
|
+
end
|
9
|
+
|
4
10
|
require 'pagify/helper/innate'
|
5
11
|
|
6
12
|
class TestInnate < TestCase
|
data/test/test_null.rb
CHANGED
data/test/test_rails.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'helper'
|
4
|
+
require_relative 'helper_web'
|
5
|
+
else
|
6
|
+
require 'test/helper'
|
7
|
+
require 'test/helper_web'
|
8
|
+
end
|
9
|
+
|
4
10
|
require 'pagify/helper/rails'
|
5
11
|
|
6
12
|
class TestRails < TestCase
|
metadata
CHANGED
@@ -1,100 +1,34 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagify
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 7
|
8
|
-
- 1
|
9
|
-
version: 0.7.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
-
|
7
|
+
authors:
|
8
|
+
- Lin Jen-Shin (godfat)
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
12
|
+
date: 2011-11-16 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! 'Pagination tools for Array(or custom class), DataMapper and ActiveRecord.
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: dm-core
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
- 10
|
30
|
-
- 1
|
31
|
-
version: 0.10.1
|
32
|
-
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: dm-aggregates
|
36
|
-
prerelease: false
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 0
|
43
|
-
- 10
|
44
|
-
- 1
|
45
|
-
version: 0.10.1
|
46
|
-
type: :development
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: activerecord
|
50
|
-
prerelease: false
|
51
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 2
|
57
|
-
- 3
|
58
|
-
- 4
|
59
|
-
version: 2.3.4
|
60
|
-
type: :development
|
61
|
-
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: bones
|
64
|
-
prerelease: false
|
65
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
segments:
|
70
|
-
- 3
|
71
|
-
- 4
|
72
|
-
- 1
|
73
|
-
version: 3.4.1
|
74
|
-
type: :development
|
75
|
-
version_requirements: *id004
|
76
|
-
description: " Pagination tools for Array(or custom class), DataMapper and ActiveRecord\n Helpers for Innate/Ramaze and Rails included."
|
77
|
-
email: godfat (XD) godfat.org
|
16
|
+
Helpers for Innate/Ramaze and Rails included.'
|
17
|
+
email:
|
18
|
+
- godfat (XD) godfat.org
|
78
19
|
executables: []
|
79
|
-
|
80
20
|
extensions: []
|
81
|
-
|
82
|
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
- TODO
|
89
|
-
- misc.txt
|
90
|
-
- pagify.gemspec
|
91
|
-
files:
|
92
|
-
- CHANGES
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- .gitmodules
|
25
|
+
- CHANGES.md
|
26
|
+
- CONTRIBUTORS
|
27
|
+
- Gemfile
|
93
28
|
- LICENSE
|
94
|
-
-
|
95
|
-
- README
|
29
|
+
- README.md
|
96
30
|
- Rakefile
|
97
|
-
- TODO
|
31
|
+
- TODO.md
|
98
32
|
- lib/pagify.rb
|
99
33
|
- lib/pagify/active_record.rb
|
100
34
|
- lib/pagify/array.rb
|
@@ -121,8 +55,8 @@ files:
|
|
121
55
|
- lib/pagify/version.rb
|
122
56
|
- misc.txt
|
123
57
|
- pagify.gemspec
|
124
|
-
-
|
125
|
-
-
|
58
|
+
- task/.gitignore
|
59
|
+
- task/gemgem.rb
|
126
60
|
- test/helper.rb
|
127
61
|
- test/helper_model.rb
|
128
62
|
- test/helper_pagify.rb
|
@@ -135,38 +69,31 @@ files:
|
|
135
69
|
- test/test_innate.rb
|
136
70
|
- test/test_null.rb
|
137
71
|
- test/test_rails.rb
|
138
|
-
|
139
|
-
homepage: http://github.com/godfat/pagify
|
72
|
+
homepage: https://github.com/godfat/pagify
|
140
73
|
licenses: []
|
141
|
-
|
142
74
|
post_install_message:
|
143
|
-
rdoc_options:
|
144
|
-
|
145
|
-
- README
|
146
|
-
require_paths:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
147
77
|
- lib
|
148
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
requirements:
|
157
|
-
- -
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
|
160
|
-
- 0
|
161
|
-
version: "0"
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
162
90
|
requirements: []
|
163
|
-
|
164
|
-
|
165
|
-
rubygems_version: 1.3.6
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 1.8.11
|
166
93
|
signing_key:
|
167
94
|
specification_version: 3
|
168
|
-
summary: Pagination tools for Array(or custom class), DataMapper and ActiveRecord
|
169
|
-
test_files:
|
95
|
+
summary: Pagination tools for Array(or custom class), DataMapper and ActiveRecord.
|
96
|
+
test_files:
|
170
97
|
- test/test_active_record.rb
|
171
98
|
- test/test_array.rb
|
172
99
|
- test/test_basic.rb
|
data/CHANGES
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
= pagify changes history
|
2
|
-
|
3
|
-
== pagify 0.7.1 / 2010-04-26
|
4
|
-
* fix the problem that RUBY_VERSION is forzen,
|
5
|
-
just use lexical string comparsion then.
|
6
|
-
|
7
|
-
== pagify 0.7.0 / 2009-11-16
|
8
|
-
* added innate helper.
|
9
|
-
* some internal refactoring
|
10
|
-
|
11
|
-
== pagify 0.6.2 / 2009-08-08
|
12
|
-
* no joke now, use pagify_links instead of would_paginate.
|
13
|
-
* now you can define your own pagify_links and call super
|
14
|
-
in ApplicationHelper.
|
15
|
-
* added a links_type option for rails helper,
|
16
|
-
telling which html helper method you would like.
|
17
|
-
default to HTML#links_full
|
18
|
-
|
19
|
-
== pagify 0.6.1 / 2009-07-30
|
20
|
-
* first rubyforge gem release!
|
21
|
-
* rearranged require call.
|
22
|
-
* use normal form for dir and module name
|
23
|
-
* removed pagify pager cache, it's not useful
|
24
|
-
* added rails helper (i.e. would_pagiante)
|
25
|
-
* fixed that NullPage from pagers other than NullPager,
|
26
|
-
it should always acts as an empty array.
|
27
|
-
|
28
|
-
==
|
29
|
-
policy changed. null page was no longer a singleton. see reason below:
|
30
|
-
|
31
|
-
i encountered a strange problem, where:
|
32
|
-
|
33
|
-
pager[10].pager.per_page != pager[1].pager.per_page
|
34
|
-
|
35
|
-
because BasicPage#pager would refer to original pager,
|
36
|
-
while NullPage#pager would always refer to NullPager's singleton.
|
37
|
-
|
38
|
-
i think i should have not made NullPage be a singleton,
|
39
|
-
because we got have some way to keep page.pager.per_page
|
40
|
-
consist to the value we original setup. then we could write
|
41
|
-
something like this:
|
42
|
-
|
43
|
-
(0...page.pager.per_page).each{ ... }
|
44
|
-
|
45
|
-
that is, we don't have to keep pager around, and if you have
|
46
|
-
page, then you have pager. so now that NullPage was no longer
|
47
|
-
a singleton, and null_page.pager would return the original pager.
|
48
|
-
|
49
|
-
keep NullPager being a singleton though, and it should always
|
50
|
-
return the same page which refer the singleton null pager.
|
51
|
-
|
52
|
-
== pagify 0.5 / 2008-10-11
|
53
|
-
|
54
|
-
* 1 major enhancement
|
55
|
-
* Birthday!
|
56
|
-
* extracted from Ludy::Paginator!
|
data/NOTICE
DELETED
data/README
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
= pagify 0.7.1
|
2
|
-
by Lin Jen-Shin (aka godfat-真常[http://godfat.org])
|
3
|
-
godfat (XD) godfat.org
|
4
|
-
|
5
|
-
== LINKS:
|
6
|
-
|
7
|
-
* github-project[http://github.com/godfat/pagify]
|
8
|
-
* rubyforge-project[http://rubyforge.org/projects/ludy]
|
9
|
-
|
10
|
-
== DESCRIPTION:
|
11
|
-
|
12
|
-
Pagination tools for Array(or custom class), DataMapper and ActiveRecord
|
13
|
-
Helpers for Innate/Ramaze and Rails included.
|
14
|
-
|
15
|
-
== FEATURES:
|
16
|
-
|
17
|
-
* Aims to be as flexible as possible
|
18
|
-
* Separate intrusive "pagify" method and Array/DataMapper/ActiveRecord Pager.
|
19
|
-
* Separate view helpers. There's only html helper right now.
|
20
|
-
* Web framework specific helper included. Currently for Innate/Ramaze and Rails.
|
21
|
-
|
22
|
-
== SYNOPSIS:
|
23
|
-
|
24
|
-
# for fast Rails will_paginate replacement:
|
25
|
-
require 'pagify/active_record'
|
26
|
-
require 'pagify/helper/rails'
|
27
|
-
|
28
|
-
# in controller:
|
29
|
-
@photos = Photo.pagify(:page => params[:page])
|
30
|
-
|
31
|
-
# in view:
|
32
|
-
pagify_links(@photos)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
# for Innate/Ramaze:
|
37
|
-
require 'pagify'
|
38
|
-
require 'pagify/helper/innate'
|
39
|
-
|
40
|
-
# in controller, say you want pagify helper:
|
41
|
-
class Controller < Ramaze::Controller
|
42
|
-
helper :pagify
|
43
|
-
end
|
44
|
-
|
45
|
-
# for the data part, see DataMapperPager or ActiveRecordPager
|
46
|
-
# in view, same as in Rails
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
# basic DataMapper usage:
|
51
|
-
require 'pagify/data_mapper'
|
52
|
-
|
53
|
-
class User
|
54
|
-
include DataMapper::Resource
|
55
|
-
property :id, Serial
|
56
|
-
property :name, String
|
57
|
-
has n, :pets
|
58
|
-
end
|
59
|
-
|
60
|
-
class Pet
|
61
|
-
include DataMapper::Resource
|
62
|
-
property :id, Serial
|
63
|
-
property :name, String
|
64
|
-
belongs_to :user
|
65
|
-
end
|
66
|
-
|
67
|
-
User.pagify :page => 1, :per_page => 10 # => create a page contains users
|
68
|
-
User.all(:name => 'godfat').pagify # => create a page contains users named godfat
|
69
|
-
|
70
|
-
User.get(1).pets.pagify # => create a page contains pets owned by user 1
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
# basic html helper usage:
|
75
|
-
require 'pagify/helper/html'
|
76
|
-
|
77
|
-
# create a string with page links.
|
78
|
-
Pet.pagify.pager.html.links(params[:page]){ |page|
|
79
|
-
# the block result would be used as url for each page
|
80
|
-
"/pets/list?page=#{page}"
|
81
|
-
}
|
82
|
-
|
83
|
-
Pagify::Helper::HTML.setting[:prev_text] = '<]' # globally change html setting
|
84
|
-
# NOTE: if you would like to use instance level setting, you shouldn't use method pagify,
|
85
|
-
# NOTE: new your own DataMapperPager or so to remember instance level html setting.
|
86
|
-
# NOTE: for example, see below:
|
87
|
-
|
88
|
-
class Pet
|
89
|
-
# same as above
|
90
|
-
def self.page num
|
91
|
-
@pager ||= begin
|
92
|
-
pager = Pagify::DataMapperPager.new(:per_page => 20)
|
93
|
-
# below would be pager instance level setting
|
94
|
-
# you can setup global setting mentioned above in your init script perhaps
|
95
|
-
pager.html.setting[:separator] = ' . '
|
96
|
-
pager.html.setting[:ellipsis] = '...'
|
97
|
-
pager
|
98
|
-
end
|
99
|
-
@pager.page(num)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
# then you would use Pet.page(3) or user.pets.page(2) to retrieve data
|
104
|
-
|
105
|
-
# this would create next/prev links only.
|
106
|
-
Pet.page(1).html.links_navigate{ |page|
|
107
|
-
"/pets/list?page=#{page}"
|
108
|
-
}
|
109
|
-
|
110
|
-
# this would create next/prev links and other page links
|
111
|
-
pet_pager.page(1).html.links_full{ |page|
|
112
|
-
"/pets/show?page=#{page}"
|
113
|
-
}
|
114
|
-
|
115
|
-
# and you can build your pager from scratch via BasicPager.
|
116
|
-
# e.g. BasicPager.new :fetcher => lambda{|*a|[]}, :counter => lambda{0}
|
117
|
-
# this would be similar to Pagify::NullPager.
|
118
|
-
|
119
|
-
# you can disable null page via passing :null_page => false to any pager,
|
120
|
-
# or set pager.null_page = false; anytime.
|
121
|
-
|
122
|
-
# see example or test for more examples (and use case for ActiveRecordPager).
|
123
|
-
|
124
|
-
== REQUIREMENTS:
|
125
|
-
|
126
|
-
* ruby 1.8+ or 1.9.1+
|
127
|
-
* for Basic/ArrayPager: only ruby is needed
|
128
|
-
* for DataMapperPager: dm-core and dm-aggregates 0.10.1+
|
129
|
-
* for ActiveRecordPager: activerecord 2.3.4+
|
130
|
-
* for Innate helper: innate 2009.07+
|
131
|
-
|
132
|
-
== INSTALL:
|
133
|
-
|
134
|
-
* gem install pagify
|
135
|
-
|
136
|
-
== LICENSE:
|
137
|
-
|
138
|
-
Apache License 2.0
|
139
|
-
|
140
|
-
Copyright (c) 2008-2009, Lin Jen-Shin (aka godfat 真常)
|
141
|
-
|
142
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
143
|
-
you may not use this file except in compliance with the License.
|
144
|
-
You may obtain a copy of the License at
|
145
|
-
|
146
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
147
|
-
|
148
|
-
Unless required by applicable law or agreed to in writing, software
|
149
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
150
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
151
|
-
See the License for the specific language governing permissions and
|
152
|
-
limitations under the License.
|