Commit 6bc93576 authored by Boris Kocherov's avatar Boris Kocherov

button replace icon

parent cbf9ccf6
......@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ERP5</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="gadget_erp5_nojqm.css">
<link href="gadget_erp5_page_slap_parameter_form.css" rel="stylesheet" type="text/css"/>
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
......@@ -12,9 +13,11 @@
<script src="gadget_json_generated_form.js" type="text/javascript"></script>
</head>
<body>
<div data-json-path="/">
</div>
<div class="loadschema"
data-gadget-url="gadget_erp5_page_slap_load_schema.html"
data-gadget-scope="loadschema" >
data-gadget-scope="loadschema">
</div>
</body>
</html>
\ No newline at end of file
......@@ -69,10 +69,11 @@
div_input.setAttribute("class", "input");
input = document.createElement("button");
input.setAttribute("class", "add-sub-form");
input.setAttribute("class",
"ui-shadow-inset ui-btn ui-btn-inline ui-corner-all" +
" ui-btn-icon-notext ui-icon-btn ui-icon-plus ui-input-btn");
input.type = "button";
input.name = path;
input.textContent = "Add";
gadget.props.add_buttons.push({
parent_type: 'array',
element: input,
......@@ -231,10 +232,11 @@
div_input.appendChild(input);
input = document.createElement("button");
input.setAttribute("class", "add-sub-form");
input.setAttribute("class",
"ui-shadow-inset ui-btn ui-btn-inline ui-corner-all" +
" ui-btn-icon-notext ui-icon-btn ui-icon-plus ui-input-btn");
input.type = "button";
input.name = path;
input.textContent = "Add";
gadget.props.add_buttons.push({
element: input,
schema_part: schema
......@@ -558,7 +560,8 @@
var g = this,
key = options.key,
schema = options.schema,
delete_button;
delete_button,
root;
g.props.inputs = [];
g.props.add_buttons = [];
g.props.arrays = {};
......@@ -573,18 +576,24 @@
if (schema.type === undefined) {
schema.type = "object";
}
while (g.element.firstChild) {
g.element.removeChild(g.element.firstChild);
root = g.element.querySelector('[data-json-path="/"]');
if (!root) {
root = g.element;
}
while (root.firstChild) {
root.removeChild(root.firstChild);
}
if (!g.props.toplevel) {
delete_button = document.createElement("button");
delete_button.setAttribute("class",
"ui-shadow-inset ui-btn ui-btn-inline ui-corner-all" +
" ui-btn-icon-notext ui-icon-btn ui-icon-trash-o ui-input-btn");
delete_button.type = "button";
delete_button.name = options.path;
delete_button.textContent = "Delete";
g.props.delete_button = delete_button;
g.element.appendChild(delete_button);
root.appendChild(delete_button);
}
return render_field(g, key, "", schema, options.document, g.element)
return render_field(g, key, "", schema, options.document, root)
.push(function () {
g.listenEvents();
return g.element;
......@@ -616,7 +625,6 @@
});
})
.push(function () {
console.log("FINISHED TO RENDER, RETURNING THE GADGET");
return g;
});
})
......
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