You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
4.0 KiB
111 lines
4.0 KiB
7 years ago
|
<form
|
||
|
tal:define="style style|field.widget.style;
|
||
|
css_class css_class|string:${field.widget.css_class or field.css_class or ''};
|
||
|
item_template item_template|field.widget.item_template;
|
||
|
autocomplete autocomplete|field.autocomplete;
|
||
|
title title|field.title;
|
||
|
errormsg errormsg|field.errormsg;
|
||
|
description description|field.description;
|
||
|
buttons buttons|field.buttons;
|
||
|
use_ajax use_ajax|field.use_ajax;
|
||
|
ajax_options ajax_options|field.ajax_options;
|
||
|
formid formid|field.formid;
|
||
|
action action|field.action or None;
|
||
|
method method|field.method;
|
||
|
col_label col_label|field.col_label;
|
||
|
col_input col_input|field.col_input;
|
||
|
was_validated True if field.get_root().error else False;"
|
||
|
|
||
|
tal:attributes="autocomplete autocomplete;
|
||
|
style style;
|
||
|
class css_class;
|
||
|
action action;"
|
||
|
id="${formid}"
|
||
|
method="${method}"
|
||
|
enctype="multipart/form-data"
|
||
|
accept-charset="utf-8"
|
||
|
i18n:domain="deform"
|
||
|
>
|
||
|
|
||
|
<fieldset class="deform-form-fieldset">
|
||
|
|
||
|
<legend tal:condition="title">${title}}</legend>
|
||
|
|
||
|
<input type="hidden" name="_charset_" />
|
||
|
<input type="hidden" name="__formid__" value="${formid}"/>
|
||
|
|
||
|
<p class="section first" tal:condition="description">
|
||
|
${description}
|
||
|
</p>
|
||
|
|
||
|
<div tal:repeat="child field"
|
||
|
tal:replace="structure child.render_template(item_template)"/>
|
||
|
|
||
|
<div class="form-row deform-form-buttons">
|
||
|
<div class="col-${col_label}"></div>
|
||
|
<div class="form-group col-{$col_input} mt-4">
|
||
|
<tal:loop tal:repeat="button buttons">
|
||
|
<button
|
||
|
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';"
|
||
|
tal:attributes="disabled button.disabled if button.disabled else None"
|
||
|
id="${formid+button.name}"
|
||
|
name="${button.name}"
|
||
|
type="${button.type}"
|
||
|
class="btn ${button.css_class or btn_disposition}"
|
||
|
value="${button.value}"
|
||
|
tal:condition="button.type != 'link'">
|
||
|
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
|
||
|
${button.title}
|
||
|
</button>
|
||
|
<a
|
||
|
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';
|
||
|
btn_href button.value|''"
|
||
|
class="btn ${button.css_class or btn_disposition}"
|
||
|
id="${field.formid + button.name}"
|
||
|
href="${btn_href}"
|
||
|
tal:condition="button.type == 'link'">
|
||
|
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
|
||
|
${button.title}
|
||
|
</a>
|
||
|
</tal:loop>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</fieldset>
|
||
|
|
||
|
<script type="text/javascript" tal:condition="use_ajax">
|
||
|
$(function() {
|
||
|
// jquery handler for .ready() called
|
||
|
|
||
|
deform.addCallback(
|
||
|
'${formid}',
|
||
|
function(oid) {
|
||
|
var target = '#' + oid;
|
||
|
var options = {
|
||
|
target: target,
|
||
|
replaceTarget: true,
|
||
|
success: function() {
|
||
|
deform.processCallbacks();
|
||
|
deform.focusFirstInput(target);
|
||
|
},
|
||
|
beforeSerialize: function() {
|
||
|
// See http://bit.ly/1agBs9Z (hack to fix tinymce-related ajax bug)
|
||
|
if ('tinymce' in window) {
|
||
|
$(tinymce.get()).each(
|
||
|
function(i, el) {
|
||
|
var content = el.getContent();
|
||
|
var editor_input = document.getElementById(el.id);
|
||
|
editor_input.value = content;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
var extra_options = ${ajax_options} || {};
|
||
|
$('#' + oid).ajaxForm($.extend(options, extra_options));
|
||
|
}
|
||
|
);
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
</form>
|