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 2f666b3

Browse filesBrowse files
committed
Basic active search up and running.
1 parent 812eb7b commit 2f666b3
Copy full SHA for 2f666b3

File tree

4 files changed

+25
-2
lines changed
Filter options

4 files changed

+25
-2
lines changed
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<img src="https://img.youtube.com/vi/{{ video.id }}/maxresdefault.jpg"
2+
class="img img-responsive {{ ' '.join(classes) }}"
3+
alt="{{ video.title }}"
4+
title="{{ video.title }}">
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div class="search-result-count">{{ len(videos) }} results</div>
2+
3+
<div class="container">
4+
{% for v in videos %}
5+
<div class="row search-result-row">
6+
<div class="col-md-2"></div>
7+
<div class="video search-result col-md-3">
8+
<a href="/videos/play/{{ v.id }}"
9+
>{{ render_partial('shared/partials/_video_image.html', video=v) }}</a>
10+
</div>
11+
<div class="video search-result col-md-6">
12+
<div><a href="/videos/play/{{ v.id }}" class="title">{{ v.title }}</a></div>
13+
<div><span class="author">{{ v.author }}</span></div>
14+
<div>{{ "{:,}".format(v.views) }} views</div>
15+
</div>
16+
<div class="col-md-1"></div>
17+
</div>
18+
{% endfor %}
19+
</div>

‎code/ch6_active_search/ch6_final_video_collector/templates/videos/search.html

Copy file name to clipboardExpand all lines: code/ch6_active_search/ch6_final_video_collector/templates/videos/search.html
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ <h1>Search video collector</h1>
1616
</div>
1717

1818
<div class="videos search-results" id="search-results">
19-
results
2019
</div>
2120

2221
{% endblock %}

‎code/ch6_active_search/ch6_final_video_collector/views/videos.py

Copy file name to clipboardExpand all lines: code/ch6_active_search/ch6_final_video_collector/views/videos.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def cancel_add(cat_name: str):
5353
def search():
5454
vm = SearchViewModel()
5555
if vm.is_htmx_request:
56-
return flask.make_response(f"There are {len(vm.videos)} videos.")
56+
html = flask.render_template('videos/partials/search_results.html', videos=vm.videos)
57+
return flask.make_response(html)
5758

5859
return vm.to_dict()

0 commit comments

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