fix: add Thumbnail field and video result template
MainResult: add Thumbnail field (used by YouTube, images, etc.) video_item.html: new partial for video results with thumbnail display views.go: add templateForResult func + video_item.html to template parse results_inner.html: dispatch to video_item when Template="videos" kafka.css: add .video-result flex layout with thumbnail styling
This commit is contained in:
parent
a97fb4daf9
commit
074123e188
5 changed files with 79 additions and 23 deletions
|
|
@ -63,16 +63,24 @@ func init() {
|
|||
|
||||
funcMap := template.FuncMap{
|
||||
"urlquery": template.URLQueryEscaper,
|
||||
// templateForResult returns the template name to use for a result.
|
||||
// Defaults to "result_item"; use "video_item" for video results.
|
||||
"templateForResult": func(tmpl string) string {
|
||||
if tmpl == "videos" {
|
||||
return "video_item"
|
||||
}
|
||||
return "result_item"
|
||||
},
|
||||
}
|
||||
|
||||
tmplFull = template.Must(template.New("").Funcs(funcMap).ParseFS(tmplFS,
|
||||
"base.html", "results.html", "results_inner.html", "result_item.html",
|
||||
"base.html", "results.html", "results_inner.html", "result_item.html", "video_item.html",
|
||||
))
|
||||
tmplIndex = template.Must(template.New("").Funcs(funcMap).ParseFS(tmplFS,
|
||||
"base.html", "index.html",
|
||||
))
|
||||
tmplFragment = template.Must(template.New("").Funcs(funcMap).ParseFS(tmplFS,
|
||||
"results_inner.html", "result_item.html",
|
||||
"results_inner.html", "result_item.html", "video_item.html",
|
||||
))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue