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 @@
/////////////////////////////////////////////////////////////////
// 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) {
var gadget = this;
return gadget.jio_getAttachment(raw_url, "links")
.push(function (links) {
var full_size_url = links._links.view[4].href;
.push(function (links) {
var jio_key;
if (raw_url.indexOf("image_module") !== -1) {
jio_key = "image_module";
} else {
jio_key = "document_module";
}
return gadget.getUrlFor({
command: 'display',
options: {
jio_key: "document_module",
view: full_size_url
jio_key: jio_key,
view: links._links.view[0].href
}
});
});
......@@ -175,14 +166,6 @@
if (post.attachment_link === null) {
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(
function (attachment_link) {
post.attachment_link = attachment_link;
......@@ -275,4 +258,4 @@
.onEvent('submit', function () {
return this.submitPostComment();
});
}(window, rJS, RSVP, calculatePageTitle, moment, Handlebars));
\ No newline at end of file
}(window, rJS, RSVP, calculatePageTitle, moment, Handlebars));
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.47417.29437.25668</string> </value>
<value> <string>984.63101.11896.51882</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,8 +256,8 @@
</tuple>
<state>
<tuple>
<float>1542273914.05</float>
<string>GMT+9</string>
<float>1593630405.16</float>
<string>UTC</string>
</tuple>
</state>
</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