From cb6d2c66ada55aa7729d59991a1c275045d7ab7b Mon Sep 17 00:00:00 2001 From: kutyel Date: Thu, 28 Jul 2016 18:47:29 +0200 Subject: [PATCH] follow JQuery convention + browser compatibility --- .../static/src/js/web_widget_image_download.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web_widget_image_download/static/src/js/web_widget_image_download.js b/web_widget_image_download/static/src/js/web_widget_image_download.js index bd31db31..adaf7995 100644 --- a/web_widget_image_download/static/src/js/web_widget_image_download.js +++ b/web_widget_image_download/static/src/js/web_widget_image_download.js @@ -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'); }