Commit 0feb08ce authored by Roque's avatar Roque

erp5_officejs: fix promise queue and declare util gadget in html

parent a12a5c3d
......@@ -275,39 +275,42 @@
}
}
queue
.push(function () {
return gadget.declareGadget("gadget_officejs_common_util.html");
})
.push(function (gadget_utils) {
return gadget_utils.getViewAndActionDict(modification_dict.portal_type,
modification_dict.jio_key);
})
.push(function (view_action_dict) {
return RSVP.all([
getElementList(gadget, view_action_dict.view_list),
getElementList(gadget, view_action_dict.action_list)
]);
})
.push(function (view_action_list) {
var dl_element,
dl_fragment = document.createDocumentFragment();
dl_element = gadget.element.querySelector("dl");
while (dl_element.firstChild) {
dl_element.removeChild(dl_element.firstChild);
}
if (view_action_list[0].length > 0) {
appendDt(dl_fragment, "VIEWS", 'eye',
view_action_list[0]);
dl_element.appendChild(dl_fragment);
}
if (view_action_list[1].length > 0) {
appendDt(dl_fragment, "ACTIONS", 'cogs',
view_action_list[1]);
dl_element.appendChild(dl_fragment);
}
return queue;
});
if (modification_dict.hasOwnProperty("portal_type")) {
queue
.push(function () {
return gadget.getDeclaredGadget("common_util");
})
.push(function (gadget_utils) {
return gadget_utils.getViewAndActionDict(modification_dict.portal_type,
modification_dict.jio_key);
})
.push(function (view_action_dict) {
return RSVP.all([
getElementList(gadget, view_action_dict.view_list),
getElementList(gadget, view_action_dict.action_list)
]);
})
.push(function (view_action_list) {
var dl_element,
dl_fragment = document.createDocumentFragment();
dl_element = gadget.element.querySelector("dl");
while (dl_element.firstChild) {
dl_element.removeChild(dl_element.firstChild);
}
if (view_action_list[0].length > 0) {
appendDt(dl_fragment, "VIEWS", 'eye',
view_action_list[0]);
dl_element.appendChild(dl_fragment);
}
if (view_action_list[1].length > 0) {
appendDt(dl_fragment, "ACTIONS", 'cogs',
view_action_list[1]);
dl_element.appendChild(dl_fragment);
}
});
}
return queue;
})
/////////////////////////////////////////////////////////////////
......
......@@ -225,7 +225,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>979.51953.14282.5120</string> </value>
<value> <string>979.52132.14300.25702</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -243,7 +243,7 @@
</tuple>
<state>
<tuple>
<float>1573729132.16</float>
<float>1573740764.23</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -64,6 +64,11 @@
<!-- custom script -->
<script src="gadget_erp5_ojs_panel.js" type="text/javascript"></script>
<div data-gadget-url="gadget_officejs_common_util.html"
data-gadget-scope="common_util"
data-gadget-sandbox="public">
</div>
</head>
<body>
......
......@@ -215,7 +215,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>vincent</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -229,7 +229,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.45561.47559.9591</string> </value>
<value> <string>975.50798.33418.15411</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -247,7 +247,7 @@
</tuple>
<state>
<tuple>
<float>1515509919.32</float>
<float>1573739234.08</float>
<string>UTC</string>
</tuple>
</state>
......
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