Commit df18d3ad authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_officejs_support_request_ui: Simplify code to get always the first action of the list

parent 49caf172
...@@ -24,30 +24,21 @@ ...@@ -24,30 +24,21 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod('getImageUrl', function (raw_url) {
var gadget = this;
return gadget.jio_getAttachment(raw_url, "links")
.push(function (links) {
var full_size_url = links._links.view[1].href;
return gadget.getUrlFor({
command: 'display',
options: {
jio_key: "image_module",
view: full_size_url
}
});
});
})
.declareMethod('getDocumentUrl', function (raw_url) { .declareMethod('getDocumentUrl', function (raw_url) {
var gadget = this; var gadget = this;
return gadget.jio_getAttachment(raw_url, "links") return gadget.jio_getAttachment(raw_url, "links")
.push(function (links) { .push(function (links) {
var full_size_url = links._links.view[4].href; var jio_key;
if (raw_url.indexOf("image_module") !== -1) {
jio_key = "image_module";
} else {
jio_key = "document_module";
}
return gadget.getUrlFor({ return gadget.getUrlFor({
command: 'display', command: 'display',
options: { options: {
jio_key: "document_module", jio_key: jio_key,
view: full_size_url view: links._links.view[0].href
} }
}); });
}); });
...@@ -175,14 +166,6 @@ ...@@ -175,14 +166,6 @@
if (post.attachment_link === null) { if (post.attachment_link === null) {
return post; return post;
} }
if (post.attachment_link.indexOf("image_module") !== -1) {
return gadget.getImageUrl(post.attachment_link).push(
function (attachment_link) {
post.attachment_link = attachment_link;
return post;
}
);
}
return gadget.getDocumentUrl(post.attachment_link).push( return gadget.getDocumentUrl(post.attachment_link).push(
function (attachment_link) { function (attachment_link) {
post.attachment_link = attachment_link; post.attachment_link = attachment_link;
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.47417.29437.25668</string> </value> <value> <string>984.63101.11896.51882</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,8 +256,8 @@ ...@@ -256,8 +256,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1542273914.05</float> <float>1593630405.16</float>
<string>GMT+9</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
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