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