summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/document_viewer.js
diff options
context:
space:
mode:
authorKishan Gajjar <kig@odoo.com>2017-09-08 11:10:27 +0530
committerfwi-odoo <fwi@odoo.com>2017-09-13 12:46:52 +0200
commitc1fa3b8ab3dfa1306dbdd3b6dc910405a3357d16 (patch)
tree40fe4a46d24b7d2fab067569f36269f8e1a5a6aa /addons/mail/static/src/js/document_viewer.js
parent6552ae68d11329374adee58b9b8d502e625372ba (diff)
[IMP] mail: pdf preview and small improvement
When you click on pdf it should show preview of pdf. Don't show the previous/next arrows if there is only one attachment.
Diffstat (limited to 'addons/mail/static/src/js/document_viewer.js')
-rw-r--r--addons/mail/static/src/js/document_viewer.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/mail/static/src/js/document_viewer.js b/addons/mail/static/src/js/document_viewer.js
index 679e483c899..b3ea0e18bfc 100644
--- a/addons/mail/static/src/js/document_viewer.js
+++ b/addons/mail/static/src/js/document_viewer.js
@@ -40,9 +40,10 @@ var DocumentViewer = Widget.extend({
init: function (parent, attachments, activeAttachmentID) {
this._super.apply(this, arguments);
this.attachment = _.filter(attachments, function (attachment) {
- var type = attachment.mimetype.split('/').shift();
- if (type === 'image' || type === 'video') {
- attachment.type = type;
+ var match = attachment.mimetype.match("(image|video|application/pdf)");
+
+ if (match) {
+ attachment.type = match[1];
return true;
}
});