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