From dfe47e43a213081bf50b1a0001a274a96077d626 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 23 Mar 2018 04:36:40 +0530 Subject: [PATCH] lineheight fix and line break filter --- datacenterlight/cms_models.py | 2 +- .../static/datacenterlight/css/landing-page.css | 1 + .../templates/datacenterlight/cms/section_promo.html | 4 +++- datacenterlight/templatetags/custom_tags.py | 12 +++++++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/datacenterlight/cms_models.py b/datacenterlight/cms_models.py index d5ec180c..8c9ae740 100644 --- a/datacenterlight/cms_models.py +++ b/datacenterlight/cms_models.py @@ -1,7 +1,7 @@ -from djangocms_text_ckeditor.fields import HTMLField from cms.models.pluginmodel import CMSPlugin from django.db import models from django.utils.safestring import mark_safe +from djangocms_text_ckeditor.fields import HTMLField from filer.fields.image import FilerImageField # Models for CMS Plugins diff --git a/datacenterlight/static/datacenterlight/css/landing-page.css b/datacenterlight/static/datacenterlight/css/landing-page.css index eb3dca07..2e1f36e7 100755 --- a/datacenterlight/static/datacenterlight/css/landing-page.css +++ b/datacenterlight/static/datacenterlight/css/landing-page.css @@ -1298,6 +1298,7 @@ footer .dcl-link-separator::before { .promo-section p { font-size: 18px; + line-height: 1.5; } .promo-section.text-center p { diff --git a/datacenterlight/templates/datacenterlight/cms/section_promo.html b/datacenterlight/templates/datacenterlight/cms/section_promo.html index 7a4ad455..c3301225 100644 --- a/datacenterlight/templates/datacenterlight/cms/section_promo.html +++ b/datacenterlight/templates/datacenterlight/cms/section_promo.html @@ -1,7 +1,9 @@ +{% load custom_tags %} +
{% if instance.heading %} -

{{instance.heading}}

+

{{instance.heading|escaped_line_break|linebreaksbr}}

{% endif %} {% if instance.subheading %}

{{instance.subheading}}

diff --git a/datacenterlight/templatetags/custom_tags.py b/datacenterlight/templatetags/custom_tags.py index 908b1f89..a2b20bcb 100644 --- a/datacenterlight/templatetags/custom_tags.py +++ b/datacenterlight/templatetags/custom_tags.py @@ -41,4 +41,14 @@ def multiply(value, arg): :param arg: :return: """ - return value*arg + return value * arg + + +@register.filter('escaped_line_break') +def escaped_line_break(value): + """ + usage: {{ text|escaped_line_break }} + :param value: + :return: + """ + return value.replace("\\n", "\n")