Commit 4673569c authored by Boris Kocherov's avatar Boris Kocherov

[erp5_json_form] update from https://lab.nexedi.com/bk/rjs_json_form

parent 633ce5c1
......@@ -272,7 +272,7 @@
hash = url.hash;
url = url.href;
if (download_url.startsWith("urn:jio:")) {
external_reference = true;
external_reference = download_url;
queue = RSVP.Queue()
.push(function () {
return g.resolveExternalReference(download_url, schema_path, path);
......@@ -706,6 +706,31 @@
this.props.errors[arr[1]] = arr[0];
}
})
.declareMethod('getSubGadget', function (scope) {
// recursive getDeclaredGadget
// work only if subgadget scope contain parent
// scope as prefix
// example:
// gadget: scope1234
// subgadet: scope1234_subgadgetscope1
// subsubgadet: scope1234_subgadgetscope1_subsubgadetscope
var i,
gadget = this,
scope_arr = scope.split('_'),
queue = RSVP.Queue()
.push(function () {
return gadget.props.form_gadget;
});
function getDeclaredGadget(scope) {
return function (g) {
return g.getDeclaredGadget(scope);
};
}
for (i = 2; i <= scope_arr.length; i += 1) {
queue.push(getDeclaredGadget(scope_arr.slice(0, i).join('_')));
}
return queue;
})
.declareMethod('getGadgetByPath', function (path) {
return this.props.form_gadget.getGadgetByPath(path || "/");
})
......
......@@ -347,6 +347,15 @@
saveOrigValue: g.props.saveOrigValue,
ignore_incorrect: g.props.ignore_incorrect,
scope: scope
})
.push(function () {
if (options.schema_arr.external_reference) {
return form_gadget.rootNotifyChange({
scope: scope,
action: "render",
path: "/"
});
}
})
.push(function () {
if (form_gadget.props.changed) {
......@@ -535,6 +544,7 @@
return schema_arr;
}
ret_arr[0].circular = circular;
ret_arr.external_reference = schema_arr.external_reference;
return ret_arr;
}
return schema_arr;
......@@ -1818,6 +1828,7 @@
scope: v.scope || g.element.getAttribute("data-gadget-scope"),
rel_path: v.path,
path: p,
ref: g.props.schema_arr.external_reference,
action: v.action
});
});
......@@ -1833,6 +1844,7 @@
);
}
tasks.push(g.notifyInvalid([], g.element.getAttribute("data-gadget-scope")));
g.props.deleted = true;
return new RSVP.Queue()
.push(function () {
return RSVP.all(tasks);
......@@ -2315,6 +2327,9 @@
.declareMethod('getContent', function () {
var g = this;
if (g.props.deleted) {
return;
}
return getFormValuesAsJSONDict(g)
.push(function (data) {
if (g.props.updatePropertySelectors) {
......
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