From 8a9b3a19a215097199ae3afaaa2e56445f2fe1d2 Mon Sep 17 00:00:00 2001 From: syeopite Date: Mon, 3 May 2021 22:34:37 -0700 Subject: [PATCH] Add buffer btwn content and footer on some pages --- assets/css/default.css | 10 ++++++++++ src/invidious/helpers/macros.cr | 4 +++- src/invidious/routes/channels.cr | 6 +++--- src/invidious/routes/preferences.cr | 2 +- src/invidious/views/template.ecr | 4 ++++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index be1097a3..444905c5 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -590,3 +590,13 @@ hr { #content-navigation { margin-bottom: 0.5em; } + +#footer_buffer { + margin-top: 50vh; +} + +@media screen and (max-width: 450px) { + #footer_buffer { + display: none; + } +} diff --git a/src/invidious/helpers/macros.cr b/src/invidious/helpers/macros.cr index 5d426a8b..04f89a22 100644 --- a/src/invidious/helpers/macros.cr +++ b/src/invidious/helpers/macros.cr @@ -48,8 +48,10 @@ module JSON::Serializable end end -macro templated(filename, template = "template", navbar_search = true) +macro templated(filename, template = "template", navbar_search = true, buffer_footer=false) navbar_search = {{navbar_search}} + buffer_footer = {{buffer_footer}} + render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr" end diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 1b3544b1..d96f7c46 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -59,7 +59,7 @@ class Invidious::Routes::Channels < Invidious::Routes::BaseRoute items = items.select { |item| item.is_a?(SearchPlaylist) }.map { |item| item.as(SearchPlaylist) } items.each { |item| item.author = "" } - templated "channel/playlists" + templated "channel/playlists", buffer_footer: true end def community(env) @@ -126,7 +126,7 @@ class Invidious::Routes::Channels < Invidious::Routes::BaseRoute featured_channel_categories = fetch_channel_featured_channels(ucid, channel.tabs["channels"], nil, nil).not_nil! end - templated "channel/featured_channels" + templated "channel/featured_channels", buffer_footer: true end def featured_channel_category(env) @@ -161,7 +161,7 @@ class Invidious::Routes::Channels < Invidious::Routes::BaseRoute end locale, user, subscriptions, continuation, ucid, channel = data - templated "channel/about" + templated "channel/about", buffer_footer: true end private def fetch_basic_information(env) diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index 21d79218..b2c71680 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -6,7 +6,7 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute preferences = env.get("preferences").as(Preferences) - templated "preferences" + templated "preferences", buffer_footer: true end def update(env) diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index bf650a9d..91c1079d 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -132,6 +132,10 @@ <% end %> + <% if buffer_footer %> + + <% end %> +