From: Radek Czajka Date: Thu, 29 Apr 2021 13:39:45 +0000 (+0200) Subject: Introduce banner styles. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/13042ddcb4ad5af860cff616d2a69d4f05dac5d8 Introduce banner styles. --- diff --git a/src/annoy/locale/pl/LC_MESSAGES/django.mo b/src/annoy/locale/pl/LC_MESSAGES/django.mo index c0968ae07..8593b1d83 100644 Binary files a/src/annoy/locale/pl/LC_MESSAGES/django.mo and b/src/annoy/locale/pl/LC_MESSAGES/django.mo differ diff --git a/src/annoy/locale/pl/LC_MESSAGES/django.po b/src/annoy/locale/pl/LC_MESSAGES/django.po index 288d58933..71c39365e 100644 --- a/src/annoy/locale/pl/LC_MESSAGES/django.po +++ b/src/annoy/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2019-12-16 13:47+0100\n" +"PO-Revision-Date: 2021-04-29 15:39+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: pl\n" @@ -17,81 +17,89 @@ msgstr "" "Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=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 %}