From 13042ddcb4ad5af860cff616d2a69d4f05dac5d8 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 29 Apr 2021 15:39:45 +0200 Subject: [PATCH 1/1] Introduce banner styles. --- src/annoy/locale/pl/LC_MESSAGES/django.mo | Bin 1787 -> 1980 bytes src/annoy/locale/pl/LC_MESSAGES/django.po | 54 ++++++++++++++-------- src/annoy/migrations/0009_banner_style.py | 18 ++++++++ src/annoy/models.py | 7 ++- src/annoy/places.py | 15 +++++- src/annoy/static/annoy/banner.scss | 48 ++++++++++++++++++- src/annoy/templates/annoy/banner.html | 2 +- 7 files changed, 121 insertions(+), 23 deletions(-) create mode 100644 src/annoy/migrations/0009_banner_style.py diff --git a/src/annoy/locale/pl/LC_MESSAGES/django.mo b/src/annoy/locale/pl/LC_MESSAGES/django.mo index c0968ae07d2896af5cc85338153cc98e1736819c..8593b1d83775c71842d63dcdf6d9762effa242ea 100644 GIT binary patch delta 848 zcmX}qKWGzS7{~Fa`O|7@tc{JWTJZ)&r8G2YMe87nViy%DcF@IM;{_pS5|RrNmqMIG z5aZ$KTk3pe6j9Kr_}$5l+=6V%2pd*g3V3B5%v{JA&&9h1EO>b(!dD313eH?5b# zDEr$O4{fR)#}pHpc1=@)L{2f>pbkuKSG*dkFj^E zolY^N`n%a}L*_fJ)uO6U?HlD%RXRf*hbmL3BMNP-bJe$_O%z+X)Hx-ogjCGGP@xKS zhS<~jc=V*o6w2I=77AWIs5wi%n=h8@K_)yBIh#09_kE|9uXh#Odo2Uv+Wn1hcP!8Z)!7p7u3XqJgFjG1j(DGymp)L;l(F#|hL8}<3~ zNmK!&sD&r|`9+NKzJ?BN`}4cV$MzVmIE;r0-h0_Z>ug{)``Zo=WlS7n3tnOzU$7V> zluxBrg*r)sK__X)T7LZy)QADbM|Dgk^xE{4$p_b}DpvWe5GHt56(mkuS?Eljd z-LG1xP~qNbAn65yW8P|T--|i}Ic{s6+gRr|$K9s3L`!XhdpYlnr#OxEi45;4H0O=2 && n%10<=4) && (n" "%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n" "%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" -"X-Generator: Poedit 2.2.4\n" +"X-Generator: Poedit 2.3\n" #: annoy/models.py:11 msgid "place" msgstr "miejsce" #: annoy/models.py:13 +msgid "style" +msgstr "styl" + +#: annoy/models.py:15 +msgid "Affects blackout." +msgstr "Dotyczy blackoutu." + +#: annoy/models.py:18 msgid "action label" msgstr "etykieta akcji" -#: annoy/models.py:15 +#: annoy/models.py:20 msgid "If empty, whole banner will serve as a link" msgstr "Jeśli pusta, cały banner będzie służył jako link." -#: annoy/models.py:17 +#: annoy/models.py:22 msgid "open label" msgstr "etykieta otwierania" -#: annoy/models.py:18 +#: annoy/models.py:23 msgid "close label" msgstr "etykieta zamykania" -#: annoy/models.py:19 annoy/models.py:98 +#: annoy/models.py:24 annoy/models.py:103 msgid "text" msgstr "tekst" -#: annoy/models.py:20 +#: annoy/models.py:25 msgid "image" msgstr "obraz" -#: annoy/models.py:21 +#: annoy/models.py:26 msgid "url" msgstr "URL" -#: annoy/models.py:23 +#: annoy/models.py:28 msgid "priority" msgstr "priortytet" -#: annoy/models.py:24 +#: annoy/models.py:29 msgid "Banners with higher priority come first." msgstr "Bannery z wyższym priorytetem mają pierwszeństwo." -#: annoy/models.py:25 +#: annoy/models.py:30 msgid "since" msgstr "od" -#: annoy/models.py:26 +#: annoy/models.py:31 msgid "until" msgstr "do" -#: annoy/models.py:27 +#: annoy/models.py:32 msgid "show members" msgstr "widoczny dla członków klubu" -#: annoy/models.py:28 +#: annoy/models.py:33 msgid "staff preview" msgstr "podgląd tylko dla zespołu" -#: annoy/models.py:31 +#: annoy/models.py:36 msgid "banner" msgstr "banner" -#: annoy/models.py:32 +#: annoy/models.py:37 msgid "banners" msgstr "bannery" -#: annoy/models.py:70 +#: annoy/models.py:75 msgid "pararaphs" msgstr "akapity" -#: annoy/models.py:74 +#: annoy/models.py:79 msgid "dynamic insert" msgstr "dynamiczna wstawka" -#: annoy/models.py:75 +#: annoy/models.py:80 msgid "dynamic inserts" msgstr "dynamiczne wstawki" @@ -114,3 +122,11 @@ msgstr "Obok listy fragmentów książki" #: annoy/places.py:8 msgid "Blackout" msgstr "Blackout" + +#: annoy/places.py:9 +msgid "Full screen" +msgstr "Cały ekran" + +#: annoy/places.py:11 +msgid "Upper half of screen" +msgstr "Górna połowa ekranu" diff --git a/src/annoy/migrations/0009_banner_style.py b/src/annoy/migrations/0009_banner_style.py new file mode 100644 index 000000000..3520da47e --- /dev/null +++ b/src/annoy/migrations/0009_banner_style.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.19 on 2021-04-29 12:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('annoy', '0008_dynamictextinserttext_own_colors'), + ] + + operations = [ + migrations.AddField( + model_name='banner', + name='style', + field=models.CharField(blank=True, choices=[('blackout_full', 'Full screen'), ('blackout_centre', 'Centre of screen'), ('blackout_upper', 'Upper half of screen')], help_text='Affects blackout.', max_length=255, verbose_name='style'), + ), + ] diff --git a/src/annoy/models.py b/src/annoy/models.py index 488fa87a8..4df3a5e37 100644 --- a/src/annoy/models.py +++ b/src/annoy/models.py @@ -4,11 +4,16 @@ from django.db import models from django.template import Context, Template from django.utils.translation import ugettext_lazy as _ from django.utils.timezone import now -from .places import PLACES, PLACE_CHOICES +from .places import PLACES, PLACE_CHOICES, STYLES class Banner(models.Model): place = models.SlugField(_('place'), choices=PLACE_CHOICES) + style = models.CharField( + _('style'), max_length=255, blank=True, + choices=STYLES, + help_text=_('Affects blackout.') + ) action_label = models.CharField( _('action label'), max_length=255, blank=True, diff --git a/src/annoy/places.py b/src/annoy/places.py index 93b22e44e..7663a6105 100644 --- a/src/annoy/places.py +++ b/src/annoy/places.py @@ -5,7 +5,11 @@ PLACE_DEFINITIONS = [ ('book-page', _('Book page'), False), ('book-text-intermission', _('Book text intermission'), False), ('book-fragment-list', _('Next to list of book fragments.'), False), - ('blackout', _('Blackout'), True), + ('blackout', _('Blackout'), True, ( + ('full', _('Full screen')), +# ('centre', _('Centre of screen')), + ('upper', _('Upper half of screen')), + )), ] PLACE_CHOICES = [p[:2] for p in PLACE_DEFINITIONS] @@ -14,3 +18,12 @@ PLACES = { p[0]: p[2] for p in PLACE_DEFINITIONS } + + +STYLES = [] +for p in PLACE_DEFINITIONS: + if len(p) > 3: + STYLES.extend([ + (f'{p[0]}_{s[0]}', s[1]) + for s in p[3] + ]) diff --git a/src/annoy/static/annoy/banner.scss b/src/annoy/static/annoy/banner.scss index 3e5a3b8c9..746f869a8 100644 --- a/src/annoy/static/annoy/banner.scss +++ b/src/annoy/static/annoy/banner.scss @@ -126,6 +126,7 @@ font-size: 16pt; line-height: 26pt; padding: 0; + overflow: hidden; .annoy-banner-inner { padding: 0 40% 0 15%; @@ -133,7 +134,7 @@ overflow-y: scroll; padding-top: 20vh; padding-bottom: 2em; - width: 101vw; + width: 101%; box-sizing: border-box; } @@ -218,8 +219,53 @@ } } + &.annoy-banner-style_blackout_centre { + background: rgba(0,0,0,.5); + + .annoy-banner-inner { + background: black; + position: absolute; + top: 14%; + left: 14%; + right: 14%; + bottom: 14%; + width: auto; + height: auto; + border: 2px solid white; + overflow-y: auto; + } + + } + @media screen and (min-height: 500px) { + &.annoy-banner-style_blackout_upper { + background: rgba(0,0,0,.5); + + .annoy-banner-inner { + background: black; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 50%; + width: auto; + height: auto; + border-bottom: 2px solid white; + overflow-y: auto; + + .action { + bottom: 20vh; + } + } + + .annoy-banner-off { + bottom: 60vh; + } + } + } } + + .annoy-banner-on_blackout { position: fixed; z-index: 9999; diff --git a/src/annoy/templates/annoy/banner.html b/src/annoy/templates/annoy/banner.html index 9d001683c..62b641a43 100644 --- a/src/annoy/templates/annoy/banner.html +++ b/src/annoy/templates/annoy/banner.html @@ -7,7 +7,7 @@ {{ banner.open_label }} {% endif %} -
+
{% if not banner.action_label %} {% endif %} -- 2.20.1