mirror of https://github.com/OCA/web.git
[IMP] web_widget_image_download: black, isort, prettier
parent
d3ca7d953f
commit
d8d848ef8c
|
@ -0,0 +1 @@
|
||||||
|
../../../../web_widget_image_download
|
|
@ -0,0 +1,6 @@
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
|
@ -1,13 +1,13 @@
|
||||||
/* Copyright 2016 Flavio Corpa <flavio.corpa@tecnativa.com>
|
/* Copyright 2016 Flavio Corpa <flavio.corpa@tecnativa.com>
|
||||||
* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||||
odoo.define("web_widget_image_download.widget", function(require) {
|
odoo.define("web_widget_image_download.widget", function (require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var FieldBinaryImage = require("web.basic_fields").FieldBinaryImage;
|
var FieldBinaryImage = require("web.basic_fields").FieldBinaryImage;
|
||||||
|
|
||||||
FieldBinaryImage.include({
|
FieldBinaryImage.include({
|
||||||
_render: function() {
|
_render: function () {
|
||||||
this._super();
|
this._super();
|
||||||
var $widget = this.$el.find(".o_form_binary_file_download");
|
var $widget = this.$el.find(".o_form_binary_file_download");
|
||||||
this.imgSrc = this.$el.find('img[name="' + this.name + '"]').attr("src");
|
this.imgSrc = this.$el.find('img[name="' + this.name + '"]').attr("src");
|
||||||
|
@ -16,7 +16,7 @@ odoo.define("web_widget_image_download.widget", function(require) {
|
||||||
// Avoid downloading full image, just headers
|
// Avoid downloading full image, just headers
|
||||||
type: "HEAD",
|
type: "HEAD",
|
||||||
url: this.imgSrc,
|
url: this.imgSrc,
|
||||||
complete: function(xhr) {
|
complete: function (xhr) {
|
||||||
$widget.attr(
|
$widget.attr(
|
||||||
"download",
|
"download",
|
||||||
xhr.getResponseHeader("Content-Type").replace("/", ".")
|
xhr.getResponseHeader("Content-Type").replace("/", ".")
|
||||||
|
|
Loading…
Reference in New Issue