Commit a9ac5818 authored by Boris Kocherov's avatar Boris Kocherov

rerender() use keyword arguments now

parent 9d7adfd1
......@@ -257,7 +257,10 @@
return generateSchema(settings);
})
.push(function (schema) {
return gadget_settings.rerender(rerender_path, schema);
return gadget_settings.rerender({
path: rerender_path,
schema: schema
});
})
.push(function () {
// return g.notifyChange();
......
......@@ -963,25 +963,41 @@
return g;
});
})
.declareMethod('rerender', function (path, schema) {
.declareMethod('rerender', function (opt) {
var g = this,
gadget;
if (path) {
return g.props.form_gadget.getGadgetByPath(path)
gadget,
queue = RSVP.Queue();
if (opt.path) {
queue
.push(function () {
return g.props.form_gadget.getGadgetByPath(opt.path);
})
.push(function (ret) {
gadget = ret.gadget;
});
}
if (opt.scope) {
queue
.push(function () {
return g.props.form_gadget.getDeclaredGadget(opt.scope);
})
.push(function (ret) {
gadget = ret;
});
}
return queue
.push(function () {
return gadget.getContent();
})
.push(function (value) {
return gadget.rerender({
schema: schema,
schema: opt.schema,
value: value
})
.push(function () {
return gadget.reValidate(value, schema);
return gadget.reValidate(value, opt.schema);
});
});
}
})
.allowPublicAcquisition("expandSchema", function (arr) {
......
......@@ -625,11 +625,16 @@
gadget.props.add_custom_data[scope] = {
element: g.element,
event: function () {
var notify = {
action: "add"
};
return g.getContent()
.push(function (value) {
return event(schema_alternatives[value[scope]].value);
})
.push(function () {
.push(function (v) {
notify.scope = v.scope;
notify.path = v.path;
if (rerender) {
return rerender(g, schema_alternatives);
}
......@@ -639,9 +644,7 @@
return g.render(render_options);
})
.push(function () {
// XXX need path argument
// absent in current context
return gadget.rootNotifyChange();
return gadget.rootNotifyChange(notify);
});
},
rerender: 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