genki-dm-pagination 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ module DmPagination
|
|
5
5
|
@pagination = pagination
|
6
6
|
@block = block
|
7
7
|
@options = args.last.kind_of?(Hash) ? args.pop : {}
|
8
|
-
@args = args.blank? ? [:prev, :pages, :next] :
|
8
|
+
@args = args.blank? ? [:prev, :pages, :next] : args
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_s(*args)
|
@@ -65,15 +65,15 @@ module DmPagination
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def truncate
|
68
|
-
@options[:truncate] ||
|
68
|
+
@options[:truncate] || Merb::Plugins.config[:dm_pagination][:truncate]
|
69
69
|
end
|
70
70
|
|
71
71
|
def prev_label
|
72
|
-
@options[:prev] ||
|
72
|
+
@options[:prev] || Merb::Plugins.config[:dm_pagination][:prev_label]
|
73
73
|
end
|
74
74
|
|
75
75
|
def next_label
|
76
|
-
@options[:next] ||
|
76
|
+
@options[:next] || Merb::Plugins.config[:dm_pagination][:next_label]
|
77
77
|
end
|
78
78
|
|
79
79
|
def url(params)
|
data/lib/dm-pagination.rb
CHANGED
@@ -3,7 +3,9 @@ if defined?(Merb::Plugins)
|
|
3
3
|
|
4
4
|
# Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
|
5
5
|
Merb::Plugins.config[:dm_pagination] = {
|
6
|
-
:
|
6
|
+
:prev_label => '« Prev',
|
7
|
+
:next_label => 'Next »',
|
8
|
+
:truncate => '...'
|
7
9
|
}
|
8
10
|
|
9
11
|
Merb::BootLoader.before_app_loads do
|
data/spec/dm-pagination_spec.rb
CHANGED
@@ -73,6 +73,13 @@ describe "dm-pagination" do
|
|
73
73
|
response = request "/pagination_builder/simple", :params => {:page => 2}
|
74
74
|
response.should be_successful
|
75
75
|
response.should have_selector("a[rel=prev]")
|
76
|
+
response.body.scan(/Prev|Next/).should == %w(Prev Next)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should be able to control links" do
|
80
|
+
response = request "/pagination_builder/variant"
|
81
|
+
response.should be_successful
|
82
|
+
response.body.scan(/Prev|Next/).should == %w(Next Prev)
|
76
83
|
end
|
77
84
|
end
|
78
85
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= paginate @posts, :pages, :next, :prev %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genki-dm-pagination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Takiuchi
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- spec/fixture/app/views/layout/application.html.erb
|
55
55
|
- spec/fixture/app/views/pagination_builder
|
56
56
|
- spec/fixture/app/views/pagination_builder/simple.html.erb
|
57
|
+
- spec/fixture/app/views/pagination_builder/variant.html.erb
|
57
58
|
- spec/fixture/config
|
58
59
|
- spec/fixture/config/router.rb
|
59
60
|
- spec/merb_test.log
|