]> git.gir.st - subscriptionfeed.git/blob - app/dangerous/templates/search.html.j2
don't show 'None' if not video age
[subscriptionfeed.git] / app / dangerous / templates / search.html.j2
1 {% extends "base.html.j2" %}
2 {% import 'macros.imp.j2' as macros %}
3
4 {% block title %}
5 {% if rows is not none %}{{ query | e }} — Search results
6 {% else %}Search Youtube Videos{% endif %}
7 {% endblock %}
8
9 {% block content %}
10 <style>
11 [name=q]::placeholder{
12 color:#eee;
13 opacity: .7;
14 }
15 [name=q] {
16 margin:1.5em auto;
17 display:block;
18 width:60em;
19 max-width:100%;
20 min-width:30em;
21 box-sizing:border-box;
22 border:0;
23 background:#666;
24 color:#eee;
25 padding:.2em
26 }
27 </style>
28 <form method=get action=/search>
29 <input name=q placeholder="Search" value="{{ query | e if query }}">
30 <!--input type=submit value="?"-->
31 </form>
32
33 {% if rows is not none %}
34 {{ super() }}
35
36 {# TODO: this is mostly copy-pasted (changed video infobar) from watch.j2's info/endcard section -- dedup! #}
37 <!-- not implemented warning:--><div style="background:red">{%for x in rows|selectattr('content.error')%}{{x.content.error}}{%endfor%}</div>
38 <div class="cards">
39 {% for card in rows %}
40 {% set c = card.content %}
41 {% if card.type == 'VIDEO' %}
42 {% call macros.card(c.video_id, c.title, c.length) %}
43 {{ macros.infobar_subscriptions(c.video_id, c.channel_id, c.author) }}
44 <small>{{ c.published if c.published }}&nbsp;</small>
45 {% endcall %}
46 {% elif card.type == 'CHANNEL' and c.channel_id != channel_id %}
47 {% call macros.card_generic("/channel/"~c.channel_id, c.icons[c.icons.largest] if 'icons' in c else '', c.title) %}
48 <span class=channel>Channel</span>
49 <span class=advanced>{{ c.subscribers }}</span>
50 {% endcall %}
51 {% elif card.type == 'PLAYLIST' %}
52 {% call macros.card_generic("/playlist?list="~c.playlist_id, "https://i.ytimg.com/vi/"~c.video_id~"/mqdefault.jpg", c.title) %}
53 <span class=channel>{{ c.author }}</span>
54 <span class=advanced>{{ c.n_videos }} videos</span>
55 {% endcall %}
56 {% elif card.type == 'WEBSITE' %}
57 {% call macros.card_generic(c.url, c.icons[250] if 'icons' in c else '', c.title) %}
58 <span class=channel>{{ c.domain }}</span>
59 {% endcall %}
60 {% endif %}
61 {% endfor %}
62 {{ macros.dummycard() }}
63 </div>
64
65 <div class="pagination-container">
66 {% if page > 1 %}
67 {{ macros.pagination("previous", {'page':(-1,1)}, -1) }}
68 {% endif %}
69 {{ macros.pagination("next", {'page':(+1,1)}, +1) }}
70 </div>
71 {% else %}
72 please type a search query.
73 {% endif %}
74 {% endblock %}
75
76 {% block footer %}
77 <hr>
78 {% endblock %}
Imprint / Impressum