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):
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"
"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
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"
--- /dev/null
+# 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/'),
+ ),
+ ]
--- /dev/null
+# 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),
+ ),
+ ]
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,
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/')
.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 {
}
&.action {
- bottom: 33vh;
+ bottom: 40vh;
background: #018189;
color: white;
border-radius: auto 100%;
}
@media screen and (max-height: 400px) {
a.action {
- bottom: 30vh;
+ bottom: 40vh;
}
}
-.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;
}
}
}
-.dynamic-insert, .intermission {
- margin: 2em 0;
- padding: 2em;
- background: orange;
-
- a {
- display: block;
- color: black;
- }
-}
-
-
#annoy-stubs {
display: none;
}
{{ banner.open_label }}
</a>
{% endif %}
- <div class="annoy-banner annoy-banner_{{ banner.place }}" id="annoy-banner-{{ banner.id }}">
+ <div class="annoy-banner annoy-banner_{{ banner.place }}{% if banner.image %} with-image{% endif %}" id="annoy-banner-{{ banner.id }}">
+ {% if not banner.action_label %}
+ <a href="{{ banner.url }}">
+ {% endif %}
<div class="annoy-banner-inner">
- {% if banner.action_label %}
+
+ {% if banner.image %}
+ <img src="{{ banner.image.url }}">
+ {% endif %}
+ <div class="text">
{{ banner.text|safe|linebreaks }}
+ </div>
+
+ {% if banner.action_label %}
<a class="action" href="{{ banner.url }}">
{{ banner.action_label }}
</a>
- {% else %}
- <a href="{{ banner.url }}">
- {{ banner.text|safe|linebreaks }}
- </a>
- {% endif %}
- {% if closable %}
- <a class='annoy-banner-off annoy-banner-off_{{ banner.place }}'>{{ banner.close_label|default:"x" }}</a>
{% endif %}
</div>
+ {% if not banner.action_label %}
+ </a>
+ {% endif %}
+ {% if closable %}
+ <a class='annoy-banner-off annoy-banner-off_{{ banner.place }}'>{{ banner.close_label|default:"x" }}</a>
+ {% endif %}
</div>
{% endif %}
--- /dev/null
+{% load thumbnail %}
+
+{% with text=insert.choose %}
+ <div class="dynamic-insert{% if text.image %} with-image{% endif %}" style="{% if text.own_colors %}background-color: {{ text.background_color }};{% endif %}" data-paragraphs="{{ insert.paragraphs }}">
+ <a href="{% url 'club' %}">
+ <div class="text" style="{% if text.own_colors %}color:{{ text.text_color }}{% endif %}">
+ {{ text.text|safe|linebreaks }}
+ </div>
+ {% if text.image %}
+ <img src="{% thumbnail text.image '120x120' as thumb %}{{ thumb.url }}{% empty %}{{ text.image.url }}{% endthumbnail %}">
+ {% endif %}
+ </a>
+ </div>
+{% endwith %}
{% annoy_banners 'book-text-intermission' %}
{% for insert in inserts %}
- {% with text=insert.choose %}
- <div class="dynamic-insert{% if text.image %} with-image{% endif %}" style="{% if text.background_color %}background-color: {{ text.background_color }};{% endif %}" data-paragraphs="{{ insert.paragraphs }}">
- <a href="{% url 'club' %}">
- <div class="text" style="{% if text.text_color %}color:{{ text.text_color }}{% endif %}">
- {{ text.text|safe|linebreaks }}
- </div>
- {% if text.image %}
- <img src="{% thumbnail text.image '120x120' as thumb %}{{ thumb.url }}{% empty %}{{ text.image.url }}{% endthumbnail %}">
- {% endif %}
- </a>
- </div>
- {% endwith %}
+ {% include 'annoy/dynamic_insert.html' %}
{% endfor %}
</div>
{% endblock footer %}