[gen] Integrated ckeditor inline editing via boolean parameter field.inlineEdit.

This commit is contained in:
Gaetan Delannay 2013-03-29 14:50:12 +01:00
parent 48c7c50122
commit 4e09a40807
6 changed files with 65 additions and 8 deletions

View file

@ -90,7 +90,7 @@
<tal:comment replace="nothing">Call the previous macro, but from Ajax.</tal:comment>
<metal:afield define-macro="fieldAjax"
tal:define="widgetName request/fieldName;
layoutType request/layoutType;
layoutType python: request.get('layoutType', 'view');
showChanges python: request.get('showChanges', 'False') == 'True';
widget python: contextObj.getAppyType(widgetName, asDict=True);
page widget/pageName">

View file

@ -1,6 +1,7 @@
<tal:comment replace="nothing">View macro for a String.</tal:comment>
<metal:view define-macro="view"
tal:define="fmt widget/format; isUrl widget/isUrl">
tal:define="fmt widget/format; isUrl widget/isUrl;
mayAjaxEdit python: not showChanges and widget['inlineEdit'] and contextObj.mayEdit(widget['writePermission'])">
<span tal:condition="python: fmt in (0, 3)">
<ul tal:condition="python: value and isMultiple">
<li tal:repeat="sv value"><i tal:content="structure sv"></i></li>
@ -20,9 +21,16 @@
<span tal:condition="python: value and (fmt == 1)"
tal:replace="structure python: contextObj.formatText(value, format='html')"/>
<tal:comment replace="nothing">XHTML text</tal:comment>
<div tal:condition="python: value and (fmt == 2)" class="xhtml">
<span tal:replace="structure value"/>
</div>
<tal:xhtml condition="python: value and (fmt == 2)">
<div tal:condition="not: mayAjaxEdit" class="xhtml" tal:content="structure value"></div>
<div tal:condition="mayAjaxEdit" class="xhtml" contenteditable="true"
tal:attributes="id python: '%s_%s_ck' % (contextObj.UID(), name)"
tal:content="structure value">
</div>
<script tal:condition="mayAjaxEdit"
tal:content="python: contextObj.getEditorInlineInit(name)">
</script>
</tal:xhtml>
<input type="hidden" tal:condition="masterCss"
tal:attributes="class masterCss; value rawValue; name name; id name"/>
</metal:view>