Commit fccdd0f3 authored by Sebastien Robin's avatar Sebastien Robin

allow to give something else than a form, this surely break compatibilty

parent 54e421ba
...@@ -110,20 +110,27 @@ var TabbularGadget = { ...@@ -110,20 +110,27 @@ var TabbularGadget = {
visible_dom.removeClass("not_selected"); visible_dom.removeClass("not_selected");
}, },
addNewTabGadget: function(form_id, dom_id, gadget_data_handler) { addNewTabGadget: function(gadget_url, dom_id, gadget_data_handler) {
// add new gadget and render it // add new gadget and render it
var html_string; var html_string;
var html_string_array;
tab_container=$('#'+dom_id); tab_container=$('#'+dom_id);
tab_container.empty(); tab_container.empty();
// XXX: allow add any gadget,gadget:source items within API // XXX: allow add any gadget,gadget:source items within API
html_string =['<div class="gadget" ', html_string_array = ['<div class="gadget" ',
'gadget="' + form_id + '/Form_asRenderJSGadget" ', 'gadget="' + gadget_url + '"']
'gadget:data-handler="' + gadget_data_handler + '" ', if (gadget_data_handler !== undefined) {
'gadget:data-source="Form_asJSON?form_id=' + form_id + '"></div>'].join('\n'); html_string_array.push('gadget:data-handler="' + gadget_data_handler + '" ');
html_string_array.push('gadget:data-source="Form_asJSON?form_id=' + form_id + '">');
}
html_string_array.push('</div>')
html_string = html_string_array.join('\n');
tab_container.append(html_string); tab_container.append(html_string);
tab_gadget = tab_container.find(".gadget"); tab_gadget = tab_container.find(".gadget");
Form.setCurrentFormId(form_id);
//The above line sounds not generic enough
//Form.setCurrentFormId(form_id);
// render new gadget // render new gadget
is_ready = false; is_ready = false;
......
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