From 1d33cc7838c647c95f4c228b35500851cbd5e6d9 Mon Sep 17 00:00:00 2001 From: Gagaro Date: Sat, 8 Oct 2016 09:28:30 +0200 Subject: [PATCH] Fix: remove responsive behavior in embed when there is no ratio available --- CHANGELOG.txt | 1 + docs/releases/1.8.rst | 1 + wagtail/wagtailembeds/format.py | 2 +- .../wagtailembeds/templates/wagtailembeds/embed_frontend.html | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2b063a4d1..d97d307bb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -9,6 +9,7 @@ Changelog * Added `Page.get_admin_display_title` method to override how the title is displayed in the admin (Henk-Jan van Hasselaar) * Fix: `AbstractForm` now respects custom `get_template` methods on the page model (Gagaro) * Fix: Use specific page model for the parent page in the explore index (Gagaro) + * Fix: Remove responsive styles in embed when there is no ratio available (Gagaro) 1.7 (xx.xx.xxxx) - IN DEVELOPMENT diff --git a/docs/releases/1.8.rst b/docs/releases/1.8.rst index 3f68f5bb4..169806b15 100644 --- a/docs/releases/1.8.rst +++ b/docs/releases/1.8.rst @@ -24,6 +24,7 @@ Bug fixes * ``AbstractForm`` now respects custom ``get_template`` methods on the page model (Gagaro) * Use specific page model for the parent page in the explore index (Gagaro) + * Remove responsive styles in embed when there is no ratio available (Gagaro) Upgrade considerations diff --git a/wagtail/wagtailembeds/format.py b/wagtail/wagtailembeds/format.py index 2d950af74..89470f4d0 100644 --- a/wagtail/wagtailembeds/format.py +++ b/wagtail/wagtailembeds/format.py @@ -15,7 +15,7 @@ def embed_to_frontend_html(url): if embed.width and embed.height: ratio = str(embed.height / embed.width * 100) + "%" else: - ratio = "0" + ratio = None # Render template return render_to_string('wagtailembeds/embed_frontend.html', { diff --git a/wagtail/wagtailembeds/templates/wagtailembeds/embed_frontend.html b/wagtail/wagtailembeds/templates/wagtailembeds/embed_frontend.html index b97dceb83..6976fe97c 100644 --- a/wagtail/wagtailembeds/templates/wagtailembeds/embed_frontend.html +++ b/wagtail/wagtailembeds/templates/wagtailembeds/embed_frontend.html @@ -1,3 +1,3 @@ -
+ {{ embed.html|safe }}