From ed5c14ca1c78032e45b390730cbc2e1c81b1662a Mon Sep 17 00:00:00 2001 From: girst Date: Thu, 23 Jul 2020 14:33:57 +0200 Subject: [PATCH] let all templates inherit from a base template also some minor html changes (emojibuttons, navigation, css, ...) --- app/invidious/templates/channel.html.j2 | 19 +++---- app/invidious/templates/search.html.j2 | 21 ++++---- app/reddit/templates/reddit.html.j2 | 22 ++++---- .../templates/subreddit_manager.html.j2 | 21 ++++---- app/static/style.css | 19 +++---- app/templates/base.html.j2 | 52 +++++++++++++++++++ app/templates/login.html.j2 | 21 +++----- app/templates/macros.imp.j2 | 38 +++----------- app/youtube/templates/index.html.j2 | 22 ++++---- .../templates/subscription_manager.html.j2 | 18 +++---- app/youtube/templates/watch.html.j2 | 16 ++---- app/youtube/templates/xmlfeed.html.j2 | 16 ++---- 12 files changed, 140 insertions(+), 145 deletions(-) create mode 100644 app/templates/base.html.j2 diff --git a/app/invidious/templates/channel.html.j2 b/app/invidious/templates/channel.html.j2 index 49f0023..8b0a766 100644 --- a/app/invidious/templates/channel.html.j2 +++ b/app/invidious/templates/channel.html.j2 @@ -1,16 +1,10 @@ - -{{ title | e }} - - +{% extends "base.html.j2" %} +{% import 'macros.imp.j2' as macros %} -{% import 'macros.imp.j2' as macros with context %} +{% block title %}{{ title | e }}{% endblock %} -{{ macros.headerbar(search_query=query) }} - -{% include 'messages.inc.j2' %} - -
-

{{ title | e }}

+{% block content %} +{{ super() }}
{% for row in rows %} {% call macros.card(row.videoId, row.title, row.publishedText) %} @@ -27,6 +21,9 @@ previous | {% endif %} next +{% endblock %} +{% block footer %}
This page is proxied through invidio.us. +{% endblock %} diff --git a/app/invidious/templates/search.html.j2 b/app/invidious/templates/search.html.j2 index dfc29b1..70eabd4 100644 --- a/app/invidious/templates/search.html.j2 +++ b/app/invidious/templates/search.html.j2 @@ -1,16 +1,10 @@ - -{{ query | e }} — Search results - - +{% extends "base.html.j2" %} +{% import 'macros.imp.j2' as macros %} -{% import 'macros.imp.j2' as macros with context %} +{% block title %}{{ query | e }} — Search results{% endblock %} -{{ macros.headerbar(search_query=query) }} - -{% include 'messages.inc.j2' %} - -
-

{{ query | e }}

+{% block content %} +{{ super() }}
{% for row in rows %} {% call macros.card(row.videoId, row.title, row.publishedText) %} @@ -21,11 +15,14 @@ {% endfor %} {{ macros.dummycard() }}
-
{% if page > 1 %} previous | {% endif %} next +{% endblock %} +{% block footer %}
+This page is proxied through invidio.us. +{% endblock %} diff --git a/app/reddit/templates/reddit.html.j2 b/app/reddit/templates/reddit.html.j2 index 92c82c3..b42bd5a 100644 --- a/app/reddit/templates/reddit.html.j2 +++ b/app/reddit/templates/reddit.html.j2 @@ -1,19 +1,17 @@ - -{{ title | e }} +{% extends "base.html.j2" %} +{% import 'macros.imp.j2' as macros %} + +{% block title %}{{ title | e }}{% endblock %} +{% block favicon %} - +{% endblock %} -{% import 'macros.imp.j2' as macros with context %} -{{ macros.headerbar() }} - -{% include 'messages.inc.j2' %} - -
-

{{ title | e }}

+{% block content %} +{{ super() }}
{% for row in rows %} {% set karma = '↑' ~ row.n_karma|trim3 %} @@ -32,7 +30,6 @@ {% endfor %} {{ macros.dummycard() }}
-
{% if before %} prev | @@ -40,10 +37,13 @@ {% if after %} next {% endif %} +{% endblock %} +{% block footer %}
Manage Subreddits {% for subreddit in subreddits %} {{ "||" if loop.first else "|"}} /r/{{ subreddit }} {% endfor %} +{% endblock %} diff --git a/app/reddit/templates/subreddit_manager.html.j2 b/app/reddit/templates/subreddit_manager.html.j2 index a2a562e..9614b46 100644 --- a/app/reddit/templates/subreddit_manager.html.j2 +++ b/app/reddit/templates/subreddit_manager.html.j2 @@ -1,16 +1,13 @@ - -Subreddit Manager - - - -{% import 'macros.imp.j2' as macros with context %} -{{ macros.headerbar() }} +{% extends "base.html.j2" %} +{% import 'macros.imp.j2' as macros %} -
-

Subreddit Manager

- -{% include 'messages.inc.j2' %} +{% block title %}Subreddit Manager{% endblock %} +{% block favicon %} + +{% endblock %} +{% block content %} +{{ super() }} -
+{% endblock %} diff --git a/app/static/style.css b/app/static/style.css index 890af33..2d5f447 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -91,15 +91,18 @@ article { padding-bottom: 0; } -.emoji{ -padding: 0 .7em; -cursor:pointer; -background: none; - border: none; +.emoji { + cursor:pointer; color: white; } +.card .emoji, #submgr .emoji { + padding: 0 .7em; +} +.card .details>:last-child .emoji { + padding-right: 0; +} #submgr .emoji{ -margin-right:1em + margin-right:1em; } .advanced summary{ margin-bottom: .5em; @@ -122,9 +125,6 @@ margin:0; details .details { display: flex; } -.advanced .details>:last-child .emoji { - padding-right: 0 -} ul#submgr{list-style: none} #submgr form { display: inline; @@ -168,6 +168,7 @@ ul#submgr{list-style: none} height: 100%; } +.more-actions .emoji, .more-actions input[type="checkbox"] { margin: 0 .7em; /*like input.emoji's padding*/ } diff --git a/app/templates/base.html.j2 b/app/templates/base.html.j2 new file mode 100644 index 0000000..d0ea6c2 --- /dev/null +++ b/app/templates/base.html.j2 @@ -0,0 +1,52 @@ + +{% block title %}{% endblock %} +{% block favicon %} + +{% endblock %} + + +{% import 'macros.imp.j2' as macros %} + +{% block header %} + + + + Δ{{ request.host }} + + + {% if current_user.is_anonymous %} + log in or sign up + {% else %} + {{ current_user.name }} (log out) + {% endif %} + + + + + +
+{% endblock %} + +{% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} +
    + {% for (type, message) in messages %} +
  • {{ type }}: {{ message }}
  • + {% endfor %} +
+ {% endif %} +{% endwith %} + +
+ {% block content %} +

{{ self.title() }}

+ {% endblock %} +
+ +{% block footer %}{% endblock %} diff --git a/app/templates/login.html.j2 b/app/templates/login.html.j2 index 9c33db9..f0a3767 100644 --- a/app/templates/login.html.j2 +++ b/app/templates/login.html.j2 @@ -1,17 +1,10 @@ - -Log In or Sign Up - - +{% extends "base.html.j2" %} +{% import 'macros.imp.j2' as macros %} -{% import 'macros.imp.j2' as macros with context %} +{% block title %}Log In or Sign Up{% endblock %} -{{ macros.headerbar() }} - -

Log In or Sign Up

- -{% include 'messages.inc.j2' %} - -
+{% block content %} +{{ super() }} {% if current_user.is_authenticated %}
@@ -19,10 +12,10 @@ {% else %}
-
+

{% endif %} -
+{% endblock %} diff --git a/app/templates/macros.imp.j2 b/app/templates/macros.imp.j2 index 1641888..3c2589d 100644 --- a/app/templates/macros.imp.j2 +++ b/app/templates/macros.imp.j2 @@ -1,29 +1,3 @@ -{% macro headerbar(search_query="") -%} - - - - Δ{{ request.host }} - - - {% if current_user.is_anonymous %} - log in or sign up - {% else %} - {{ current_user.name }} (log out) - {% endif %} -
- - - -
-
-{%- endmacro %} - {% macro card_generic(link, thumbnail, title='') -%}
@@ -84,9 +58,10 @@ } %}
-