KristianOellegaard / cmsplugin-text-ng

Other
14 stars 8 forks source link

template storage... #5

Open ojii opened 12 years ago

ojii commented 12 years ago

It would make a lot of sense to have the templates defined in a setting, not in the database:

beniwohli commented 12 years ago

The one reason we did use the db approach was to have categories -- which we are not using ATM anyway. I'd be OK with this change.

ojii commented 12 years ago

categories could still be done using nested dicts

beniwohli commented 12 years ago

they wouldn't even have to be nested, just one level, e.g.

TEXT_NG_TEMPLATES = {
    'Images': (
        ('text_ng/image_large.html', 'Large Image'),
        ('text_ng/image_small.html', 'Small Image'),
    ),
    'Textblocks': (
        ('text_ng/text_left.html', 'Text (left)'),
        ('text_ng/text_right.html', 'Text (right)'),
    ),
}

/edit: on a second thought, this is actually a nested dict in disguise :)

ojii commented 12 years ago

yea either use dicts there or at the very least a list for the outer things.

gw0 commented 12 years ago

To remove unnecessary file parsing all additional fields (now defined in the template) could also be in the settings. Eg.:

TEXT_NG_TEMPLATES = {
    'FunnySections': (
        ('text_ng/funnysection_left.html', 'Text (left)', {'body':'htmltext', 'h2_content':'text', 'icon':'filer_image'}),
        ('text_ng/funnysection_right.html', 'Text (right)', {'body':'htmltext'),
    ),
}