Commit 23fdc14a authored by Gabriel Monnerat's avatar Gabriel Monnerat

HACK erp5_officejs_support_request_ui: Simplify code to render the expected...

HACK erp5_officejs_support_request_ui: Simplify code to render the expected action to preview any attachement document

Some portal types don't have preview action reference. In such case, we get html_view
parent cfa27657
......@@ -24,33 +24,15 @@
/////////////////////////////////////////////////////////////////
// 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;
return gadget.getUrlFor({
command: 'display',
var command = 'display_erp5_action_with_history';
return this.getUrlFor({
command: command,
options: {
jio_key: "document_module",
view: full_size_url
jio_key: raw_url,
page: ["preview", "html_view"]
}
});
});
})
.declareMethod('render', function (options) {
var gadget = this;
......@@ -175,14 +157,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;
......
......@@ -208,8 +208,10 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -218,7 +220,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>ERP5TypeTestCase</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.47417.29437.25668</string> </value>
<value> <string>985.17756.63769.9284</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,8 +252,8 @@
</tuple>
<state>
<tuple>
<float>1542273914.05</float>
<string>GMT+9</string>
<float>1594840751.27</float>
<string>UTC</string>
</tuple>
</state>
</object>
......@@ -259,7 +261,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
......
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