Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f99c3d5

Browse filesBrowse files
committed
HTMX infinite scroll trigger all set.
1 parent 7a5ea2a commit f99c3d5
Copy full SHA for f99c3d5

File tree

Expand file treeCollapse file tree

3 files changed

+15
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+15
-2
lines changed

‎code/ch7_infinite_scroll/ch7_final_video_collector/templates/feed/index.html

Copy file name to clipboardExpand all lines: code/ch7_infinite_scroll/ch7_final_video_collector/templates/feed/index.html
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
<h1>Video Collector: Recent Videos</h1>
77

8-
{{ render_partial('feed/partials/video_list.html', videos=videos) }}
8+
{{ render_partial('feed/partials/video_list.html',
9+
videos=videos,
10+
page=1,
11+
has_more_videos=has_more_videos) }}
912

1013
</div>
1114

‎code/ch7_infinite_scroll/ch7_final_video_collector/templates/feed/partials/video_list.html

Copy file name to clipboardExpand all lines: code/ch7_infinite_scroll/ch7_final_video_collector/templates/feed/partials/video_list.html
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,13 @@
77
</a>
88
</div>
99

10-
{% endfor %}
10+
{% endfor %}
11+
12+
{% if has_more_videos %}
13+
<div class="scroll-trigger htmx-settling"
14+
hx-get="/feed/more_videos/{{ (page+1) }}"
15+
hx-trigger="revealed"
16+
hx-swap="outerHTML">
17+
<img src="/static/img/bars.svg" width="150px" class="htmx-indicator"/>
18+
</div>
19+
{% endif %}

‎code/ch7_infinite_scroll/ch7_final_video_collector/viewmodels/feed/feed_viewmodel.py

Copy file name to clipboardExpand all lines: code/ch7_infinite_scroll/ch7_final_video_collector/viewmodels/feed/feed_viewmodel.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ def __init__(self, page_size: int, page: int = 1):
1717
end = start + page_size
1818

1919
self.videos: List[Video] = all_videos[start:end]
20+
self.has_more_videos = len(all_videos) > end

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.