Commit 47d96a14 authored by Boris Kocherov's avatar Boris Kocherov

title rendering fixed for complex fields (fields which use schema_arr for render)

parent 077403f5
......@@ -346,6 +346,15 @@
x = {};
} else if (!doesntcopy) {
x = JSON.parse(JSON.stringify(x));
if (x.anyOf) {
delete x.anyOf;
}
if (x.oneOf) {
delete x.oneOf;
}
if (x.allOf) {
delete x.allOf;
}
}
if (y === true) {
y = {};
......@@ -515,7 +524,7 @@
var i,
arr = [];
for (i = 0; i < schema_array.length; i += 1) {
arr.push(expandSchema(g, mergeSchemas(schema_array[i], base_schema), schema_path + '/' + i.toString()));
arr.push(expandSchema(g, schema_array[i], schema_path + '/' + i.toString()));
}
return RSVP.all(arr);
})
......@@ -529,6 +538,13 @@
// or(any, restricted, restricted, .. ) simplify to any
return [arr[i][z]];
}
if (base_schema.title) {
arr[i][z].title = base_schema.title;
}
if (base_schema.description) {
arr[i][z].description = base_schema.description;
}
arr[i][z].schema = mergeSchemas(base_schema, arr[i][z].schema);
schema_arr.push(arr[i][z]);
}
}
......@@ -577,15 +593,17 @@
return RSVP.Queue()
.push(function () {
return [{
title: ref || schema.title,
title: schema.title,
ref: ref,
schema: schema,
schema_path: schema_path
}];
});
};
function schema_arr_marker(schema_arr) {
var i;
// XXX need cleanup false schema before
for (i = 0; i < schema_arr.length; i += 1) {
if (!schema_arr[i].schema.hasOwnProperty('const')) {
schema_arr[0].is_arr_of_const = false;
......
......@@ -433,6 +433,8 @@
// add propertyName to title
if (schema_array[i].title && schema_array.length > 1) {
schema_array[i].title = property_name + ' /' + schema_array[i].title;
} else if (schema_array[i].ref && schema_array.length > 1) {
schema_array[i].title = property_name + ' /' + schema_array[i].ref;
} else {
schema_array[i].title = property_name;
}
......@@ -844,14 +846,15 @@
input,
schema,
schema_path,
schema_ob,
first_path,
type_changed,
queue = RSVP.Queue();
// XXX if (ret_arr.length > 1) notify user
schema = schemaArrFilteredByDocument(schema_arr, json_document)[0];
schema_path = schema.schema_path;
schema = schema.schema;
schema_ob = schemaArrFilteredByDocument(schema_arr, json_document)[0];
schema = schema_ob.schema;
schema_path = schema_ob.schema_path;
if (schema_path === '/') {
schema_path = '';
......@@ -903,7 +906,9 @@
div = document.createElement("div");
div.setAttribute("class", "jsonformfield ui-field-contain");
div.title = schema.description;
if (schema.description) {
div.title = schema.description;
}
// if (key && !first_path) {
if (options.delete_button === true) {
delete_button = createElement("span",
......@@ -924,7 +929,7 @@
}
}
label_text = [key, schema.title]
label_text = [key, schema_ob.title]
.filter(function (v) { return v; })
.join(" ")
// use non-breaking hyphen
......
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