Hi,
I try to use mako as template, but there is a conflict with context :
NameConflictError: Reserved words passed to render(): context
I found a workaround in pyramid_mako to change request by nive_request but don't know if it's the good way...
To use mako i did a little element :
from nive.definitions import FieldConf, ObjectConf
configuration = ObjectConf(
id="panel",
name="Panel",
dbparam="panel",
context="nive.components.objects.base.PageElementBase",
template="panel:panel.mako",
selectTag=20,
description=""
)
configuration.data = [
FieldConf(id="panel_class", datatype="radio", size=10000, default='primary',
name="Type", listItems=[{'id':'primary', 'name':"Primary"},
{'id':'success', 'name':"Success"},
{'id':'info', 'name':"Info"},
{'id':'warning', 'name':"Warning"},
{'id':'danger', 'name':"Danger"}]),
FieldConf(id="textblock", datatype="htext", size=10000, default="",
name="Text", fulltext=1),
]
configuration.forms = {
"create": {"fields": ["title", "panel_class", "textblock"]},
"edit": {"fields": ["title", "panel_class", "textblock"]}
}
panel.mako
<div class="pageelement panel panel-${nive_context.data.panel_class}" id="nive-element${nive_context.GetID()}">
<div class="panel-heading">
<span>${nive_context.GetTitle()}</span>
</div>
<div class="panel-body">
<p>${nive_context.data.textblock|n}</p>
</div>
</div>