leaf 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +16 -2
- data/Rakefile +4 -4
- data/lib/leaf.rb +7 -2
- data/lib/leaf/finders/sequel.rb +1 -0
- data/lib/leaf/version.rb +3 -3
- data/lib/leaf/view_helpers/base.rb +16 -8
- data/lib/leaf/view_helpers/sinatra.rb +1 -1
- data/locales/en.yml +11 -0
- data/locales/sv.yml +11 -0
- metadata +21 -3
data/README.rdoc
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
= Leaf
|
2
2
|
|
3
|
-
A _really_ simple pagination library
|
4
|
-
|
3
|
+
A _really_ simple pagination library
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
The recommended way is that you get the gem
|
8
|
+
|
9
|
+
gem install leaf
|
10
|
+
|
11
|
+
== Example usage
|
12
|
+
|
13
|
+
== Authors and credits
|
14
|
+
|
15
|
+
Leaf is heavily based on the agnostic branch of
|
16
|
+
{will_paginate}[http://github.com/mislav/will_paginate/tree/agnostic].
|
17
|
+
will_paginate was originally written by PJ Hyett, who later handed over
|
18
|
+
development to Mislav Marohnić. (The library was completely rewritten since then.)
|
data/Rakefile
CHANGED
@@ -11,10 +11,10 @@ desc 'Generate RDoc documentation for the leaf gem.'
|
|
11
11
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
12
12
|
rdoc.rdoc_files.include('README.rdoc', 'MIT-LICENSE').
|
13
13
|
include('lib/**/*.rb').
|
14
|
-
exclude('lib/
|
15
|
-
exclude('lib/
|
16
|
-
exclude('lib/
|
17
|
-
exclude('lib/
|
14
|
+
exclude('lib/leaf/finders/sequel.rb').
|
15
|
+
exclude('lib/leaf/view_helpers/sinatra.rb').
|
16
|
+
exclude('lib/leaf/core_ext.rb').
|
17
|
+
exclude('lib/leaf/version.rb')
|
18
18
|
|
19
19
|
rdoc.main = "README.rdoc" # page to start on
|
20
20
|
rdoc.title = "leaf documentation"
|
data/lib/leaf.rb
CHANGED
data/lib/leaf/finders/sequel.rb
CHANGED
data/lib/leaf/version.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
+
require 'i18n'
|
1
2
|
require 'leaf/core_ext'
|
2
3
|
require 'leaf/view_helpers'
|
3
4
|
|
5
|
+
# REPLACE WITH REAL CODE :)
|
6
|
+
['sv', 'en'].each do |locale|
|
7
|
+
I18n.load_path << "locales/#{locale}.yml"
|
8
|
+
end
|
9
|
+
|
4
10
|
module Leaf
|
5
11
|
module ViewHelpers
|
6
12
|
# = The main view helpers module
|
@@ -104,16 +110,18 @@ module Leaf
|
|
104
110
|
|
105
111
|
if collection.total_pages < 2
|
106
112
|
case collection.size
|
107
|
-
when 0;
|
108
|
-
when 1;
|
109
|
-
else;
|
113
|
+
when 0; I18n::t('leaf.page_entries_info.one_page.nothing', :plural_name => plural_name)
|
114
|
+
when 1; I18n::t('leaf.page_entries_info.one_page.one', :b => b, :eb => eb, :entry_name => entry_name)
|
115
|
+
else; I18n::t('leaf.page_entries_info.one_page.many', :b => b, :collection_size => collection.size, :eb => eb, :plural_name => plural_name)
|
110
116
|
end
|
111
117
|
else
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
collection.
|
116
|
-
|
118
|
+
I18n::t('leaf.page_entries_info.default',
|
119
|
+
:plural_name => plural_name,
|
120
|
+
:b => b, :sp => sp, :eb => eb,
|
121
|
+
:from_number => (collection.offset + 1),
|
122
|
+
:to_number => (collection.offset + collection.length),
|
123
|
+
:total_entries => collection.total_entries
|
124
|
+
)
|
117
125
|
end
|
118
126
|
end
|
119
127
|
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# English
|
2
|
+
en:
|
3
|
+
leaf:
|
4
|
+
next_label: "Next →"
|
5
|
+
previous_label: "← Previous"
|
6
|
+
page_entries_info:
|
7
|
+
one_page:
|
8
|
+
nothing: "No %{plural_name} found"
|
9
|
+
one: "Displaying %{b}1%{eb} %{entry_name}"
|
10
|
+
many: "Displaying %{b}all %{collection_size}%{eb} %{plural_name}"
|
11
|
+
default: "Displaying %{plural_name} %{b}%{from_number}%{sp}-%{sp}%{to_number}%{eb} of %{b}%{total_entries}%{eb} in total"
|
data/locales/sv.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Swedish
|
2
|
+
sv:
|
3
|
+
leaf:
|
4
|
+
next_label: "Nästa →"
|
5
|
+
previous_label: "← Föregående"
|
6
|
+
page_entries_info:
|
7
|
+
one_page:
|
8
|
+
nothing: "Hittade inga %{plural_name}"
|
9
|
+
one: "Visar %{b}1%{eb} %{entry_name}"
|
10
|
+
many: "Visar %{b}alla %{collection_size}%{eb} %{plural_name}"
|
11
|
+
default: "Visar %{plural_name} %{b}%{from_number}%{sp}-%{sp}%{to_number}%{eb} av totalt %{b}%{total_entries}%{eb}"
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.2
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peter Hellberg
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-27 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -34,6 +34,22 @@ dependencies:
|
|
34
34
|
version: 1.2.0
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: i18n
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 15
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 4
|
49
|
+
- 0
|
50
|
+
version: 0.4.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
37
53
|
description: A really simple pagination library for Sinatra
|
38
54
|
email: peter@c7.se
|
39
55
|
executables: []
|
@@ -57,6 +73,8 @@ files:
|
|
57
73
|
- lib/leaf/view_helpers/sinatra.rb
|
58
74
|
- lib/leaf/view_helpers.rb
|
59
75
|
- lib/leaf.rb
|
76
|
+
- locales/en.yml
|
77
|
+
- locales/sv.yml
|
60
78
|
- MIT-LICENSE
|
61
79
|
- Rakefile
|
62
80
|
- README.rdoc
|