Commit 35e8e4a7 authored by Romain Courteaud's avatar Romain Courteaud Committed by Sebastien Robin

Display tabs in form view.

parent 545d477a
......@@ -125,7 +125,7 @@
vimMode: true,\n
matchBrackets: true,\n
showCursorWhenSelecting: true,\n
autofocus: true,\n
autofocus: false,\n
});\n
\n
});\n
......
......@@ -113,18 +113,13 @@
<script src="renderjs.js" type="text/javascript"></script>\n
\n
<!-- custom script -->\n
<script src="gadget_global.js" type="text/javascript"></script>\n
<script src="gadget_erp5_form.js" type="text/javascript"></script>\n
\n
</head>\n
<body>\n
<!-- XXX action, method, fieldset -->\n
<form class="save_form">\n
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline\n
ui-icon-edit ui-btn-icon-right">Save</button>\n
<div class="field_container">\n
</div>\n
</form>\n
\n
<div class="field_container"></div>\n
\n
</body>\n
</html>
......
......@@ -173,7 +173,9 @@
// field_element.setAttribute(\'data-role\', \'fieldcontain\');\n
label_element.setAttribute(\'for\', renderered_field.key);\n
label_element.textContent = renderered_field.title;\n
field_element.appendChild(label_element);\n
if (group[0] !== "bottom") {\n
field_element.appendChild(label_element);\n
}\n
field_element.appendChild(gadget_element);\n
fieldset_element.appendChild(field_element);\n
\n
......@@ -232,15 +234,14 @@
})\n
\n
\n
.declareService(function () {\n
.declareMethod("getContent", function () {\n
var form_gadget = this;\n
\n
function formSubmit() {\n
var k,\n
field_gadget,\n
count = form_gadget.props.gadget_list.length,\n
// // data = new FormData(),\n
data = {"_id": form_gadget.props.id},\n
data = {},\n
queue = new RSVP.Queue();\n
\n
function extendData(field_data) {\n
......@@ -263,17 +264,9 @@
}\n
return queue\n
.push(function () {\n
return form_gadget.aq_put(data);//, {"_view": "XXX"});\n
return data;\n
});\n
}\n
\n
// Listen to form submit\n
return loopEventListener(\n
form_gadget.props.element.querySelector(\'form\'),\n
\'submit\',\n
false,\n
formSubmit\n
);\n
});\n
\n
}(window, rJS, RSVP, jQuery));
......
......@@ -127,35 +127,19 @@
{{/navigationlist}}\n
</ul>\n
</script>\n
\n
<script id="active-navigation-template" type="text/x-handlebars-template">\n
<li><a class="ui-btn-active ui-state-persist" href="{{link}}">{{title}}</a></li>\n
</script>\n
\n
<script id="navigation-template" type="text/x-handlebars-template">\n
<li><a href="{{link}}">{{title}}</a></li>\n
</script>\n
\n
</head>\n
<body>\n
\n
<div data-role="panel" id="leftpanel" data-display="overlay"></div>\n
<!--div data-role="panel" id="rightpanel" data-display="overlay"\n
data-position="right"></div-->\n
\n
<header data-role="header">\n
<a href="#leftpanel">Open panel</a>\n
<h1>ERP5</h1>\n
<!--form><input type="text" name="couscous"\n
value="couscous"></input><button type="submit">Search</button></form-->\n
<a href="#">Home</a>\n
<!--a href="#rightpanel">Open panel</a-->\n
</header>\n
\n
<article id="mainarticle"\n
data-gadget-url="gadget_erp5_form.html"\n
data-gadget-scope="form_gadget"\n
data-gadget-sandbox="public"></article>\n
<article></article>\n
\n
<section data-gadget-url="gadget_jio.html"\n
data-gadget-scope="jio_gadget"\n
......
......@@ -118,6 +118,11 @@
/////////////////////////////////////////////////////////////////\n
// ready\n
/////////////////////////////////////////////////////////////////\n
// Init local properties\n
.ready(function (g) {\n
g.props = {};\n
})\n
\n
// Configure jIO to use localstorage\n
// And load configuration from server\n
.ready(function (g) {\n
......@@ -188,24 +193,36 @@
// Hey, I want to display some URL\n
return this.aq_pleasePublishMyState({jio_key: param_list[0]});\n
})\n
.allowPublicAcquisition("whoWantToDisplayThisPage", function (param_list) {\n
// Hey, I want to display some URL\n
return this.aq_pleasePublishMyState({jio_key: this.props.jio_key, view: param_list[0].name});\n
})\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
// Render the page\n
.declareMethod(\'render\', function (options) {\n
var gadget = this;\n
var gadget = this,\n
sub_options;\n
\n
// $.mobile.loading(\'show\');\n
if (options.jio_key === undefined) {\n
// Redirect to the default view\n
return gadget.aq_pleasePublishMyState({jio_key: "person_module"})\n
return gadget.aq_pleasePublishMyState({jio_key: "web_page_module", view: "view"})\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
}\n
if (options.view === undefined) {\n
// Redirect to the default view\n
return gadget.aq_pleasePublishMyState({jio_key: options.jio_key, view: "view"})\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
}\n
return gadget.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
var jio_key = options.jio_key,\n
view = options.view || "view";\n
view = options.view;\n
\n
gadget.props.jio_key = jio_key;\n
///////////////////////////////////////////////\n
// Display erp5 document view\n
///////////////////////////////////////////////\n
......@@ -231,26 +248,40 @@
]);\n
})\n
.push(function (result) {\n
var sub_options = options.form_gadget || {};\n
sub_options = options.form_gadget || {};\n
sub_options.erp5_document = result[0].data;\n
sub_options.form_definition = result[1].data;\n
sub_options.view = options.view;\n
\n
return gadget.getDeclaredGadget("form_gadget")\n
.push(function (form_gadget) {\n
return form_gadget.render(sub_options);\n
});\n
})\n
.push(function () {\n
return gadget.getDeclaredGadget("form_gadget");\n
return gadget.declareGadget("gadget_erp5_pt_" + sub_options.form_definition.pt + ".html", {\n
scope: "form_gadget"\n
});\n
})\n
\n
.push(function (form_gadget) {\n
return form_gadget.getElement();\n
return RSVP.all([\n
form_gadget.render(sub_options),\n
form_gadget.getElement()\n
]);\n
})\n
// .push(function (element) {\n
// // XXX JQuery mobile\n
\n
.push(function (all_response) {\n
var page_element = all_response[1],\n
element = document.querySelector("article");\n
// XXX JQuery mobile\n
// // $.mobile.loading(\'hide\');\n
// // return $(element).trigger("create");\n
// })\n
\n
\n
// Append in the DOM at the end to reduce flickering and reduce DOM\n
// modifications\n
// Clear the previous rendering\n
while (element.firstChild) {\n
element.removeChild(element.firstChild);\n
}\n
element.appendChild(page_element);\n
\n
return $(element).trigger("create");\n
})\n
.push(undefined, function (error) {\n
console.error(error);\n
console.error(error.stack);\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_pt_form_list.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_pt_form_list_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>ERP5 PT Form List</title>\n
\n
<!-- renderjs -->\n
<script src="RSVP.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
\n
<!-- custom script -->\n
<script src="gadget_global.js" type="text/javascript"></script>\n
<script src="gadget_erp5_pt_form_list.js" type="text/javascript"></script>\n
\n
</head>\n
<body>\n
\n
<div data-gadget-url="gadget_erp5_form.html"\n
data-gadget-scope="erp5_form"\n
data-gadget-sandbox="public">\n
\n
</body>\n
</html>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget ERP5 Form List</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_pt_form_list.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_pt_form_list_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>/*global rJS, RSVP, jQuery, Handlebars,\n
promiseEventListener, console */\n
/*jslint nomen: true */\n
/*global window, rJS, RSVP, StatelessJS, alert, FormData, document, console */\n
/*jslint maxlen:200, nomen: true */\n
(function (window, rJS, RSVP, $) {\n
"use strict";\n
\n
rJS(window)\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
.declareMethod(\'render\', function (options) {\n
\n
return this.getDeclaredGadget("erp5_form")\n
.push(function (erp5_form) {\n
return erp5_form.render(options);\n
});\n
\n
});\n
\n
}(window, rJS, RSVP, jQuery));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget ERP5 Form List JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_pt_form_view.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_pt_form_view_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>ERP5 PT Form View</title>\n
\n
<!-- renderjs -->\n
<script src="RSVP.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
\n
<!-- custom script -->\n
<script src="gadget_global.js" type="text/javascript"></script>\n
<script src="gadget_erp5_pt_form_view.js" type="text/javascript"></script>\n
\n
</head>\n
<body>\n
<div data-gadget-url="gadget_erp5_tab_list.html"\n
data-gadget-scope="erp5_tab"\n
data-gadget-sandbox="public">\n
</div>\n
<!-- XXX action, method, fieldset -->\n
<form class="save_form">\n
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline\n
ui-icon-edit ui-btn-icon-right">Save</button>\n
<div data-gadget-url="gadget_erp5_form.html"\n
data-gadget-scope="erp5_form"\n
data-gadget-sandbox="public">\n
</div>\n
</form>\n
</body>\n
</html>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget ERP5 Form View</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>