momo: possibility to add style for a page (#10718)
This commit is contained in:
parent
6e40bbdf0d
commit
ce2c831f50
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('momo', '0007_momoiconcell_restricted_to_unlogged'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='momoiconcell',
|
||||
name='style',
|
||||
field=models.CharField(default=b'', max_length=128, verbose_name='Style', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -69,6 +69,7 @@ class MomoIconCell(CellBase):
|
|||
('fa-road', _('Road')),
|
||||
])
|
||||
description = RichTextField(_('Description'), blank=True, null=True)
|
||||
style = models.CharField(_('Style'), max_length=128, default='', blank=True)
|
||||
embed_page = models.BooleanField(_('Embed redirection URL'), default=False)
|
||||
|
||||
class Meta:
|
||||
|
@ -85,5 +86,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', 'embed_page'],
|
||||
fields=['icon', 'style', 'description', 'embed_page'],
|
||||
widgets={'icon': Select(choices=sorted_icons)})
|
||||
|
|
|
@ -90,6 +90,7 @@ def get_page_dict(request, page, manifest):
|
|||
|
||||
if icon_cells:
|
||||
page_dict['icon'] = icon_cells[0].icon
|
||||
page_dict['style'] = icon_cells[0].style
|
||||
page_dict['description'] = icon_cells[0].description
|
||||
if page_dict.get('external') and icon_cells[0].embed_page:
|
||||
page_dict['external'] = False
|
||||
|
|
Loading…
Reference in New Issue