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

cleanup render()

parent f3caa368
...@@ -1429,8 +1429,7 @@ ...@@ -1429,8 +1429,7 @@
return this.loadJSONSchema(arr[0], arr[1]); return this.loadJSONSchema(arr[0], arr[1]);
}) })
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var g = this, var g = this;
queue;
g.props.toplevel = true; g.props.toplevel = true;
// contain map of current normalized schema // contain map of current normalized schema
// json pointer and corresponding url // json pointer and corresponding url
...@@ -1438,19 +1437,18 @@ ...@@ -1438,19 +1437,18 @@
g.props.schema = {}; g.props.schema = {};
g.props.schema_map = {}; g.props.schema_map = {};
g.props.schema_cache = {}; g.props.schema_cache = {};
g.options = options; return RSVP.Queue()
if (!options.value) {
options.value = {};
}
if (options.schema) {
queue = RSVP.Queue()
.push(function () { .push(function () {
if (options.schema) {
return options.schema; return options.schema;
});
} else {
queue = g.loadJSONSchema(options.schema_url);
} }
return queue var schema_url = options.schema_url ||
(options.value && options.value.$schema);
if (schema_url) {
return g.loadJSONSchema(schema_url);
}
return {};
})
.push(function (schema) { .push(function (schema) {
g.options.schema = schema; g.options.schema = schema;
return g.renderForm({ return g.renderForm({
......
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