moar 1.0.2 → 2.0.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.
- checksums.yaml +4 -4
- data/README.md +10 -15
- data/Rakefile +1 -20
- data/lib/moar/config.rb +4 -4
- data/lib/moar/context.rb +1 -1
- data/lib/moar/helper.rb +7 -7
- data/lib/moar/version.rb +1 -1
- metadata +9 -101
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a895b87216c86e0e74b174d7d03fa5c7f4bce2554fbc3f96bcdf474a66bc0f6a
|
|
4
|
+
data.tar.gz: 2bf55ae75c2fb8af69f527c04f8b092cbf16f931c146b7a898d3bdd846832681
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b8b851be39d2746c64f1eee3d6218a04d3ec6fbf2b64d253d834b648bb731f4f5f4d3de71c9a26e2cafc16c650c12ec1a47ec636baf4eb17a5648a83137b605
|
|
7
|
+
data.tar.gz: 1b3f6771cb3447fa8453aaad21f58da4c23e5fafcc3a8b6d635d3608b7f35d157fb41660308c294b34ae1faec968907a7eaccf3641266eef59c07972b93832ef
|
data/README.md
CHANGED
|
@@ -14,7 +14,7 @@ story:
|
|
|
14
14
|
* User clicks a "More posts" link; the browser navigates to a new page
|
|
15
15
|
listing the final 55 posts. No "More posts" link is rendered.
|
|
16
16
|
* At any point the user can manually refresh the page, and the same set
|
|
17
|
-
of posts will be shown. Likewise, the page can navigated away from
|
|
17
|
+
of posts will be shown. Likewise, the page can be navigated away from
|
|
18
18
|
and back to, or bookmarked and returned to later, and the same set of
|
|
19
19
|
posts will be shown. (Assuming the database remains unchanged.)
|
|
20
20
|
* If JavaScript is disabled, the first and second "More posts" links
|
|
@@ -71,9 +71,9 @@ A few things to note:
|
|
|
71
71
|
paginated results — no `if` required.
|
|
72
72
|
|
|
73
73
|
For complete usage details, see the documentation for
|
|
74
|
-
[`moar_increments`](
|
|
75
|
-
[`moar`](
|
|
76
|
-
[`link_to_more`](
|
|
74
|
+
[`moar_increments`](https://www.rubydoc.info/gems/moar/Moar/Controller/ClassMethods:moar_increments),
|
|
75
|
+
[`moar`](https://www.rubydoc.info/gems/moar/Moar/Controller:moar), and
|
|
76
|
+
[`link_to_more`](https://www.rubydoc.info/gems/moar/Moar/Helper:link_to_more).
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
## Configuration
|
|
@@ -94,21 +94,16 @@ For example, if the translation string is `"Need more %{results_name}!"`
|
|
|
94
94
|
and the paginated results consist of `CowBell` models, the rendered text
|
|
95
95
|
will be "Need more cow bells!".
|
|
96
96
|
|
|
97
|
-
## Installation
|
|
98
|
-
|
|
99
|
-
Add this line to your application's Gemfile:
|
|
100
97
|
|
|
101
|
-
|
|
102
|
-
gem "moar"
|
|
103
|
-
```
|
|
98
|
+
## Installation
|
|
104
99
|
|
|
105
|
-
|
|
100
|
+
Add the gem to your Gemfile:
|
|
106
101
|
|
|
107
102
|
```bash
|
|
108
|
-
$ bundle
|
|
103
|
+
$ bundle add moar
|
|
109
104
|
```
|
|
110
105
|
|
|
111
|
-
And
|
|
106
|
+
And run the installation generator:
|
|
112
107
|
|
|
113
108
|
```bash
|
|
114
109
|
$ rails generate moar:install
|
|
@@ -117,9 +112,9 @@ $ rails generate moar:install
|
|
|
117
112
|
|
|
118
113
|
## Contributing
|
|
119
114
|
|
|
120
|
-
Run `
|
|
115
|
+
Run `bin/test` to run the tests.
|
|
121
116
|
|
|
122
117
|
|
|
123
118
|
## License
|
|
124
119
|
|
|
125
|
-
[MIT License](
|
|
120
|
+
[MIT License](MIT-LICENSE)
|
data/Rakefile
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
require 'bundler/setup'
|
|
3
|
-
rescue LoadError
|
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
require 'yard'
|
|
8
|
-
|
|
9
|
-
YARD::Rake::YardocTask.new(:doc) do |t|
|
|
10
|
-
end
|
|
1
|
+
require 'bundler/setup'
|
|
11
2
|
|
|
12
3
|
require 'bundler/gem_tasks'
|
|
13
|
-
|
|
14
|
-
require 'rake/testtask'
|
|
15
|
-
|
|
16
|
-
Rake::TestTask.new(:test) do |t|
|
|
17
|
-
t.libs << 'test'
|
|
18
|
-
t.test_files = FileList['test/**/*_test.rb'].exclude('test/tmp/**/*')
|
|
19
|
-
t.verbose = false
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
task default: :test
|
data/lib/moar/config.rb
CHANGED
|
@@ -34,10 +34,10 @@ module Moar
|
|
|
34
34
|
@config ||= Moar::Config.new
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# @param
|
|
38
|
-
# @return [
|
|
39
|
-
def self.config=(
|
|
40
|
-
@config =
|
|
37
|
+
# @param cfg [Moar::Config]
|
|
38
|
+
# @return [cfg]
|
|
39
|
+
def self.config=(cfg)
|
|
40
|
+
@config = cfg
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
end
|
data/lib/moar/context.rb
CHANGED
data/lib/moar/helper.rb
CHANGED
|
@@ -22,16 +22,16 @@ module Moar
|
|
|
22
22
|
# is estimated by comparing +results.size+ with the limit applied by
|
|
23
23
|
# {Moar::Controller#moar}. This technique eliminates the need for
|
|
24
24
|
# an extra database query, but can result in a false positive (i.e.
|
|
25
|
-
# rendering a link to an empty page) when the
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# number of results per page
|
|
25
|
+
# rendering a link to an empty page) when the final page of results
|
|
26
|
+
# happens to be a full page. This is deemed an acceptable trade-off
|
|
27
|
+
# because it is an unlikely occurrence with both a large number of
|
|
28
|
+
# pages and a cumulatively large number of results per page, and
|
|
29
29
|
# because an extra database query cannot entirely prevent a link to
|
|
30
30
|
# an empty page, in the case where records are deleted before the
|
|
31
31
|
# user can click through to the final page.
|
|
32
32
|
#
|
|
33
33
|
# @param results [ActiveRecord::Relation, Array<ActiveModel::Naming>]
|
|
34
|
-
#
|
|
34
|
+
# Query results for current page
|
|
35
35
|
# @param target [String]
|
|
36
36
|
# CSS selector of element containing rendered results
|
|
37
37
|
# @param html_options [Hash]
|
|
@@ -66,10 +66,10 @@ module Moar
|
|
|
66
66
|
html_options["data-accumulation-param"] = Moar.config.accumulation_param.to_s
|
|
67
67
|
html_options["data-remote"] = true
|
|
68
68
|
html_options["data-type"] = "html"
|
|
69
|
-
html_options["data-disable-with"] = I18n.t(:"moar.loading", i18n_options)
|
|
69
|
+
html_options["data-disable-with"] = I18n.t(:"moar.loading", **i18n_options)
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
link_to I18n.t(:"moar.more", i18n_options), options, html_options
|
|
72
|
+
link_to I18n.t(:"moar.more", **i18n_options), options, html_options
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
data/lib/moar/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moar
|
|
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
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rails
|
|
@@ -16,105 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '8.1'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: sqlite3
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: puma
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: capybara
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '2.15'
|
|
62
|
-
- - "<"
|
|
63
|
-
- !ruby/object:Gem::Version
|
|
64
|
-
version: '4.0'
|
|
65
|
-
type: :development
|
|
66
|
-
prerelease: false
|
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
68
|
-
requirements:
|
|
69
|
-
- - ">="
|
|
70
|
-
- !ruby/object:Gem::Version
|
|
71
|
-
version: '2.15'
|
|
72
|
-
- - "<"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '4.0'
|
|
75
|
-
- !ruby/object:Gem::Dependency
|
|
76
|
-
name: webdrivers
|
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - ">="
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '0'
|
|
82
|
-
type: :development
|
|
83
|
-
prerelease: false
|
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
-
requirements:
|
|
86
|
-
- - ">="
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: '0'
|
|
89
|
-
- !ruby/object:Gem::Dependency
|
|
90
|
-
name: turbolinks
|
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - "~>"
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: '5.1'
|
|
96
|
-
type: :development
|
|
97
|
-
prerelease: false
|
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - "~>"
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: '5.1'
|
|
103
|
-
- !ruby/object:Gem::Dependency
|
|
104
|
-
name: yard
|
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
|
106
|
-
requirements:
|
|
107
|
-
- - "~>"
|
|
108
|
-
- !ruby/object:Gem::Version
|
|
109
|
-
version: '0.9'
|
|
110
|
-
type: :development
|
|
111
|
-
prerelease: false
|
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
-
requirements:
|
|
114
|
-
- - "~>"
|
|
115
|
-
- !ruby/object:Gem::Version
|
|
116
|
-
version: '0.9'
|
|
117
|
-
description:
|
|
25
|
+
version: '8.1'
|
|
118
26
|
email:
|
|
119
27
|
- jonathan@hefner.pro
|
|
120
28
|
executables: []
|
|
@@ -138,8 +46,9 @@ files:
|
|
|
138
46
|
homepage: https://github.com/jonathanhefner/moar
|
|
139
47
|
licenses:
|
|
140
48
|
- MIT
|
|
141
|
-
metadata:
|
|
142
|
-
|
|
49
|
+
metadata:
|
|
50
|
+
source_code_uri: https://github.com/jonathanhefner/moar
|
|
51
|
+
changelog_uri: https://github.com/jonathanhefner/moar/blob/master/CHANGELOG.md
|
|
143
52
|
rdoc_options: []
|
|
144
53
|
require_paths:
|
|
145
54
|
- lib
|
|
@@ -147,15 +56,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
147
56
|
requirements:
|
|
148
57
|
- - ">="
|
|
149
58
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: '
|
|
59
|
+
version: '3.4'
|
|
151
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
61
|
requirements:
|
|
153
62
|
- - ">="
|
|
154
63
|
- !ruby/object:Gem::Version
|
|
155
64
|
version: '0'
|
|
156
65
|
requirements: []
|
|
157
|
-
rubygems_version:
|
|
158
|
-
signing_key:
|
|
66
|
+
rubygems_version: 4.0.10
|
|
159
67
|
specification_version: 4
|
|
160
68
|
summary: More-style pagination for Rails
|
|
161
69
|
test_files: []
|