Permalink
Browse files

- Add responsive option to portlet to be able to unactivate for some …

…URLs like soundcloud which are already responsive.
  • Loading branch information...
1 parent 65e5e31 commit a4d848d0421a768858e972104c52ae950785bb66 @toutpt toutpt committed Jan 2, 2013
Showing with 20 additions and 3 deletions.
  1. +6 −1 collective/portlet/oembed/jsoembed.pt
  2. +13 −1 collective/portlet/oembed/portlet.py
  3. +1 −1 docs/HISTORY.txt
@@ -1 +1,6 @@
-<a class="oembed oembed-responsive" tal:attributes="href view/data/remote_url; data-maxwidth view/data/maxwidth; data-maxheight view/data/maxheight" tal:content="view/data/header"></a>
+<a class="oembed oembed-responsive"
+ tal:attributes="href view/data/remote_url;
+ data-maxwidth view/data/maxwidth;
+ data-maxheight view/data/maxheight;
+ class python:view.is_responsive() and 'oembed oembed-responsive' or 'oembed'"
+ tal:content="view/data/header"></a>
@@ -38,6 +38,13 @@ class IOEmbedPortlet(IPortletDataProvider):
description=_(u"The height will be added to the oembed request"),
required=False)
+ responsive = schema.Bool(
+ title=_(u"Responsive"),
+ description=_(u"If the response is an iframe the code will be updated \
+ to become responsive. In some case this can broke the returned code.\
+ In that case you can unactivate it by uncheck this option."),
+ default=True)
+
omit_border = schema.Bool(
title=_(u"Omit portlet border"),
description=_(u"Tick this box if you want to render the text above "
@@ -64,19 +71,21 @@ class Assignment(base.Assignment):
remote_url = ""
maxwidth = None
maxheight = None
+ responsive = True
omit_border = False
footer = u""
more_url = ''
def __init__(self, header=u"", remote_url=None, maxwidth=None,
maxheight=None, omit_border=False, footer=u"",
- more_url=''):
+ more_url='', responsive=True):
self.header = header
self.omit_border = omit_border
self.footer = footer
self.more_url = more_url
self.maxheight = maxheight
self.maxwidth = maxwidth
+ self.responsive = responsive
self.remote_url = remote_url
@property
@@ -134,6 +143,9 @@ def has_link(self):
def has_footer(self):
return bool(self.data.footer)
+ def is_responsive(self):
+ return self.data.responsive
+
class AddForm(base.AddForm):
"""add form"""
View
@@ -4,7 +4,7 @@ Changelog
1.3 (unreleased)
----------------
-- Nothing changed yet.
+- Add responsive option to portlet to be able to unactivate for some URLs like soundcloud which are already responsive.
1.2 (2013-01-02)

0 comments on commit a4d848d

Please sign in to comment.