Commit ed95c02b authored by efalcy's avatar efalcy
Browse files

dev #56107 : fix form submit

parent 4babae91
CKEDITOR.dialog.add( 'basketDialog', function ( editor ) {
return {
title: 'Basket Properties',
title: 'Bokeh Widget Properties',
minWidth: 400,
minHeight: 200,
contents: [
{
id: 'tab-adv',
label: 'Advanced Settings',
id: 'tab-adv',
label: 'Advanced Settings',
elements: [
{
onLoading: function () {
var htmlElement = this;
elements: [
{
type: 'html',
className: 'bokeh-widget-form',
html: '',
setupForm: function () {
var htmlElement = this;
$.ajax({
url: editor.config['perso_var'],
type: "POST",
data: this.getValue(),
datatype: 'json',
success: function (data) {
$('.mybasket').html(data['content']);
},
error: function (xhr, status) {
alert(status);
}
});
},
type: 'html',
className: 'mybasket',
html: '',
setup: function( element ) {
if (element) {
this.setValue( element.prevObject.attr( "data-form" ) );
this.element = element;
}
this.onLoading();
},
commit: function( element ) {
// if (this.element)
// this.element.removeAttribute('div');
}}
// UI elements of the second tab will be defined here.
]
$.ajax({
url: editor.config['perso_var'],
type: "POST",
data: this.getValue(),
datatype: 'json',
success: function (data) {
$('.bokeh-widget-form').html(data['content']);
},
error: function (xhr, status) {
alert(status);
}
});
},
setup: function( element ) {
this.setValue( element ? element.prevObject.attr( "data-form" ) : '');
this.setupForm();
},
}
// UI elements of the second tab will be defined here.
]
}
],
onShow: function() {
var selection = editor.getSelection();
var element = selection.getStartElement();
this.insertMode = true;
if ( $(element.$).hasClass('bokeh-widget') || $(element.$).closest('bokeh-widget').size ) {
element = $(element.$).closest( 'bokeh-widget' );
this.insertMode = false;
element = $(element.$).closest( 'bokeh-widget' );
this.insertMode = false;
}
this.element = element;
if (!this.insertMode)
return this.setupContent( this.element );
return this.setupContent( this.element );
this.setupContent(null);
},
onOk: function() {
var dialog = this;
var widget = editor.document.createElement( 'div' );
// widget.setText($('form input #titre').attr('value') );
var selection = editor.getSelection();
var widget = selection.getStartElement();
if (!widget) {
widget = editor.document.createElement( 'div' );
editor.insertElement( widget );
}
widget.setText('KIOSQUE');
$(widget)
.attr('data-form', $('.mybasket form').serialize())
.attr('class','bokeh-widget');
this.commitContent(widget);
//editor.document.remove(this.element);
editor.insertElement( widget );
$('.bokeh-widget-form form').triggerHandler('submit');
setTimeout(function() {
$(widget)
.attr('data-form', $('.bokeh-widget-form form').serialize())
.attr('class','bokeh-widget');
},10);
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment