From: Radek Czajka Date: Mon, 16 Dec 2019 12:48:09 +0000 (+0100) Subject: More annoying. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/1227b1201c537ea17e310f0faab4ead7cf0d25af More annoying. --- diff --git a/src/annoy/admin.py b/src/annoy/admin.py index 7a82d6867..3f2bd3dd8 100644 --- a/src/annoy/admin.py +++ b/src/annoy/admin.py @@ -11,9 +11,23 @@ class BannerAdmin(TranslationAdmin): admin.site.register(models.Banner, BannerAdmin) +class DTITForm(forms.ModelForm): + class Meta: + model = models.DynamicTextInsertText + fields = '__all__' + widgets = { + 'background_color': forms.TextInput(attrs={"type": "color"}), + 'text_color': forms.TextInput(attrs={"type": "color"}), + } + + class DynamicTextInsertTextInline(admin.TabularInline): model = models.DynamicTextInsertText - fields = ['text', 'image', 'background_color', 'text_color'] + form = DTITForm + fields = ['text', 'image', 'own_colors', 'background_color', 'text_color'] + extra = 0 + min_num = 1 + class DynamicTextInsertAdmin(admin.ModelAdmin): diff --git a/src/annoy/locale/pl/LC_MESSAGES/django.mo b/src/annoy/locale/pl/LC_MESSAGES/django.mo index 4e372203e..c0968ae07 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 69e2112e6..078c9936e 100644 --- a/src/annoy/locale/pl/LC_MESSAGES/django.po +++ b/src/annoy/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,10 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-13 13:42+0100\n" -"PO-Revision-Date: 2019-12-13 13:45+0100\n" +"POT-Creation-Date: 2019-12-16 13:47+0100\n" +"PO-Revision-Date: 2019-12-16 13:47+0100\n" +"Last-Translator: \n" +"Language-Team: \n" "Language: pl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -16,8 +18,6 @@ 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" -"Last-Translator: \n" -"Language-Team: \n" "X-Generator: Poedit 2.2.4\n" #: models.py:10 @@ -40,55 +40,59 @@ msgstr "etykieta otwierania" msgid "close label" msgstr "etykieta zamykania" -#: models.py:18 models.py:84 +#: models.py:18 models.py:86 msgid "text" msgstr "tekst" #: models.py:19 +msgid "image" +msgstr "obraz" + +#: models.py:20 msgid "url" msgstr "URL" -#: models.py:21 +#: models.py:22 msgid "priority" msgstr "priortytet" -#: models.py:22 +#: models.py:23 msgid "Banners with higher priority come first." msgstr "Bannery z wyższym priorytetem mają pierwszeństwo." -#: models.py:23 +#: models.py:24 msgid "since" msgstr "od" -#: models.py:24 +#: models.py:25 msgid "until" msgstr "do" -#: models.py:25 +#: models.py:26 msgid "show members" msgstr "widoczny dla członków klubu" -#: models.py:26 +#: models.py:27 msgid "staff preview" msgstr "podgląd tylko dla zespołu" -#: models.py:29 +#: models.py:30 msgid "banner" msgstr "banner" -#: models.py:30 +#: models.py:31 msgid "banners" msgstr "bannery" -#: models.py:65 +#: models.py:66 msgid "pararaphs" msgstr "akapity" -#: models.py:69 +#: models.py:70 msgid "dynamic insert" msgstr "dynamiczna wstawka" -#: models.py:70 +#: models.py:71 msgid "dynamic inserts" msgstr "dynamiczne wstawki" diff --git a/src/annoy/migrations/0007_auto_20191216_1126.py b/src/annoy/migrations/0007_auto_20191216_1126.py new file mode 100644 index 000000000..458446f4b --- /dev/null +++ b/src/annoy/migrations/0007_auto_20191216_1126.py @@ -0,0 +1,123 @@ +# Generated by Django 2.2.6 on 2019-12-16 10:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('annoy', '0006_auto_20191213_1328'), + ] + + operations = [ + migrations.AddField( + model_name='banner', + name='image', + field=models.FileField(blank=True, upload_to='annoy/banners/', verbose_name='image'), + ), + migrations.AlterField( + model_name='banner', + name='action_label', + field=models.CharField(blank=True, help_text='If empty, whole banner will serve as a link', max_length=255, verbose_name='action label'), + ), + migrations.AlterField( + model_name='banner', + name='close_label', + field=models.CharField(blank=True, max_length=255, verbose_name='close label'), + ), + migrations.AlterField( + model_name='banner', + name='open_label', + field=models.CharField(blank=True, max_length=255, verbose_name='open label'), + ), + migrations.AlterField( + model_name='banner', + name='place', + field=models.SlugField(choices=[('top', 'Top of all pages.'), ('book-page', 'Book page'), ('book-text-intermission', 'Book text intermission'), ('book-fragment-list', 'Next to list of book fragments.'), ('blackout', 'Blackout')], verbose_name='place'), + ), + migrations.AlterField( + model_name='banner', + name='priority', + field=models.PositiveSmallIntegerField(default=0, help_text='Banners with higher priority come first.', verbose_name='priority'), + ), + migrations.AlterField( + model_name='banner', + name='show_members', + field=models.BooleanField(default=False, verbose_name='show members'), + ), + migrations.AlterField( + model_name='banner', + name='since', + field=models.DateTimeField(blank=True, null=True, verbose_name='since'), + ), + migrations.AlterField( + model_name='banner', + name='staff_preview', + field=models.BooleanField(default=False, verbose_name='staff preview'), + ), + migrations.AlterField( + model_name='banner', + name='text', + field=models.TextField(verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_de', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_en', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_es', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_fr', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_it', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_lt', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_pl', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_ru', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='text_uk', + field=models.TextField(null=True, verbose_name='text'), + ), + migrations.AlterField( + model_name='banner', + name='until', + field=models.DateTimeField(blank=True, null=True, verbose_name='until'), + ), + migrations.AlterField( + model_name='banner', + name='url', + field=models.CharField(max_length=1024, verbose_name='url'), + ), + migrations.AlterField( + model_name='dynamictextinserttext', + name='image', + field=models.FileField(blank=True, upload_to='annoy/inserts/'), + ), + ] diff --git a/src/annoy/migrations/0008_dynamictextinserttext_own_colors.py b/src/annoy/migrations/0008_dynamictextinserttext_own_colors.py new file mode 100644 index 000000000..44e77db42 --- /dev/null +++ b/src/annoy/migrations/0008_dynamictextinserttext_own_colors.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.6 on 2019-12-16 12:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('annoy', '0007_auto_20191216_1126'), + ] + + operations = [ + migrations.AddField( + model_name='dynamictextinserttext', + name='own_colors', + field=models.BooleanField(default=False), + ), + ] diff --git a/src/annoy/models.py b/src/annoy/models.py index 600fe5fca..3df56b2ea 100644 --- a/src/annoy/models.py +++ b/src/annoy/models.py @@ -16,6 +16,7 @@ class Banner(models.Model): open_label = models.CharField(_('open label'), max_length=255, blank=True) close_label = models.CharField(_('close label'), max_length=255, blank=True) text = models.TextField(_('text')) + image = models.FileField(_('image'), upload_to='annoy/banners/', blank=True) url = models.CharField(_('url'), max_length=1024) priority = models.PositiveSmallIntegerField( _('priority'), default=0, @@ -79,7 +80,8 @@ class DynamicTextInsert(models.Model): class DynamicTextInsertText(models.Model): insert = models.ForeignKey(DynamicTextInsert, models.CASCADE) + own_colors = models.BooleanField(default=False) background_color = models.CharField(max_length=10, blank=True) text_color = models.CharField(max_length=10, blank=True) text = models.TextField(_('text')) - image = models.FileField(blank=True) + image = models.FileField(blank=True, upload_to='annoy/inserts/') diff --git a/src/annoy/static/annoy/banner.scss b/src/annoy/static/annoy/banner.scss index 33fd48199..c9ddd2ded 100644 --- a/src/annoy/static/annoy/banner.scss +++ b/src/annoy/static/annoy/banner.scss @@ -20,9 +20,40 @@ .annoy-banner_top { display: none; + .annoy-banner-inner { + @media screen and (min-width: 960px) { + width: 960px; + margin: auto; + } + display: flex; + flex-direction: column; + + @media screen and (min-width: 400px) { + flex-direction: row; + } + } + + img { + margin: 0; + align-self: center; + max-height: 40px; + @media screen and (min-width: 400px) { + max-height: 60px; + } + } + .text { + flex: 1; + align-self: center; + padding: .5em 1em; + } + p { margin: 0; - font-size: 2em; + font-size: 1.5em; + + @media screen and (min-width: 400px) { + font-size: 2em; + } } .annoy-banner-off { @@ -125,7 +156,7 @@ } &.action { - bottom: 33vh; + bottom: 40vh; background: #018189; color: white; border-radius: auto 100%; @@ -177,7 +208,7 @@ } @media screen and (max-height: 400px) { a.action { - bottom: 30vh; + bottom: 40vh; } } @@ -196,18 +227,65 @@ -.dynamic-insert.with-image { - min-height: 120px; - padding: 0; +.dynamic-insert { + background: orange; + + &.with-image { + min-height: 120px; + } + padding: 0; + a { - position: relative; + color: black; + display: flex; + flex-direction: row; + .text { + padding: 2em; + flex: 1; } img { - position: absolute; - top: 10px; - right: 10px; + border-radius: 100%; + margin: 1em; + } + } +} + + + +.annoy-banner_book-text-intermission { + display: none; + + .annoy-banner-inner { + display: flex; + flex-direction: column; + + @media screen and (min-width: 400px) { + flex-direction: row; + } + } + + img { + margin: 0; + align-self: center; + max-height: 60px; + @media screen and (min-width: 400px) { + max-height: 100px; + } + } + .text { + flex: 1; + align-self: center; + padding: .5em 1em; + } + + p { + margin: 0; + font-size: 1.5em; + + @media screen and (min-width: 400px) { + font-size: 2em; } } } diff --git a/src/annoy/static/annoy/book_text.scss b/src/annoy/static/annoy/book_text.scss index 37c83ef70..31f09f4fb 100644 --- a/src/annoy/static/annoy/book_text.scss +++ b/src/annoy/static/annoy/book_text.scss @@ -1,15 +1,3 @@ -.dynamic-insert, .intermission { - margin: 2em 0; - padding: 2em; - background: orange; - - a { - display: block; - color: black; - } -} - - #annoy-stubs { display: none; } diff --git a/src/annoy/templates/annoy/banner.html b/src/annoy/templates/annoy/banner.html index 3f54eb26e..012be118e 100644 --- a/src/annoy/templates/annoy/banner.html +++ b/src/annoy/templates/annoy/banner.html @@ -7,22 +7,31 @@ {{ banner.open_label }} {% endif %} -
+ {% endif %} diff --git a/src/annoy/templates/annoy/dynamic_insert.html b/src/annoy/templates/annoy/dynamic_insert.html new file mode 100644 index 000000000..8285e2486 --- /dev/null +++ b/src/annoy/templates/annoy/dynamic_insert.html @@ -0,0 +1,14 @@ +{% load thumbnail %} + +{% with text=insert.choose %} + +{% endwith %} diff --git a/src/catalogue/templates/catalogue/book_text.html b/src/catalogue/templates/catalogue/book_text.html index 3953e6a9b..c0fe955dd 100644 --- a/src/catalogue/templates/catalogue/book_text.html +++ b/src/catalogue/templates/catalogue/book_text.html @@ -116,18 +116,7 @@ {% annoy_banners 'book-text-intermission' %} {% for insert in inserts %} - {% with text=insert.choose %} - - {% endwith %} + {% include 'annoy/dynamic_insert.html' %} {% endfor %}
{% endblock footer %}