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

button replace icon

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