Open source cms for mobile and desktop websites

Element plugin example: Json configuration

pure json configuration example for a page element including new object type, data model, form definition and template

Scaffold download:

The module has to be in the current python path to be added to your website.



The file configuration.json defines everything needed to set up the element.

    "type": "nive.definitions.ObjectConf",
    "id": "article",
    "name": "Article",
    "dbparam": "article",
    "context": "nive_cms.baseobjects.PageElementBase",
    "template": "",
    "selectTag": 20,
    "description": "",

   "data": [
       { "type": "nive.FieldConf",
         "id": "textblock", "datatype": "htext", "size": 10000,
         "default": "", "fulltext": 1, "name": "Text", "description": ""},
       { "type": "nive.FieldConf",
         "id": "image", "datatype": "file", "size": 0,
         "default": "", "name": "Imagefile", "description": ""},
       { "type": "nive.FieldConf",
         "id": "link", "datatype": "url", "size": 255,
         "default": "", "name": "Link", "description": ""}

   "forms": {"create": {"fields": ["title", "textblock", "image"]},
             "edit":   {"fields": ["title", "textblock", "image"]}}

The page template is used to render the contents on the web page.

<div class="pageelement peArticle" id="nive-element${context.GetID()}"
     tal:define="link view.ResolveLink(">

<div class="teaser">
<img tal:condition="context.files.get('image')"
          tal:attributes="src view.FileUrl('image', context);
                          title context.GetTitle()" />
<div class="itext">
<h3 tal:content="structure context.GetTitle()"/>
<p tal:condition=""
<a tal:condition="link" tal:attributes="href link">&gt; more</a>

© 2013 Nive GmbH