mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_widget_image_download: Migration to 11.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||
|
||||
.o_form_field_image .o_form_image_controls
|
||||
.o_field_image .o_form_image_controls
|
||||
.o_form_binary_file_download {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
odoo.define('web_widget_image_download.widget', function (require) {
|
||||
'use strict';
|
||||
|
||||
var core = require('web.core');
|
||||
var FieldBinaryImage = require('web.basic_fields').FieldBinaryImage;
|
||||
|
||||
core.form_widget_registry.get("image").include({
|
||||
render_value: function () {
|
||||
FieldBinaryImage.include({
|
||||
_render: function () {
|
||||
this._super();
|
||||
var $widget = this.$el.find('.o_form_binary_file_download');
|
||||
this.imgSrc = this.$el.find('img[name="' + this.name + '"]')
|
||||
@@ -25,17 +25,7 @@ odoo.define('web_widget_image_download.widget', function (require) {
|
||||
}
|
||||
});
|
||||
|
||||
// Replace with jQuery to keep inheritance intact
|
||||
if (this.has_custom_image()) {
|
||||
this.$el.find('.o_clear_file_button')
|
||||
.removeClass('col-md-offset-5');
|
||||
}
|
||||
|
||||
$widget.attr('href', this.imgSrc);
|
||||
},
|
||||
|
||||
has_custom_image: function () {
|
||||
return this.imgSrc != this.placeholder;
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<template>
|
||||
<t t-extend="FieldBinaryImage">
|
||||
<t t-jquery=".o_select_file_button" t-operation="after">
|
||||
<t t-if="widget.has_custom_image()">
|
||||
<t t-if="widget.value">
|
||||
<a class="fa fa-download o_form_binary_file_download"
|
||||
title="Download"/>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user