Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2479] Convert warning banner field to CKEditor RichtextField #1213

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<div class="warning-header">
<div class="warning-header__container">
<span class="warning-header__icon">{% icon icon="error_outlined" outlined=True %}</span>
<span class="warning-header__text">{{ warning_banner_text }}</span>
<span class="warning-header__text">{{ warning_banner_text|safe }}</span>
</div>
</div>
5 changes: 4 additions & 1 deletion src/open_inwoner/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,14 +901,17 @@
MAIL_EDITOR_BASE_HOST = BASE_URL

CKEDITOR_CONFIGS = {
"default": {
"allowedContent": True,
},
"mail_editor": {
"allowedContent": True,
"contentsCss": [
"/static/mailcss/email.css"
], # Enter the css file used to style the email.
"height": 600, # This is optional
"entities": False, # This is added because CKEDITOR escapes the ' when you do an if statement
}
},
}

#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.11 on 2024-05-15 14:44

from django.db import migrations

import ckeditor.fields


class Migration(migrations.Migration):

dependencies = [
("configurations", "0066_merge_20240405_1100"),
]

operations = [
migrations.AlterField(
model_name="siteconfiguration",
name="warning_banner_text",
field=ckeditor.fields.RichTextField(
blank=True,
help_text="Text will be displayed on the warning banner",
verbose_name="Warning banner text",
),
),
]
3 changes: 2 additions & 1 deletion src/open_inwoner/configurations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.dispatch import receiver
from django.utils.translation import gettext_lazy as _

import ckeditor.fields as ckeditor_fields
from colorfield.fields import ColorField
from django_jsonform.models.fields import ArrayField
from filer.fields.image import FilerImageField
Expand Down Expand Up @@ -68,7 +69,7 @@ class SiteConfiguration(SingletonModel):
default=False,
help_text=_("Whether the warning banner should be displayed"),
)
warning_banner_text = models.TextField(
warning_banner_text = ckeditor_fields.RichTextField(
verbose_name=_("Warning banner text"),
blank=True,
help_text=_("Text will be displayed on the warning banner"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@
max-width: var(--spacing-giant);
}
}

// override paragraph styling from CKEditor
p {
margin: 0;
padding: 0;
}
}
Loading