Commit 0a710f86 authored by Boris Kocherov's avatar Boris Kocherov

change code order for better understanding

parent 92e64283
...@@ -921,55 +921,7 @@ ...@@ -921,55 +921,7 @@
typeof json_document !== type; typeof json_document !== type;
} }
div = document.createElement("div");
div.setAttribute("class", "jsonformfield ui-field-contain");
if (schema.description) {
div.title = schema.description;
}
// if (property_name && !first_path) {
if (options.delete_button === true) {
delete_button = createElement("span",
{"class": "ui-btn-icon-top ui-icon-trash-o"}
);
gadget.props.delete_button = delete_button;
div.appendChild(delete_button);
} else if (options.top !== true) {
if (options.required) {
delete_button = createElement("span",
{"class": "ui-btn-icon-top ui-icon-circle"}
);
div.appendChild(delete_button);
} else {
delete_button = createElement("span");
delete_button.innerHTML = " ";
div.appendChild(delete_button);
}
}
label_text = [property_name, schema_ob.title]
.filter(function (v) { return v; })
.join(" ")
// use non-breaking hyphen
.replace(/-/g, "");
if (property_name || options.top) {
if (options.top) {
label = document.createElement("span");
label.textContent = label_text;
root.appendChild(label);
} else {
label = document.createElement("label");
label.textContent = label_text;
div.appendChild(label);
}
}
div_input = document.createElement("div");
div_input.setAttribute("id", gadget.element.getAttribute("data-gadget-scope") + first_path + '/');
div_input.setAttribute("class", "input");
// render input begin // render input begin
if (!input && schema_arr[0].is_arr_of_const && schema_arr.length > 1) { if (!input && schema_arr[0].is_arr_of_const && schema_arr.length > 1) {
input = render_enum_with_title(gadget, schema_arr, json_document, options.selected_schema); input = render_enum_with_title(gadget, schema_arr, json_document, options.selected_schema);
} }
...@@ -1061,6 +1013,54 @@ ...@@ -1061,6 +1013,54 @@
} }
} }
} }
// render input end
// html layout render begin
div = document.createElement("div");
div.setAttribute("class", "jsonformfield ui-field-contain");
if (schema.description) {
div.title = schema.description;
}
// if (property_name && !first_path) {
if (options.delete_button === true) {
delete_button = createElement("span",
{"class": "ui-btn-icon-top ui-icon-trash-o"}
);
gadget.props.delete_button = delete_button;
div.appendChild(delete_button);
} else if (options.top !== true) {
if (options.required) {
delete_button = createElement("span",
{"class": "ui-btn-icon-top ui-icon-circle"}
);
div.appendChild(delete_button);
} else {
delete_button = createElement("span");
delete_button.innerHTML = " ";
div.appendChild(delete_button);
}
}
label_text = [property_name, schema_ob.title]
.filter(function (v) { return v; })
.join(" ")
// use non-breaking hyphen
.replace(/-/g, "");
if (property_name || options.top) {
if (options.top) {
label = document.createElement("span");
label.textContent = label_text;
root.appendChild(label);
} else {
label = document.createElement("label");
label.textContent = label_text;
div.appendChild(label);
}
}
div_input = document.createElement("div");
div_input.setAttribute("id", gadget.element.getAttribute("data-gadget-scope") + first_path + '/');
div_input.setAttribute("class", "input");
if (!input && type === "array") { if (!input && type === "array") {
queue = render_array( queue = render_array(
...@@ -1104,8 +1104,6 @@ ...@@ -1104,8 +1104,6 @@
div.setAttribute("data-json-type", type); div.setAttribute("data-json-type", type);
} }
// render input end
if (schema.info !== undefined) { if (schema.info !== undefined) {
span_info = document.createElement("span"); span_info = document.createElement("span");
span_info.textContent = schema.info; span_info.textContent = schema.info;
...@@ -1116,6 +1114,7 @@ ...@@ -1116,6 +1114,7 @@
error_message.hidden = true; error_message.hidden = true;
div_input.appendChild(error_message); div_input.appendChild(error_message);
div.appendChild(div_input); div.appendChild(div_input);
// html layout render end
return queue return queue
.push(function () { .push(function () {
......
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