turbo-scroll 0.1.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +132 -42
- data/Rakefile +2 -0
- data/lib/locales/en.yml +4 -0
- data/lib/locales/fr.yml +4 -0
- data/lib/locales/nl.yml +4 -0
- data/lib/locales/ro.yml +4 -0
- data/lib/locales/vn.yml +4 -0
- data/lib/turbo-scroll/auto.html.slim +5 -0
- data/lib/turbo-scroll/auto.rb +32 -0
- data/lib/turbo-scroll/{loader.scss → auto.scss} +3 -0
- data/lib/turbo-scroll/auto_stream.html.slim +7 -0
- data/lib/turbo-scroll/auto_stream.rb +17 -0
- data/lib/turbo-scroll/more.html.slim +12 -0
- data/lib/turbo-scroll/{loader.rb → more.rb} +4 -4
- data/lib/turbo-scroll/more_stream.html.slim +5 -0
- data/lib/turbo-scroll/more_stream.rb +16 -0
- data/lib/turbo-scroll/railtie.rb +7 -3
- data/lib/turbo-scroll/spin_loader.rb +9 -0
- data/lib/turbo-scroll/spin_loader.slim +50 -0
- data/lib/turbo-scroll/version.rb +1 -1
- data/lib/turbo-scroll.rb +42 -4
- metadata +22 -10
- data/lib/tasks/turbo_scroll_tasks.rake +0 -4
- data/lib/turbo-scroll/loader.html.slim +0 -3
- data/lib/turbo-scroll/update.html.slim +0 -5
- data/lib/turbo-scroll/update.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e965fd74ecaa27efa5443fd7c585381a5e10a03c1b30ae5ab3ded35bd658ccdc
|
4
|
+
data.tar.gz: 991df0ca43b6e75535a7994b51fc68b01773e1d420bda91cf847f65a8f88213f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8e69ff2b35a7f55edbd879cad95f5ed25a73b0d0a173bc5e18de0e8e6979dc8aaa834acc2e971799fac4a41bbedc072fa6ee9ab05411a2cbb963bb3e2266de4
|
7
|
+
data.tar.gz: 43a7739af26ba8aa9ed34661150906186be692447723b0b7462ef43144a70cc8cad2e6f2af92936f17bcf8c239801dcd3f32e01787f3b1f3854c0446459a90db
|
data/README.md
CHANGED
@@ -1,8 +1,21 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/turbo-scroll.svg)](https://badge.fury.io/rb/turbo-scroll)
|
2
|
+
|
1
3
|
# TurboScroll
|
2
4
|
|
3
5
|
TurboScroll is a minimalistic gem that provides infinite scrolling for Rails based applications
|
4
6
|
using Turbo.
|
5
7
|
|
8
|
+
Why a new gem? Leveraging Turbo we can build a very small and efficient implementation
|
9
|
+
for infinite page scrolling without extra dependencies.
|
10
|
+
|
11
|
+
It's made to be independent from your choice of pagination.
|
12
|
+
You can use the [next-pageable](https://github.com/allcrux/next-pageable) gem, which
|
13
|
+
is another minimalistic gem for very basic paging leveraging Rails concerns, to just
|
14
|
+
provide the functionality you need for infinite scrolling and avoiding a count query
|
15
|
+
on each page request (Your main page might still do a count query but you won't
|
16
|
+
be repeating them when requesting next page data behind the scenes.)
|
17
|
+
|
18
|
+
|
6
19
|
Underlying it depends on ViewComponent and Slim but these are not forced upon the user.
|
7
20
|
|
8
21
|
## Usage
|
@@ -11,99 +24,176 @@ Underlying it depends on ViewComponent and Slim but these are not forced upon th
|
|
11
24
|
|
12
25
|
Make sure your index action responds both to html and turbo_stream
|
13
26
|
|
14
|
-
```
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
27
|
+
```rb
|
28
|
+
@articles = Article.scoped.paginate(params[:page]) # next-pageable
|
29
|
+
|
30
|
+
respond_to do |format|
|
31
|
+
format.html
|
32
|
+
format.turbo_stream
|
33
|
+
end
|
19
34
|
```
|
20
35
|
|
21
36
|
### index.html.erb|slim
|
22
37
|
|
23
|
-
|
24
|
-
|
38
|
+
The simplest is to use the `turbo_scroll_auto` helper and
|
39
|
+
nest inside your initial infinite content. This will wrap the
|
40
|
+
content with an element with id #infinite that will be
|
41
|
+
used to append new content to for infinite scrolling.
|
25
42
|
|
26
|
-
At the bottom of your page, add the infinite scrolling loader
|
27
|
-
by calling the `turbo_scroll_loader` helper and passing the next page index
|
28
|
-
if a next page is present.
|
29
43
|
|
30
|
-
|
31
|
-
|
44
|
+
```slim
|
45
|
+
= turbo_scroll_auto page: @articles.next_page_index
|
46
|
+
- @articles.each do |article|
|
47
|
+
= article
|
48
|
+
```
|
32
49
|
|
33
|
-
|
50
|
+
Alternatively, in your index page, make sure you have a DOM element with ID `infinite`
|
51
|
+
and render inside of it your initial page content.
|
34
52
|
|
53
|
+
At the bottom of your page, add the infinite scrolling loader
|
54
|
+
by calling the `turbo_scroll_auto` helper and passing the next page index
|
55
|
+
if a next page is present.
|
35
56
|
|
36
|
-
```
|
57
|
+
```slim
|
37
58
|
#infinite
|
38
59
|
- @articles.each do |article|
|
39
60
|
= article
|
40
61
|
|
41
|
-
=
|
62
|
+
= turbo_scroll_auto page: @articles.next_page_index
|
42
63
|
```
|
43
64
|
|
65
|
+
This gem currently assumes that the page parameter is called `page`, so in
|
66
|
+
your controller make sure you use that parameter for selecting
|
67
|
+
the records for a given page.
|
68
|
+
|
69
|
+
When the loader component becomes visible, it will do 2 things
|
70
|
+
|
71
|
+
- append the next page to the #infinite dom id
|
72
|
+
- update the loader to load the next page (when present)
|
73
|
+
|
44
74
|
If you want to use a different ID, you'll have to pass it on in turbo_stream response.
|
45
75
|
|
46
76
|
### index.turbo_stream.erb|slim
|
47
77
|
|
48
|
-
Your turbo_stream response can use the `
|
78
|
+
Your turbo_stream response can use the `turbo_scroll_auto_stream` helper to
|
49
79
|
append the next page content and update the current loader with a
|
50
80
|
loader for the next page.
|
51
81
|
|
52
|
-
When using the [
|
82
|
+
When using the [next-pageable](https://github.com/allcrux/next-pageable) gem
|
53
83
|
the next_page_index is already present on the collection when a next page exists.
|
54
84
|
|
55
|
-
```
|
56
|
-
=
|
85
|
+
```slim
|
86
|
+
= turbo_scroll_auto_stream page: @articles.next_page_index
|
57
87
|
- @articles.each do |article|
|
58
88
|
= article
|
59
89
|
```
|
60
90
|
|
91
|
+
### More variant (no auto loading, just simple 'more' loading)
|
92
|
+
|
93
|
+
```slim
|
94
|
+
= turbo_scroll_more page: @articles.next_page_index
|
95
|
+
= render(Articles::Row.with_collection(@articles))
|
96
|
+
```
|
97
|
+
|
98
|
+
Your turbo_stream response can use the `turbo_scroll_more_stream` helper to
|
99
|
+
append the next page content and update the current more loader with a
|
100
|
+
more loader for the next page.
|
101
|
+
|
102
|
+
articles\index.turbo_stream.slim
|
103
|
+
|
104
|
+
```slim
|
105
|
+
= turbo_scroll_more_stream page: @articles.next_page_index
|
106
|
+
= render Articles::Row.with_collection(@articles)
|
107
|
+
```
|
108
|
+
|
109
|
+
### An HTML table alternative for table layouts using CSS grids
|
110
|
+
|
111
|
+
As HTML is pretty picky on the tags allowed inside 'table', 'tr', 'td', etc you
|
112
|
+
can consider using CSS grid as an alternative.
|
113
|
+
|
114
|
+
```css
|
115
|
+
.article.row {
|
116
|
+
display: grid;
|
117
|
+
grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 8fr) minmax(0, 2fr) minmax(0, 1fr) 3em;
|
118
|
+
max-width: 100%;
|
119
|
+
width: 100%;
|
120
|
+
}
|
121
|
+
|
122
|
+
.article.row .col {
|
123
|
+
height: 2.75rem;
|
124
|
+
display: flex;
|
125
|
+
align-items: center;
|
126
|
+
width: 100%;
|
127
|
+
padding-left: 0.5rem;
|
128
|
+
padding-right: 0.5rem;
|
129
|
+
}
|
130
|
+
|
131
|
+
.article.row .col-head {
|
132
|
+
font-weight: bolder;
|
133
|
+
}
|
134
|
+
|
135
|
+
.article.row .col-filter {
|
136
|
+
padding-left: 0rem;
|
137
|
+
padding-right: 0rem;
|
138
|
+
}
|
139
|
+
|
140
|
+
.article.row .align-right {
|
141
|
+
justify-content: right;
|
142
|
+
}
|
143
|
+
|
144
|
+
.article.row.striped:nth-child(2n+1) {
|
145
|
+
background-color: #EEEEEE;
|
146
|
+
}
|
147
|
+
```
|
148
|
+
|
149
|
+
which would go hand in hand with this partial for a record row
|
150
|
+
|
151
|
+
```slim
|
152
|
+
.article.row.striped
|
153
|
+
.col = article.articlenumber
|
154
|
+
.col = article.barcode
|
155
|
+
.col = article.description
|
156
|
+
.col = article.supplier
|
157
|
+
.col.align-right = article.price.print
|
158
|
+
.col.align-right
|
159
|
+
a.btn.btn-sm.btn-secondary href=edit_article_path(article)
|
160
|
+
i.bi.bi-pencil
|
161
|
+
```
|
162
|
+
|
163
|
+
|
61
164
|
### Using a different DOM ID
|
62
165
|
|
63
166
|
In case you want or need to use a different DOM ID you
|
64
|
-
can pass it on as an extra param to the `
|
167
|
+
can pass it on as an extra param to the `turbo_scroll_auto_stream` helper.
|
65
168
|
|
66
169
|
The below example illustrates this for the case where your
|
67
170
|
DOM ID is `#scroll`.
|
68
171
|
|
69
172
|
index.html.slim
|
70
173
|
|
71
|
-
```
|
72
|
-
|
174
|
+
```slim
|
175
|
+
= turbo_scroll_auto page: @articles.next_page_index, id: :scroll
|
73
176
|
- @articles.each do |article|
|
74
177
|
= article
|
75
|
-
|
76
|
-
= turbo_scroll_loader(page: @articles.next_page_index)
|
77
178
|
```
|
78
179
|
|
79
180
|
index.turbo_stream.slim
|
80
181
|
|
81
|
-
```
|
82
|
-
=
|
182
|
+
```slim
|
183
|
+
= turbo_scroll_auto_stream page: @articles.next_page_index, infinite_dom_id: :scroll
|
83
184
|
- @articles.each do |article|
|
84
185
|
= article
|
85
186
|
```
|
86
187
|
|
87
|
-
|
88
|
-
|
89
|
-
### index.
|
90
|
-
|
91
188
|
## Installation
|
92
|
-
Add this line to your application's Gemfile:
|
93
189
|
|
94
|
-
|
95
|
-
gem "turbo-scroll"
|
96
|
-
```
|
190
|
+
Install the gem and add to the application's Gemfile by executing:
|
97
191
|
|
98
|
-
|
99
|
-
```bash
|
100
|
-
$ bundle
|
101
|
-
```
|
192
|
+
$ bundle add turbo-scroll
|
102
193
|
|
103
|
-
|
104
|
-
|
105
|
-
$ gem install turbo-scroll
|
106
|
-
```
|
194
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
195
|
+
|
196
|
+
$ gem install turbo-scroll
|
107
197
|
|
108
198
|
## License
|
109
199
|
|
data/Rakefile
CHANGED
data/lib/locales/en.yml
ADDED
data/lib/locales/fr.yml
ADDED
data/lib/locales/nl.yml
ADDED
data/lib/locales/ro.yml
ADDED
data/lib/locales/vn.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "turbo-rails"
|
4
|
+
|
5
|
+
class TurboScroll::Auto < ViewComponent::Base
|
6
|
+
include Turbo::FramesHelper
|
7
|
+
|
8
|
+
attr_reader :page, :loader_dom_id, :loading_indicator
|
9
|
+
|
10
|
+
def initialize(page:, loader_dom_id: :loader, loading_indicator: true)
|
11
|
+
@page = page
|
12
|
+
@loader_dom_id = loader_dom_id
|
13
|
+
@loading_indicator = loading_indicator
|
14
|
+
end
|
15
|
+
|
16
|
+
def query_params
|
17
|
+
@query_params ||=
|
18
|
+
request.query_parameters.except(:page, :raw, :format)
|
19
|
+
end
|
20
|
+
|
21
|
+
def next_page_path
|
22
|
+
url_for(page: page, **query_params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def next_page_stream_path
|
26
|
+
url_for(format: :turbo_stream, page: page, **query_params)
|
27
|
+
end
|
28
|
+
|
29
|
+
def render?
|
30
|
+
page
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "turbo-rails"
|
4
|
+
|
5
|
+
class TurboScroll::AutoStream < ViewComponent::Base
|
6
|
+
include Turbo::FramesHelper
|
7
|
+
include Turbo::StreamsHelper
|
8
|
+
|
9
|
+
attr_reader :page, :loader_dom_id, :infinite_dom_id, :loading_indicator
|
10
|
+
|
11
|
+
def initialize(page:, loader_dom_id: :loader, loading_indicator:, infinite_dom_id: :infinite)
|
12
|
+
@page = page
|
13
|
+
@infinite_dom_id = infinite_dom_id
|
14
|
+
@loading_indicator = loading_indicator
|
15
|
+
@loader_dom_id = loader_dom_id
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
turbo-frame id=loader_dom_id
|
2
|
+
a.more href=next_page_path onclick="more('#{next_page_stream_path}')" =I18n.t(".more")
|
3
|
+
|
4
|
+
javascript:
|
5
|
+
function more(url) {
|
6
|
+
event.preventDefault();
|
7
|
+
fetch(url)
|
8
|
+
.then(response => response.text())
|
9
|
+
.then(html => Turbo.renderStreamMessage(html))
|
10
|
+
.catch(error => console.warn('Something went wrong.', error));
|
11
|
+
}
|
12
|
+
|
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
require "turbo-rails"
|
4
4
|
|
5
|
-
class TurboScroll::
|
5
|
+
class TurboScroll::More < ViewComponent::Base
|
6
6
|
include Turbo::FramesHelper
|
7
7
|
|
8
|
-
attr_reader :page
|
8
|
+
attr_reader :page, :loader_dom_id
|
9
9
|
|
10
|
-
def initialize(page:)
|
10
|
+
def initialize(page:, loader_dom_id: :loader)
|
11
11
|
@page = page
|
12
|
+
@loader_dom_id = loader_dom_id
|
12
13
|
end
|
13
14
|
|
14
15
|
def query_params
|
@@ -28,4 +29,3 @@ class TurboScroll::Loader < ViewComponent::Base
|
|
28
29
|
page
|
29
30
|
end
|
30
31
|
end
|
31
|
-
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "turbo-rails"
|
4
|
+
|
5
|
+
class TurboScroll::MoreStream < ViewComponent::Base
|
6
|
+
include Turbo::FramesHelper
|
7
|
+
include Turbo::StreamsHelper
|
8
|
+
|
9
|
+
attr_reader :page, :loader_dom_id, :infinite_dom_id
|
10
|
+
|
11
|
+
def initialize(page:, loader_dom_id: :loader, infinite_dom_id: :infinite)
|
12
|
+
@page = page
|
13
|
+
@loader_dom_id = loader_dom_id
|
14
|
+
@infinite_dom_id = infinite_dom_id
|
15
|
+
end
|
16
|
+
end
|
data/lib/turbo-scroll/railtie.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
module TurboScroll
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
initializer "turbo-scrolls.load_components" do
|
4
|
-
require_relative "
|
5
|
-
require_relative "
|
4
|
+
require_relative "auto"
|
5
|
+
require_relative "auto_stream"
|
6
|
+
require_relative "more"
|
7
|
+
require_relative "more_stream"
|
8
|
+
require_relative "spin_loader"
|
6
9
|
end
|
7
|
-
initializer "turbo-scrolls.view_helpers" do
|
10
|
+
initializer "turbo-scrolls.view_helpers" do |app|
|
8
11
|
ActiveSupport.on_load(:action_view) do
|
9
12
|
include TurboScroll::ViewHelpers
|
10
13
|
end
|
14
|
+
app.config.i18n.load_path += Dir[File.expand_path(File.join(File.dirname(__FILE__), '../locales', '*.yml')).to_s]
|
11
15
|
end
|
12
16
|
end
|
13
17
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
css:
|
2
|
+
.loader {
|
3
|
+
display: inline-block;
|
4
|
+
position: relative;
|
5
|
+
width: 45px;
|
6
|
+
height: 45px;
|
7
|
+
margin: auto;
|
8
|
+
}
|
9
|
+
.loader div {
|
10
|
+
box-sizing: border-box;
|
11
|
+
display: block;
|
12
|
+
position: absolute;
|
13
|
+
width: 32px;
|
14
|
+
height: 32px;
|
15
|
+
margin: 8px 0px;
|
16
|
+
border: 3px solid #00afd4;
|
17
|
+
border-radius: 50%;
|
18
|
+
animation: loader 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
19
|
+
border-color: #00afd4 transparent transparent transparent;
|
20
|
+
}
|
21
|
+
.loader div:nth-child(1) {
|
22
|
+
animation-delay: -0.45s;
|
23
|
+
}
|
24
|
+
.loader div:nth-child(2) {
|
25
|
+
animation-delay: -0.3s;
|
26
|
+
}
|
27
|
+
.loader div:nth-child(3) {
|
28
|
+
animation-delay: -0.15s;
|
29
|
+
}
|
30
|
+
.page-loading {
|
31
|
+
display: flex;
|
32
|
+
flex-direction: column;
|
33
|
+
justify-content: center;
|
34
|
+
align-items: center;
|
35
|
+
}
|
36
|
+
|
37
|
+
@keyframes loader {
|
38
|
+
0% {
|
39
|
+
transform: rotate(0deg);
|
40
|
+
}
|
41
|
+
100% {
|
42
|
+
transform: rotate(360deg);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
.loader
|
47
|
+
div
|
48
|
+
div
|
49
|
+
div
|
50
|
+
div
|
data/lib/turbo-scroll/version.rb
CHANGED
data/lib/turbo-scroll.rb
CHANGED
@@ -3,12 +3,50 @@ require "turbo-scroll/railtie" if defined?(Rails::Railtie)
|
|
3
3
|
|
4
4
|
module TurboScroll
|
5
5
|
module ViewHelpers
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
#
|
8
|
+
def turbo_scroll_auto(page:, loader_dom_id: :loader, loading_indicator: true, id: :infinite, &block)
|
9
|
+
if block_given?
|
10
|
+
safe_concat(%{<div id="#{id}">})
|
11
|
+
concat(capture(&block))
|
12
|
+
safe_concat("</div>")
|
13
|
+
end
|
14
|
+
render(TurboScroll::Auto.new(page: page, loader_dom_id: loader_dom_id, loading_indicator: loading_indicator))
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
def turbo_scroll_more(page:, loader_dom_id: :loader, id: :infinite, &block)
|
19
|
+
if block_given?
|
20
|
+
safe_concat(%{<div id="#{id}">})
|
21
|
+
concat(capture(&block))
|
22
|
+
safe_concat("</div>")
|
23
|
+
end
|
24
|
+
render(TurboScroll::More.new(page: page, loader_dom_id: loader_dom_id))
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
def turbo_scroll_auto_stream(page:, loader_dom_id: :loader, infinite_dom_id: :infinite, loading_indicator: true, &block)
|
29
|
+
render(
|
30
|
+
TurboScroll::AutoStream.new(
|
31
|
+
page: page,
|
32
|
+
loader_dom_id: loader_dom_id,
|
33
|
+
infinite_dom_id: infinite_dom_id,
|
34
|
+
loading_indicator: loading_indicator
|
35
|
+
),
|
36
|
+
&block
|
37
|
+
)
|
8
38
|
end
|
9
39
|
|
10
|
-
|
11
|
-
|
40
|
+
#
|
41
|
+
def turbo_scroll_more_stream(page:, loader_dom_id: :loader, infinite_dom_id: :infinite, &block)
|
42
|
+
render(
|
43
|
+
TurboScroll::MoreStream.new(
|
44
|
+
page: page,
|
45
|
+
loader_dom_id: loader_dom_id,
|
46
|
+
infinite_dom_id: infinite_dom_id
|
47
|
+
),
|
48
|
+
&block
|
49
|
+
)
|
12
50
|
end
|
13
51
|
end
|
14
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-scroll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koen handekyn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4'
|
69
|
-
description:
|
69
|
+
description: TurboScroll is a minimalistic gem that provides infinite scrolling for
|
70
|
+
Rails based applications using Turbo.
|
70
71
|
email:
|
71
72
|
- koen@handekyn.com
|
72
73
|
executables: []
|
@@ -76,14 +77,24 @@ files:
|
|
76
77
|
- MIT-LICENSE
|
77
78
|
- README.md
|
78
79
|
- Rakefile
|
79
|
-
- lib/
|
80
|
+
- lib/locales/en.yml
|
81
|
+
- lib/locales/fr.yml
|
82
|
+
- lib/locales/nl.yml
|
83
|
+
- lib/locales/ro.yml
|
84
|
+
- lib/locales/vn.yml
|
80
85
|
- lib/turbo-scroll.rb
|
81
|
-
- lib/turbo-scroll/
|
82
|
-
- lib/turbo-scroll/
|
83
|
-
- lib/turbo-scroll/
|
86
|
+
- lib/turbo-scroll/auto.html.slim
|
87
|
+
- lib/turbo-scroll/auto.rb
|
88
|
+
- lib/turbo-scroll/auto.scss
|
89
|
+
- lib/turbo-scroll/auto_stream.html.slim
|
90
|
+
- lib/turbo-scroll/auto_stream.rb
|
91
|
+
- lib/turbo-scroll/more.html.slim
|
92
|
+
- lib/turbo-scroll/more.rb
|
93
|
+
- lib/turbo-scroll/more_stream.html.slim
|
94
|
+
- lib/turbo-scroll/more_stream.rb
|
84
95
|
- lib/turbo-scroll/railtie.rb
|
85
|
-
- lib/turbo-scroll/
|
86
|
-
- lib/turbo-scroll/
|
96
|
+
- lib/turbo-scroll/spin_loader.rb
|
97
|
+
- lib/turbo-scroll/spin_loader.slim
|
87
98
|
- lib/turbo-scroll/version.rb
|
88
99
|
homepage: https://github.com/allcrux/turbo-scroll
|
89
100
|
licenses:
|
@@ -93,6 +104,7 @@ metadata:
|
|
93
104
|
homepage_uri: https://github.com/allcrux/turbo-scroll
|
94
105
|
source_code_uri: https://github.com/allcrux/turbo-scroll
|
95
106
|
changelog_uri: https://github.com/allcrux/turbo-scroll/blob/main/CHANGELOG.md
|
107
|
+
rubygems_mfa_required: 'true'
|
96
108
|
post_install_message:
|
97
109
|
rdoc_options: []
|
98
110
|
require_paths:
|
@@ -111,5 +123,5 @@ requirements: []
|
|
111
123
|
rubygems_version: 3.3.7
|
112
124
|
signing_key:
|
113
125
|
specification_version: 4
|
114
|
-
summary:
|
126
|
+
summary: Modern infinite page scrolling for Rails.
|
115
127
|
test_files: []
|
data/lib/turbo-scroll/update.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "turbo-rails"
|
4
|
-
|
5
|
-
class TurboScroll::Update < ViewComponent::Base
|
6
|
-
include Turbo::FramesHelper
|
7
|
-
include Turbo::StreamsHelper
|
8
|
-
|
9
|
-
attr_reader :page
|
10
|
-
attr_reader :infinite_dom_id
|
11
|
-
|
12
|
-
def initialize(page:, infinite_dom_id: :infinite)
|
13
|
-
@page = page
|
14
|
-
@infinite_dom_id = infinite_dom_id
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|