Commit da8c0b3d authored by Boris Kocherov's avatar Boris Kocherov

rerender work for addSchemaButtons too

parent fea39d15
......@@ -577,18 +577,44 @@
if (schema_alternatives.length === 1) {
return RSVP.Queue()
.push(function () {
if (rerender) {
return rerender(undefined, schema_alternatives);
}
return true;
})
.push(function (ret) {
var input = document.createElement("button");
input.setAttribute("class",
"ui-shadow-inset ui-btn ui-btn-inline ui-corner-all" +
" ui-btn-icon-notext ui-icon-btn ui-icon-plus ui-input-btn");
input.type = "button";
input.hidden = !ret;
gadget.props.add_buttons.push({
element: input,
event: function () {
return event(schema_alternatives[0].value)
.push(function () {
if (rerender) {
return rerender(undefined, schema_alternatives);
}
return true;
})
.push(function (r) {
input.hidden = !r;
return checkValidityAndNotifyChange(gadget);
});
},
rerender: function () {
return RSVP.Queue()
.push(function () {
if (rerender) {
return rerender(undefined, schema_alternatives);
}
return true;
})
.push(function (r) {
input.hidden = !r;
});
}
});
return input;
......@@ -978,13 +1004,16 @@
item_list.push([item.title, x]);
}
}
return {
name: gadget_s.element.getAttribute('data-gadget-scope'),
editable: true,
hidden: item_list.length === 0,
value: item_list[0][1],
item_list: item_list
};
if (gadget_s) {
return {
name: gadget_s.element.getAttribute('data-gadget-scope'),
editable: true,
hidden: item_list.length === 1,
value: item_list[0][1],
item_list: item_list
};
}
return item_list.length > 1;
}
});
})
......@@ -1235,6 +1264,8 @@
.allowPublicAcquisition("deleteChildren", function (arr, scope) {
var g = this,
key,
i,
button_list = this.props.add_buttons,
objects = this.props.objects,
element = getSubGadgetElement(g, scope),
parent = element.getAttribute("data-json-parent"),
......@@ -1253,6 +1284,9 @@
tasks.push(g.props.add_custom_data[key].rerender());
}
}
for (i = 0; i < button_list.length; i = i + 1) {
tasks.push(button_list[i].rerender());
}
tasks.push(checkValidityAndNotifyChange(g));
return RSVP.Queue()
.push(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