momo: make it possible to specify an extra CSS file
This commit is contained in:
parent
289632669c
commit
1f0d7e42eb
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('momo', '0005_momoiconcell_embed_page'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='momooptions',
|
||||
name='extra_css',
|
||||
field=models.CharField(max_length=100, null=True, verbose_name='Extra CSS', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -31,6 +31,7 @@ class MomoOptions(models.Model):
|
|||
default=86400, null=True)
|
||||
icons_on_homepage = models.BooleanField(
|
||||
_('Use icons on the homepage'), default=False)
|
||||
extra_css = models.CharField(_('Extra CSS'), max_length=100, blank=True, null=True)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.id = 1
|
||||
|
|
|
@ -146,8 +146,12 @@ def generate(request, **kwargs):
|
|||
'updateFreq': options.update_freq or 86400,
|
||||
'manifestUrl': request.build_absolute_uri(default_storage.url('index.json')),
|
||||
'assetsUrl': request.build_absolute_uri(default_storage.url('assets.zip')),
|
||||
'stylesheets': ["assets/index.css"],
|
||||
}
|
||||
|
||||
if options.extra_css:
|
||||
manifest['meta']['stylesheets'].append('assets/%s' % options.extra_css)
|
||||
|
||||
if options.icons_on_homepage:
|
||||
manifest['display'] = 'icons'
|
||||
|
||||
|
|
Loading…
Reference in New Issue