momo: add a meta to get redirect URL embedded as an iframe
This commit is contained in:
parent
1a14aa53e2
commit
bebbee9069
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('momo', '0004_momoiconcell_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='momoiconcell',
|
||||
name='embed_page',
|
||||
field=models.BooleanField(default=False, verbose_name='Embed redirection URL'),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -69,6 +69,7 @@ class MomoIconCell(CellBase):
|
|||
('fa-road', _('Road')),
|
||||
])
|
||||
description = RichTextField(_('Description'), blank=True, null=True)
|
||||
embed_page = models.BooleanField(_('Embed redirection URL'), default=False)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Meta for mobile')
|
||||
|
@ -84,5 +85,5 @@ class MomoIconCell(CellBase):
|
|||
sorted_icons = self._meta.get_field('icon').choices
|
||||
sorted_icons.sort(lambda x, y: cmp(x[1], y[1]))
|
||||
return model_forms.modelform_factory(self.__class__,
|
||||
fields=['icon', 'description'],
|
||||
fields=['icon', 'description', 'embed_page'],
|
||||
widgets={'icon': Select(choices=sorted_icons)})
|
||||
|
|
|
@ -76,14 +76,17 @@ def get_page_dict(request, page, manifest):
|
|||
'url': cell.url,
|
||||
'id': 'seealso-%s' % cell.id})
|
||||
|
||||
if icon_cells:
|
||||
page_dict['icon'] = icon_cells[0].icon
|
||||
page_dict['description'] = icon_cells[0].description
|
||||
|
||||
if page.redirect_url:
|
||||
page_dict['external'] = True
|
||||
page_dict['url'] = page.redirect_url
|
||||
|
||||
if icon_cells:
|
||||
page_dict['icon'] = icon_cells[0].icon
|
||||
page_dict['description'] = icon_cells[0].description
|
||||
if page_dict.get('external') and icon_cells[0].embed_page:
|
||||
page_dict['external'] = False
|
||||
|
||||
|
||||
if hasattr(page, '_children') and page._children:
|
||||
children = page._children
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue