]> git.gir.st - subscriptionfeed.git/blob - app/templates/macros.imp.j2
clean up sub* managers
[subscriptionfeed.git] / app / templates / macros.imp.j2
1 {% macro headerbar(search_query="") -%}
2 <style>
3 [name=q]::placeholder{
4 color:#eee;
5 opacity: .7;
6 }
7 </style>
8 <span style=float:left>
9 <a href="/">
10 <b style=font-size:large><!--span style=font-family:serif>&Delta;</span-->delta</b>
11 </a>
12 </span>
13 {% if current_user.is_anonymous %}
14 <a href="/login?next={{ request.url | urlencode }}" style=float:right>log in or sign up</a>
15 {% else %}
16 <span style=float:right>{{ current_user.name }} (<a href="/login">log out</a>)</span>
17 {% endif %}
18 <form method=get action=/search>
19 <input name=q style="margin:auto;display:block;width:30em;box-sizing:border-box;border:0;background:#666;color:#eee;padding:.2em"
20 placeholder="Search (through invidio.us)" value="{{ search_query | e }}">
21 <input type=hidden name=provider value="invidio.us:443">
22 <!--input type=submit value="?"-->
23 </form>
24 <hr>
25 {%- endmacro %}
26
27 {% macro card_generic(link, thumbnail, title='') -%}
28 <div class="card">
29 <div class="card-main">
30 <img class="thumb" src="{{ thumbnail }}">
31 <div class="title">{{ title | e }}</div>
32 <a class="link-main" href="{{ link }}" title="{{ title | e }}"></a>
33 </div>
34 <div class="infobar">
35 {{ caller() }}
36 </div>
37 </div>
38 {%- endmacro %}
39
40 {% macro card(video_id, title='', advanced_text='', pinned="undefined", advanced_title='', post_url=None) -%}
41 {% set caller_ = caller %}
42 {% call card_generic("/watch?v="~video_id, "https://i.ytimg.com/vi/"~video_id~"/mqdefault.jpg", title) %}
43 {{ caller_() }}
44 <details class="advanced"><summary title="{{advanced_title}}">{{ advanced_text }}</summary>
45 <div class="details">
46 {% if post_url %}
47 {{ emoji_link("comments", post_url, False) }}
48 {%endif%}
49 {% if pinned != "undefined" %}
50 {{ emoji_button("pin", video_id, pinned, False) }}
51 {{ emoji_button("hide", video_id, False, False) }}
52 {%endif%}
53 {{ emoji_link("raw", video_id, False) }}
54 {{ emoji_link("json", video_id, False) }}
55 </div></details>
56 {% endcall %}
57 {%- endmacro %}
58
59 {% macro infobar_subscriptions(video_id, channel_id, author) -%}
60 <a class="info-main" href="/channel/{{ channel_id }}">{{ author | e }}</a>
61 {%- endmacro %}
62
63 {% macro emoji_button(action, subject, reverse=False, text=False) -%}
64 {% set icons = {
65 'pin': ['&#x1f4cc;&#xFE0F;', '&#x1f4cc;&#xFE0F;&#8416;'],
66 'hide': ['&#x1f4a8;&#xFE0F;', ''],
67 'subscribe': ['&#128221;&#xFE0F;', '&#128465;&#xFE0F;'],
68 } %}
69 {% set texts = {
70 'pin': ['pin to <!--top of subscription--> feed', 'unpin'],
71 'hide': ['hide video', ''],
72 'subscribe': ['subscribe', 'unsubscribe'],
73 } %}
74 {% set actions = {
75 'pin': 'youtube.feed_post',
76 'hide': 'youtube.feed_post',
77 'subscribe': 'youtube.manage_subscriptions',
78 } %}
79 <form method=post action="{{ url_for(actions[action]) }}">
80 <input type="hidden" name="{{ 'un' if reverse }}{{ action }}" value="{{ subject }}">
81 <label>
82 <input class="emoji" type=submit value="{{ icons[action][reverse] }}" title="{{ texts[action][reverse] }}">
83 {{ texts[action][reverse] if text }}
84 </label>
85 </form>
86 {%- endmacro %}
87 {% macro emoji_link(action, subject, text=False) -%}
88 {% set icons = {
89 'raw': '&#x1F39E;&#xFE0F;',
90 'json': '&#x1f4a1;',
91 'comments': '&#x1f4ac;',
92 } %}
93 {% set texts = {
94 'raw': 'show raw video',
95 'json': 'view json metadata',
96 'comments': 'view comments',
97 } %}
98 {% set actions = {
99 'raw': '/watch?v='~subject~'&show=raw',
100 'json': '/watch?v='~subject~'&show=json',
101 'comments': 'https://old.reddit.com'~subject,
102 } %}
103 <a href="{{ actions[action] }}" title="{{ texts[action] }}"><span class="emoji">{{ icons[action] }}</span>{{ texts[action] if text }}</a>
104 {%- endmacro %}
Imprint / Impressum