Commit 960afe58 authored by Sven Franck's avatar Sven Franck

app: update dynamic content generation to handle popup and panels

parent 9e8b1d5e
......@@ -2620,9 +2620,11 @@
};
// TODO: remove, should be handled by content.set
// TODO: why is this not done on click, when we can get the href > element
// from the link attribute?
/**
* Load content into a dynamic element
* @method generatePopupContents
* @method generateDynamicContents
* @param {obj} object Action object (popupbeforeposition)
*/
factory.util.generateDynamicContents = function (obj) {
......@@ -2640,6 +2642,10 @@
} else {
element.setAttribute("data-state", reference);
element.setAttribute("data-reference", reference);
// empty gadget and reload
// TODO: how to replace in javaScript?
element.innerHTML = "";
promises = [];
// fetch content
......@@ -2650,29 +2656,15 @@
"pass": undefined
})
.then(function (reply) {
element.setAttribute("data-reference", reference);
if (reply.children) {
for (i = 0; i < reply.children.length; i += 1) {
promises[i] = app.content.set(reply.children[i], {});
}
}
return RSVP.all(promises);
return RSVP.resolve(app.content.set(reply, {}));
})
.then(function (content) {
fragment = document.createDocumentFragment();
for (j = 0; j < content.length; j += 1) {
fragment.appendChild(content[j]);
}
// translate
if (i18n) {
map.actions.translateNodeList(fragment);
map.actions.translateNodeList(content);
}
// empty gadget and reload
// TODO: how to replace in javaScript?
element.innerHTML = "";
// append
element.appendChild(fragment);
element.appendChild(content);
})
.then(function () {
$el = $(element);
......@@ -2683,6 +2675,7 @@
$el.popup("reposition", {"positionto": "window"});
break;
}
$el.enhanceWithin();
})
.fail(app.util.error);
}
......
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