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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23360c1f88090467e027eea7b95d0e26124eaf84a88a6b61d92ff4383e5c7547
4
- data.tar.gz: 1c530abf7d4c18357db082d3c537ccc11304d9a25b18a38566b9df52762f67c1
3
+ metadata.gz: e965fd74ecaa27efa5443fd7c585381a5e10a03c1b30ae5ab3ded35bd658ccdc
4
+ data.tar.gz: 991df0ca43b6e75535a7994b51fc68b01773e1d420bda91cf847f65a8f88213f
5
5
  SHA512:
6
- metadata.gz: 5655f6dfb6f34dd1811713562de9c19bf0af16acdd3a2e10d1652e9eea90d42f2bc5139eacabf130a91fa06ff7e4a577408c4739426e7059d200deb3494946bb
7
- data.tar.gz: da875aded8920791a105d033078d89c394acc08fb5fc056049256cb3707fd3fc0cd1d9849cb8e09136da2640c7262b1bc2d675384e5731c9d5e0f71f152ced50
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
- respond_to do |format|
16
- format.html
17
- format.turbo_stream
18
- end
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
- In your index page, make sure you have a DOM element with ID `infinite`
24
- and render inside of it your initial page content.
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
- You could use the [next_pageable](https://github.com/allcrux/next_pageable) gem
31
- but one can also use any other pagination gem of choice.
44
+ ```slim
45
+ = turbo_scroll_auto page: @articles.next_page_index
46
+ - @articles.each do |article|
47
+ = article
48
+ ```
32
49
 
33
- #### Slim Example
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
- = turbo_scroll_loader(page: @articles.next_page_index)
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 `turbo_scroll_update` helper to
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 [next_pageable](https://github.com/allcrux/next_pageable) gem
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
- = turbo_scroll_update page: @articles.next_page_index
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 `turbo_scroll_update` helper.
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
- #scroll
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
- = turbo_scroll_update page: @articles.next_page_index, infinite_dom_id: :scroll
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
- ```ruby
95
- gem "turbo-scroll"
96
- ```
190
+ Install the gem and add to the application's Gemfile by executing:
97
191
 
98
- And then execute:
99
- ```bash
100
- $ bundle
101
- ```
192
+ $ bundle add turbo-scroll
102
193
 
103
- Or install it yourself as:
104
- ```bash
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
@@ -1,3 +1,5 @@
1
1
  require "bundler/setup"
2
2
 
3
3
  require "bundler/gem_tasks"
4
+
5
+ task default: %i[rubocop]
@@ -0,0 +1,4 @@
1
+ ---
2
+ en:
3
+ click_here: Click <a href="%{next_page_path}">here</a> to force load the next page.
4
+ more: More
@@ -0,0 +1,4 @@
1
+ ---
2
+ fr:
3
+ click_here: Cliquez <a href="%{next_page_path}">ici</a> pour charger la page suivante.
4
+ more: Plus
@@ -0,0 +1,4 @@
1
+ ---
2
+ nl:
3
+ click_here: Klik <a href="%{next_page_path}">hier</a> voor de volgende pagina.
4
+ more: Meer
@@ -0,0 +1,4 @@
1
+ ---
2
+ ro:
3
+ click_here: Faceți clic <a href="%{next_page_path}">aici</a> pentru a încărca pagina următoare.
4
+ more: More
@@ -0,0 +1,4 @@
1
+ ---
2
+ vn:
3
+ click_here: Nhấp vào <a href="%{next_page_path}">đây</a> để tải trang tiếp theo.
4
+ more: Xem thêm
@@ -0,0 +1,5 @@
1
+ = turbo_frame_tag loader_dom_id, src: next_page_stream_path, loading: "lazy", target: "_top"
2
+ .page-loading
3
+ p == I18n.t(".click_here", next_page_path: next_page_path)
4
+ - if loading_indicator
5
+ = render(TurboScroll::SpinLoader.new())
@@ -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
@@ -1,6 +1,9 @@
1
1
  .page-loading {
2
2
  height: 15.5em;
3
3
  padding-top: 4em;
4
+ display: flex;
5
+ justify-content: center;
6
+ align-items: center;
4
7
  }
5
8
 
6
9
  .page-loading p {
@@ -0,0 +1,7 @@
1
+ = turbo_stream.append(infinite_dom_id)
2
+ = content
3
+
4
+ = turbo_stream.replace(loader_dom_id)
5
+ = render(TurboScroll::Auto.new(page: page, \
6
+ loader_dom_id: loader_dom_id, \
7
+ loading_indicator: loading_indicator))
@@ -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::Loader < ViewComponent::Base
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,5 @@
1
+ = turbo_stream.append(infinite_dom_id)
2
+ = content
3
+
4
+ = turbo_stream.replace(loader_dom_id)
5
+ = render(TurboScroll::More.new(page: page, loader_dom_id: loader_dom_id))
@@ -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
@@ -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 "update"
5
- require_relative "loader"
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,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "turbo-rails"
4
+
5
+ class TurboScroll::SpinLoader < ViewComponent::Base
6
+ #
7
+ def initialize()
8
+ end
9
+ 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
@@ -1,3 +1,3 @@
1
1
  module TurboScroll
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.4"
3
3
  end
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
- def turbo_scroll_loader(page:)
7
- render(TurboScroll::Loader.new(page: page))
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
- def turbo_scroll_update(page:, infinite_dom_id: :infinite, &block)
11
- render(TurboScroll::Update.new(page: page, infinite_dom_id: infinite_dom_id), &block)
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.0
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-05 00:00:00.000000000 Z
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: Description of TurboScroll.
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/tasks/turbo_scroll_tasks.rake
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/loader.html.slim
82
- - lib/turbo-scroll/loader.rb
83
- - lib/turbo-scroll/loader.scss
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/update.html.slim
86
- - lib/turbo-scroll/update.rb
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: Summary of TurboScroll.
126
+ summary: Modern infinite page scrolling for Rails.
115
127
  test_files: []
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :turbo-scroll do
3
- # # Task goes here
4
- # end
@@ -1,3 +0,0 @@
1
- = turbo_frame_tag :infinite_loader, src: next_page_stream_path, loading: "lazy", target: "_top"
2
- .page-loading
3
- p ==t(".click_here", next_page_path: next_page_path)
@@ -1,5 +0,0 @@
1
- = turbo_stream.append(infinite_dom_id)
2
- = content
3
-
4
- = turbo_stream.replace(:infinite_loader)
5
- = render(TurboScroll::Loader.new(page: page))
@@ -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
-