mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
follow JQuery convention + browser compatibility
This commit is contained in:
@@ -6,10 +6,10 @@ openerp.web_widget_image_download = function (instance) {
|
||||
'use strict';
|
||||
|
||||
instance.web.form.web_widget_image_download = instance.web.form.FieldBinaryImage.include({
|
||||
render_value() {
|
||||
render_value: function () {
|
||||
this._super();
|
||||
|
||||
const widget = this.$el.find('.oe_form_binary_file_download');
|
||||
var $widget = this.$el.find('.oe_form_binary_file_download');
|
||||
|
||||
this.imgSrc = this.$el.find('img[name="image"]').attr('src');
|
||||
|
||||
@@ -18,7 +18,7 @@ openerp.web_widget_image_download = function (instance) {
|
||||
url: this.imgSrc,
|
||||
complete(xhr) {
|
||||
// retrieve image type from server ("Content-Type" header)
|
||||
widget.attr('download', xhr.getResponseHeader("Content-Type").replace('/', '.'));
|
||||
$widget.attr('download', xhr.getResponseHeader("Content-Type").replace('/', '.'));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -27,9 +27,9 @@ openerp.web_widget_image_download = function (instance) {
|
||||
this.$el.find('.oe_form_binary_file_clear').removeClass('col-md-offset-5');
|
||||
}
|
||||
|
||||
widget.attr('href', this.imgSrc);
|
||||
$widget.attr('href', this.imgSrc);
|
||||
},
|
||||
has_custom_image() {
|
||||
has_custom_image: function () {
|
||||
// check if the image of the widget is different from the default placeholder
|
||||
return this.imgSrc && !this.imgSrc.includes('/placeholder.png');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user