foliate 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -2
- data/lib/foliate.rb +2 -0
- data/lib/foliate/config.rb +5 -3
- data/lib/foliate/controller.rb +0 -3
- data/lib/foliate/pagination.rb +13 -9
- data/lib/foliate/railtie.rb +2 -5
- data/lib/foliate/version.rb +1 -1
- data/lib/generators/foliate/install/install_generator.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bf9d741403e9509ce9f4f51ea941bdbf142992d38b46698572eb26cffd299e63
|
4
|
+
data.tar.gz: cd0e74a544f428e761bd6500de60d6b08d48b1da79c3fa8c0c8416f2577b2890
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c988806df2c9f3b434a2e7524fc2592c6cede5fb191de053c656636720a292d784f1d617202fe3e5c2cd5ec96a7b8e803d099adb05e46f4366901b34d61ba0
|
7
|
+
data.tar.gz: cd0f11d534ea497d34ec9da78edef335a3c7a9640f369cecdfb3b22b940b6d3d8ab7ed811532b9b78fa34bdea9482526205eb57a61dc04f4cba8be07f54da188
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ current page of records, as dictated by `params[:page]`.
|
|
26
26
|
|
27
27
|
Calling `paginate` also sets a `@pagination` instance variable for use
|
28
28
|
in the view. This object can be passed directly to `render`, which will
|
29
|
-
then render the "app/views/
|
29
|
+
then render the "app/views/application/_pagination.html.erb" view
|
30
30
|
partial:
|
31
31
|
|
32
32
|
```html
|
@@ -45,7 +45,7 @@ Do something with @posts here...
|
|
45
45
|
## Appearance
|
46
46
|
|
47
47
|
The *foliate* installation generator creates
|
48
|
-
"app/views/
|
48
|
+
"app/views/application/_pagination.html.erb" and
|
49
49
|
"app/assets/stylesheets/pagination.scss" in your project directory.
|
50
50
|
These files can be freely edited to suit your needs.
|
51
51
|
|
data/lib/foliate.rb
CHANGED
data/lib/foliate/config.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
module Foliate
|
2
2
|
|
3
3
|
class Config
|
4
|
+
# Default number of records to allot per page. Defaults to +10+.
|
5
|
+
#
|
4
6
|
# @return [Integer]
|
5
|
-
# default number of records to allot per page (defaults to +10+)
|
6
7
|
attr_accessor :default_per_page
|
7
8
|
|
9
|
+
# Name of query param used to indicate page number. Defaults to
|
10
|
+
# +:page+.
|
11
|
+
#
|
8
12
|
# @return [Symbol]
|
9
|
-
# request query param name for specifying page numbers (defaults
|
10
|
-
# to +:page+)
|
11
13
|
attr_accessor :page_param
|
12
14
|
|
13
15
|
def initialize
|
data/lib/foliate/controller.rb
CHANGED
data/lib/foliate/pagination.rb
CHANGED
@@ -1,30 +1,34 @@
|
|
1
|
-
require "foliate/config"
|
2
|
-
|
3
1
|
module Foliate
|
4
2
|
class Pagination
|
5
3
|
|
4
|
+
# Current page number.
|
5
|
+
#
|
6
6
|
# @return [Integer]
|
7
|
-
# current page number
|
8
7
|
attr_accessor :current_page
|
9
8
|
|
9
|
+
# Number of records per page.
|
10
|
+
#
|
10
11
|
# @return [Integer]
|
11
|
-
# number of records per page
|
12
12
|
attr_accessor :per_page
|
13
13
|
|
14
|
+
# Total number of records.
|
15
|
+
#
|
14
16
|
# @return [Integer]
|
15
|
-
# total number of records
|
16
17
|
attr_accessor :total_records
|
17
18
|
|
19
|
+
# Originating controller.
|
20
|
+
#
|
18
21
|
# @return [Symbol]
|
19
|
-
# originating controller
|
20
22
|
attr_accessor :controller
|
21
23
|
|
24
|
+
# Originating controller action.
|
25
|
+
#
|
22
26
|
# @return [Symbol]
|
23
|
-
# originating controller action
|
24
27
|
attr_accessor :action
|
25
28
|
|
29
|
+
# Originating request query params.
|
30
|
+
#
|
26
31
|
# @return [Hash]
|
27
|
-
# originating request query params
|
28
32
|
attr_accessor :query_params
|
29
33
|
|
30
34
|
# Computes the total number of pages based on {#total_records} and
|
@@ -129,7 +133,7 @@ module Foliate
|
|
129
133
|
#
|
130
134
|
# @return [String]
|
131
135
|
def to_partial_path
|
132
|
-
"pagination
|
136
|
+
"pagination"
|
133
137
|
end
|
134
138
|
|
135
139
|
module ParamsHelper
|
data/lib/foliate/railtie.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
|
-
require "rails/railtie"
|
2
|
-
require "foliate/controller"
|
3
|
-
|
4
1
|
module Foliate
|
5
2
|
# @!visibility private
|
6
3
|
class Railtie < Rails::Railtie
|
7
|
-
initializer
|
4
|
+
initializer "foliate" do |app|
|
8
5
|
ActiveSupport.on_load :action_controller do
|
9
|
-
|
6
|
+
include Foliate::Controller
|
10
7
|
end
|
11
8
|
end
|
12
9
|
end
|
data/lib/foliate/version.rb
CHANGED
@@ -12,11 +12,11 @@ module Foliate
|
|
12
12
|
|
13
13
|
def copy_config
|
14
14
|
template "config/initializer.rb.erb", "config/initializers/foliate.rb"
|
15
|
-
copy_file "config/locales.yml", "config/locales/foliate.yml"
|
15
|
+
copy_file "config/locales.yml", "config/locales/foliate.en.yml"
|
16
16
|
end
|
17
17
|
|
18
18
|
def copy_view
|
19
|
-
copy_file "views/page_input.html.erb", "app/views/
|
19
|
+
copy_file "views/page_input.html.erb", "app/views/application/_pagination.html.erb"
|
20
20
|
template "stylesheets/page_input.scss.erb", "app/assets/stylesheets/pagination.scss"
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foliate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Hefner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.7.6
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Rails pagination
|