mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-23 17:08:46 -06:00
[FIX] pylint/javascript-lint
This commit is contained in:
parent
7aedeff413
commit
f31e4d6004
@ -1,5 +1,5 @@
|
|||||||
///* Copyright 2014 Therp BV (<http://therp.nl>)
|
/* Copyright 2014 Therp BV (<http://therp.nl>)
|
||||||
// * License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
|
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
|
||||||
|
|
||||||
odoo.define('attachment_preview', function (require) {
|
odoo.define('attachment_preview', function (require) {
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -17,9 +17,8 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
canPreview: function (extension) {
|
canPreview: function (extension) {
|
||||||
return $.inArray(
|
return $.inArray(
|
||||||
extension,
|
extension,
|
||||||
[
|
['odt', 'odp', 'ods', 'fodt', 'pdf', 'ott', 'fodp', 'otp',
|
||||||
'odt', 'odp', 'ods', 'fodt', 'pdf', 'ott', 'fodp', 'otp',
|
'fods', 'ots',
|
||||||
'fods', 'ots'
|
|
||||||
]) > -1;
|
]) > -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
Sidebar.include(AttachmentPreviewMixin);
|
Sidebar.include(AttachmentPreviewMixin);
|
||||||
Sidebar.include({
|
Sidebar.include({
|
||||||
events: _.extend({}, Sidebar.prototype.events, {
|
events: _.extend({}, Sidebar.prototype.events, {
|
||||||
'click .o_sidebar_preview_attachment': '_onPreviewAttachment'
|
'click .o_sidebar_preview_attachment': '_onPreviewAttachment',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
previewableAttachments: null,
|
previewableAttachments: null,
|
||||||
@ -64,7 +63,7 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var self = this,
|
var self = this,
|
||||||
$target = $(event.currentTarget),
|
$target = $(event.currentTarget),
|
||||||
split_screen = $target.attr('data-target') != 'new',
|
split_screen = $target.attr('data-target') !== 'new',
|
||||||
attachment_id = parseInt($target.attr('data-id'), 10),
|
attachment_id = parseInt($target.attr('data-id'), 10),
|
||||||
attachment_url = $target.attr('data-url'),
|
attachment_url = $target.attr('data-url'),
|
||||||
attachment_extension = $target.attr('data-extension'),
|
attachment_extension = $target.attr('data-extension'),
|
||||||
@ -76,7 +75,7 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
this._rpc({
|
this._rpc({
|
||||||
model: 'ir.attachment',
|
model: 'ir.attachment',
|
||||||
method: 'get_attachment_extension',
|
method: 'get_attachment_extension',
|
||||||
args: [attachment_id]
|
args: [attachment_id],
|
||||||
}).then(function (extension) {
|
}).then(function (extension) {
|
||||||
self.showPreview(attachment_id, attachment_url, extension, null, split_screen);
|
self.showPreview(attachment_id, attachment_url, extension, null, split_screen);
|
||||||
});
|
});
|
||||||
@ -104,8 +103,8 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
args: [
|
args: [
|
||||||
_.map(_.keys(attachments), function (id) {
|
_.map(_.keys(attachments), function (id) {
|
||||||
return parseInt(id, 10);
|
return parseInt(id, 10);
|
||||||
})
|
}),
|
||||||
]
|
],
|
||||||
}).then(function (extensions) {
|
}).then(function (extensions) {
|
||||||
var reviewableAttachments = _.map(_.keys(_.pick(extensions, function (extension, id) {
|
var reviewableAttachments = _.map(_.keys(_.pick(extensions, function (extension, id) {
|
||||||
return self.canPreview(extension);
|
return self.canPreview(extension);
|
||||||
@ -120,8 +119,8 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
attachments[id]['url'],
|
attachments[id]['url'],
|
||||||
extensions[id],
|
extensions[id],
|
||||||
id + ' - ' + attachments[id]['title']
|
id + ' - ' + attachments[id]['title']
|
||||||
)
|
),
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
deferred.resolve(reviewableAttachments);
|
deferred.resolve(reviewableAttachments);
|
||||||
}, function () {
|
}, function () {
|
||||||
@ -147,7 +146,7 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
basic_fields.FieldBinaryFile.include(AttachmentPreviewMixin);
|
basic_fields.FieldBinaryFile.include(AttachmentPreviewMixin);
|
||||||
basic_fields.FieldBinaryFile.include({
|
basic_fields.FieldBinaryFile.include({
|
||||||
events: _.extend({}, basic_fields.FieldBinaryFile.prototype.events, {
|
events: _.extend({}, basic_fields.FieldBinaryFile.prototype.events, {
|
||||||
'click .fa-search': '_onPreview'
|
'click .fa-search': '_onPreview',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
_renderReadonly: function () {
|
_renderReadonly: function () {
|
||||||
@ -176,8 +175,8 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
this.model,
|
this.model,
|
||||||
this.recordData.id,
|
this.recordData.id,
|
||||||
this.name,
|
this.name,
|
||||||
this.attrs.filename
|
this.attrs.filename,
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -194,7 +193,7 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
_.str.sprintf(_t('Preview %s'), this.field.string),
|
_.str.sprintf(_t('Preview %s'), this.field.string),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
var AttachmentPreviewWidget = Widget.extend({
|
var AttachmentPreviewWidget = Widget.extend({
|
||||||
@ -273,7 +272,7 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
loadPreview: function () {
|
loadPreview: function () {
|
||||||
if (this.attachments.length == 0) {
|
if (this.attachments.length === 0) {
|
||||||
this.$iframe.attr('src', 'about:blank');
|
this.$iframe.attr('src', 'about:blank');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -287,7 +286,7 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
this.activeIndex = 0;
|
this.activeIndex = 0;
|
||||||
this.updatePaginator();
|
this.updatePaginator();
|
||||||
this.loadPreview();
|
this.loadPreview();
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
FormRenderer.include({
|
FormRenderer.include({
|
||||||
@ -320,14 +319,14 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
on_detach_callback: function () {
|
on_detach_callback: function () {
|
||||||
this.attachmentPreviewWidget.hide();
|
this.attachmentPreviewWidget.hide();
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
}
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
FormController.include({
|
FormController.include({
|
||||||
custom_events: _.extend({}, FormController.prototype.custom_events, {
|
custom_events: _.extend({}, FormController.prototype.custom_events, {
|
||||||
onAttachmentPreview: '_onAttachmentPreview',
|
onAttachmentPreview: '_onAttachmentPreview',
|
||||||
setPreviewableAttachments: '_setPreviewableAttachments'
|
setPreviewableAttachments: '_setPreviewableAttachments',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
_onAttachmentPreview: function (event) {
|
_onAttachmentPreview: function (event) {
|
||||||
@ -338,11 +337,11 @@ odoo.define('attachment_preview', function(require) {
|
|||||||
this.renderer.attachmentPreviewWidget.setAttachments(
|
this.renderer.attachmentPreviewWidget.setAttachments(
|
||||||
event.data.attachments
|
event.data.attachments
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
AttachmentPreviewMixin: AttachmentPreviewMixin,
|
AttachmentPreviewMixin: AttachmentPreviewMixin,
|
||||||
AttachmentPreviewWidget: AttachmentPreviewWidget
|
AttachmentPreviewWidget: AttachmentPreviewWidget,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user