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; options: {
return gadget.getUrlFor({ jio_key: raw_url,
command: 'display', page: ["preview", "html_view"]
options: { }
jio_key: "document_module", });
view: full_size_url
}
});
});
}) })
.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;
...@@ -275,4 +249,4 @@ ...@@ -275,4 +249,4 @@
.onEvent('submit', function () { .onEvent('submit', function () {
return this.submitPostComment(); return this.submitPostComment();
}); });
}(window, rJS, RSVP, calculatePageTitle, moment, Handlebars)); }(window, rJS, RSVP, calculatePageTitle, moment, Handlebars));
\ No newline at end of file
...@@ -208,58 +208,62 @@ ...@@ -208,58 +208,62 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>edit</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>ERP5TypeTestCase</string> </value>
<key> <string>comment</string> </key> </item>
<value> <item>
<none/> <key> <string>comment</string> </key>
</value> <value>
</item> <none/>
<item> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>962.47417.29437.25668</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>985.17756.63769.9284</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1542273914.05</float> <state>
<string>GMT+9</string> <tuple>
</tuple> <float>1594840751.27</float>
</state> <string>UTC</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</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