Banner colors.
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 10 Jun 2021 12:46:53 +0000 (14:46 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 10 Jun 2021 12:46:53 +0000 (14:46 +0200)
src/annoy/admin.py
src/annoy/migrations/0011_auto_20210610_1437.py [new file with mode: 0644]
src/annoy/models.py
src/annoy/templates/annoy/banner.html

index 24e977e..8255e96 100644 (file)
@@ -5,7 +5,11 @@ from . import models
 
 
 class BannerAdmin(TranslationAdmin):
 
 
 class BannerAdmin(TranslationAdmin):
-    list_display = ['place', 'text', 'priority', 'since', 'until', 'show_members', 'staff_preview']
+    list_display = [
+            'place', 'text',
+            'text_color', 'background_color',
+            'priority', 'since', 'until',
+            'show_members', 'staff_preview']
 
 
 admin.site.register(models.Banner, BannerAdmin)
 
 
 admin.site.register(models.Banner, BannerAdmin)
diff --git a/src/annoy/migrations/0011_auto_20210610_1437.py b/src/annoy/migrations/0011_auto_20210610_1437.py
new file mode 100644 (file)
index 0000000..f51d3d8
--- /dev/null
@@ -0,0 +1,23 @@
+# Generated by Django 2.2.19 on 2021-06-10 12:37
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('annoy', '0010_auto_20210430_1331'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='banner',
+            name='background_color',
+            field=models.CharField(blank=True, max_length=10),
+        ),
+        migrations.AddField(
+            model_name='banner',
+            name='text_color',
+            field=models.CharField(blank=True, max_length=10),
+        ),
+    ]
index fe5f8fa..55bb2ac 100644 (file)
@@ -15,6 +15,8 @@ class Banner(models.Model):
         help_text=_('Affects blackout.')
     )
     smallfont = models.BooleanField(_('small font'), default=False)
         help_text=_('Affects blackout.')
     )
     smallfont = models.BooleanField(_('small font'), default=False)
+    text_color = models.CharField(max_length=10, blank=True)
+    background_color = models.CharField(max_length=10, blank=True)
     action_label = models.CharField(
         _('action label'),
         max_length=255, blank=True,
     action_label = models.CharField(
         _('action label'),
         max_length=255, blank=True,
index 97f10c1..4b2bdcf 100644 (file)
               annoy-banner-style_{{ banner.style }}
               {% if banner.image %}with-image{% endif %}
               {% if banner.smallfont %}banner-smallfont{% endif %}
               annoy-banner-style_{{ banner.style }}
               {% if banner.image %}with-image{% endif %}
               {% if banner.smallfont %}banner-smallfont{% endif %}
-              " id="annoy-banner-{{ banner.id }}">
+              "
+        id="annoy-banner-{{ banner.id }}"
+       style="
+           {% if banner.text_color %}color: {{ banner.text_color }};{% endif %}
+           {% if banner.background_color %}background-color: {{ banner.background_color }};{% endif %}
+        ">
     {% if not banner.action_label %}
       <a href="{{ banner.url }}">
     {% endif %}
     {% if not banner.action_label %}
       <a href="{{ banner.url }}">
     {% endif %}