From 48a6d2ddc3e5ce215beddd6369f01598651ad216 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 21 Dec 2023 09:23:22 +0100 Subject: [PATCH 1/1] blackout --- src/annoy/static/annoy/banner.js | 10 +-- .../templates/annoy/banner_blackout.html | 40 ++++++++++ src/annoy/templatetags/annoy.py | 8 ++ .../templates/catalogue/preview_ad.html | 8 +- .../catalogue/preview_ad_homepage.html | 2 + .../templates/catalogue/viewer_base.html | 4 +- src/wolnelektury/settings/static.py | 1 + .../static/2022/styles/layout/_annoy.scss | 73 +++++++++++++++++++ src/wolnelektury/templates/header.html | 3 + 9 files changed, 138 insertions(+), 11 deletions(-) create mode 100644 src/annoy/templates/annoy/banner_blackout.html create mode 100644 src/wolnelektury/static/2022/styles/layout/_annoy.scss diff --git a/src/annoy/static/annoy/banner.js b/src/annoy/static/annoy/banner.js index 44a1d0223..74a7292e6 100644 --- a/src/annoy/static/annoy/banner.js +++ b/src/annoy/static/annoy/banner.js @@ -22,12 +22,10 @@ _paq.push(['trackEvent', 'banner', 'banner-hide', $target.attr('id')]); }); - if (Modernizr.localstorage) { - if (!localStorage[tag]) { - $on.hide(); - $target.show(); - _paq.push(['trackEvent', 'banner', 'banner-show', $target.attr('id')]); - } + if (!localStorage[tag]) { + $on.hide(); + $target.show(); + _paq.push(['trackEvent', 'banner', 'banner-show', $target.attr('id')]); } }); diff --git a/src/annoy/templates/annoy/banner_blackout.html b/src/annoy/templates/annoy/banner_blackout.html new file mode 100644 index 000000000..c96751f38 --- /dev/null +++ b/src/annoy/templates/annoy/banner_blackout.html @@ -0,0 +1,40 @@ +{% if banner %} + {% if closable %} + + + {% endif %} +
+
+ +
+ {{ banner.get_text|safe|linebreaks }} + +
+ {% if banner.image %} +
+ +
+ {% endif %} +
+
+ +{% endif %} diff --git a/src/annoy/templatetags/annoy.py b/src/annoy/templatetags/annoy.py index 21f1bb85e..2bc93143c 100644 --- a/src/annoy/templatetags/annoy.py +++ b/src/annoy/templatetags/annoy.py @@ -14,6 +14,14 @@ def annoy_banner(context, place): 'closable': PLACES.get(place, False), } +@register.inclusion_tag('annoy/banner_blackout.html', takes_context=True) +def annoy_banner_blackout(context): + banners = Banner.choice('blackout', request=context['request']) + return { + 'banner': banners.first(), + 'closable': True, + } + @register.inclusion_tag('annoy/banners.html', takes_context=True) def annoy_banners(context, place): diff --git a/src/catalogue/templates/catalogue/preview_ad.html b/src/catalogue/templates/catalogue/preview_ad.html index b2c24462c..5cfbb1222 100644 --- a/src/catalogue/templates/catalogue/preview_ad.html +++ b/src/catalogue/templates/catalogue/preview_ad.html @@ -16,9 +16,11 @@