File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
code/ch6_active_search/ch6_final_video_collector Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ <h1>Search video collector</h1>
88 placeholder ="Search for a video ... "
99 class ="form-control "
1010 type ="text "
11+ value ="{{ search_text or '' }} "
1112 hx-get ="/videos/search "
1213 hx-trigger ="keyup changed delay:250ms "
1314 hx-target ="#search-results "
@@ -17,6 +18,11 @@ <h1>Search video collector</h1>
1718 </ div >
1819
1920 < div class ="videos search-results " id ="search-results ">
21+
22+ {% if search_text %}
23+ {{ render_partial('videos/partials/search_results.html', videos=videos) }}
24+ {% endif %}
25+
2026 </ div >
2127
2228{% endblock %}
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ def cancel_add(cat_name: str):
5252@response (template_file = 'videos/search.html' )
5353def search ():
5454 vm = SearchViewModel ()
55+ print (f"Searching for { vm .search_text } " )
5556 if vm .is_htmx_request :
5657 html = flask .render_template ('videos/partials/search_results.html' , videos = vm .videos )
5758 return flask .make_response (html )
You can’t perform that action at this time.
0 commit comments