turbo-scroll 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -12
- data/lib/locales/en.yml +1 -1
- data/lib/locales/fr.yml +1 -1
- data/lib/locales/nl.yml +1 -1
- data/lib/locales/ro.yml +1 -1
- data/lib/locales/vn.yml +2 -2
- data/lib/turbo-scroll/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32d21797cebb4fe6b6f5dc02130949f2d83ba899d1d30d41bbcc1e90cca76a02
|
4
|
+
data.tar.gz: 334e100f9fa988dc2bac5467470d6a33634e00ccfafd488b4a61a6d8e6000983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeb2e54b0e4777b84053e154be686cba079ae7278661128c1bc34d8bab4d1b3cd910d2d1d4ca0d5c17d2b69c2e06f2dedf21934276638f13a4088a109ad7570c
|
7
|
+
data.tar.gz: eea9623e8f432b508fb7dd7e236c620cc414a0f016a41928a0c30bd82b3e7e950866c1ed75a351eb9a739e268e24c2858436ec11e0e321a9264e83e78d41214e
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
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
|
@@ -22,13 +24,13 @@ Underlying it depends on ViewComponent and Slim but these are not forced upon th
|
|
22
24
|
|
23
25
|
Make sure your index action responds both to html and turbo_stream
|
24
26
|
|
25
|
-
```
|
26
|
-
|
27
|
+
```rb
|
28
|
+
@articles = Article.scoped.paginate(params[:page]) # next-pageable
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
respond_to do |format|
|
31
|
+
format.html
|
32
|
+
format.turbo_stream
|
33
|
+
end
|
32
34
|
```
|
33
35
|
|
34
36
|
### index.html.erb|slim
|
@@ -51,7 +53,7 @@ When the loader component becomes visible, it will do 2 things
|
|
51
53
|
|
52
54
|
#### Slim Example
|
53
55
|
|
54
|
-
```
|
56
|
+
```slim
|
55
57
|
#infinite
|
56
58
|
/ render your page fragment here in whatever structure you desire
|
57
59
|
/ and extract it into a partial or a component to avoid repition, if desired.
|
@@ -72,7 +74,7 @@ loader for the next page.
|
|
72
74
|
When using the [next-pageable](https://github.com/allcrux/next-pageable) gem
|
73
75
|
the next_page_index is already present on the collection when a next page exists.
|
74
76
|
|
75
|
-
```
|
77
|
+
```slim
|
76
78
|
= turbo_scroll_update page: @articles.next_page_index
|
77
79
|
/ render your page fragment here in whatever structure you desire
|
78
80
|
/ and extract it into a partial or a component to avoid repition, if desired.
|
@@ -85,7 +87,7 @@ the next_page_index is already present on the collection when a next page exists
|
|
85
87
|
As HTML is pretty picky on the tags allowed inside 'table', 'tr', 'td', etc you
|
86
88
|
can consider using CSS grid as an alternative.
|
87
89
|
|
88
|
-
```
|
90
|
+
```css
|
89
91
|
.articles-table {
|
90
92
|
display: grid;
|
91
93
|
grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 8fr) minmax(0, 2fr) minmax(0, 1fr) 3em;
|
@@ -114,7 +116,7 @@ can consider using CSS grid as an alternative.
|
|
114
116
|
|
115
117
|
which would go hand in hand with this partial for a record row
|
116
118
|
|
117
|
-
```
|
119
|
+
```css
|
118
120
|
.col.col-striped = article.articlenumber
|
119
121
|
.col.col-striped = article.barcode
|
120
122
|
.col.col-striped = article.description
|
@@ -136,7 +138,7 @@ DOM ID is `#scroll`.
|
|
136
138
|
|
137
139
|
index.html.slim
|
138
140
|
|
139
|
-
```
|
141
|
+
```slim
|
140
142
|
#scroll
|
141
143
|
- @articles.each do |article|
|
142
144
|
= article
|
@@ -146,7 +148,7 @@ index.html.slim
|
|
146
148
|
|
147
149
|
index.turbo_stream.slim
|
148
150
|
|
149
|
-
```
|
151
|
+
```slim
|
150
152
|
= turbo_scroll_update page: @articles.next_page_index, infinite_dom_id: :scroll
|
151
153
|
- @articles.each do |article|
|
152
154
|
= article
|
data/lib/locales/en.yml
CHANGED
data/lib/locales/fr.yml
CHANGED
data/lib/locales/nl.yml
CHANGED
data/lib/locales/ro.yml
CHANGED
data/lib/locales/vn.yml
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
click_here: Nhấp vào <a href="%{next_page_path}">đây
|
2
|
+
vn:
|
3
|
+
click_here: Nhấp vào <a href="%{next_page_path}">đây</a> để tải trang tiếp theo.
|
data/lib/turbo-scroll/version.rb
CHANGED
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.3
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|