mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Merge pull request #945 from ernestotejeda/11.0-mig-web_widget_image_download
11.0 mig web_widget_image_download
This commit is contained in:
1
web_widget_image_download/README.rst
Normal file
1
web_widget_image_download/README.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
**This file is going to be generated by oca-gen-addon-readme.**
|
||||||
0
web_widget_image_download/__init__.py
Normal file
0
web_widget_image_download/__init__.py
Normal file
22
web_widget_image_download/__manifest__.py
Normal file
22
web_widget_image_download/__manifest__.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Copyright 2016 Flavio Corpa <flavio.corpa@tecnativa.com>
|
||||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||||
|
{
|
||||||
|
"name": "Web Widget - Image Download",
|
||||||
|
"summary": "Allows to download any image from its widget",
|
||||||
|
"version": "11.0.1.0.0",
|
||||||
|
"category": "web",
|
||||||
|
"website": "https://github.com/OCA/web",
|
||||||
|
"author": "Tecnativa, Odoo Community Association (OCA), Kaushal Prajapati",
|
||||||
|
"license": "LGPL-3",
|
||||||
|
"application": False,
|
||||||
|
'installable': True,
|
||||||
|
"data": [
|
||||||
|
"views/assets.xml",
|
||||||
|
],
|
||||||
|
"depends": [
|
||||||
|
"web",
|
||||||
|
],
|
||||||
|
"qweb": [
|
||||||
|
"static/src/xml/web_widget_image_download.xml",
|
||||||
|
]
|
||||||
|
}
|
||||||
26
web_widget_image_download/i18n/hr.po
Normal file
26
web_widget_image_download/i18n/hr.po
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * web_widget_image_download
|
||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# Bole <bole@dajmi5.com>, 2017
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 10.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2017-07-13 16:07+0000\n"
|
||||||
|
"PO-Revision-Date: 2017-07-13 16:07+0000\n"
|
||||||
|
"Last-Translator: Bole <bole@dajmi5.com>, 2017\n"
|
||||||
|
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Language: hr\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||||
|
|
||||||
|
#. module: web_widget_image_download
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/web_widget_image_download/static/src/xml/web_widget_image_download.xml:10
|
||||||
|
#, python-format
|
||||||
|
msgid "Download"
|
||||||
|
msgstr "Preuzimanje"
|
||||||
26
web_widget_image_download/i18n/lt.po
Normal file
26
web_widget_image_download/i18n/lt.po
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * web_widget_image_download
|
||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# Viktoras Norkus <viktoras@bmx.lt>, 2018
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 10.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2018-01-25 01:58+0000\n"
|
||||||
|
"PO-Revision-Date: 2018-01-25 01:58+0000\n"
|
||||||
|
"Last-Translator: Viktoras Norkus <viktoras@bmx.lt>, 2018\n"
|
||||||
|
"Language-Team: Lithuanian (https://www.transifex.com/oca/teams/23907/lt/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Language: lt\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||||
|
|
||||||
|
#. module: web_widget_image_download
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/web_widget_image_download/static/src/xml/web_widget_image_download.xml:10
|
||||||
|
#, python-format
|
||||||
|
msgid "Download"
|
||||||
|
msgstr "Atsisiūsti"
|
||||||
26
web_widget_image_download/i18n/nl_NL.po
Normal file
26
web_widget_image_download/i18n/nl_NL.po
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * web_widget_image_download
|
||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# Peter Hageman <hageman.p@gmail.com>, 2017
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 10.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2017-07-01 03:35+0000\n"
|
||||||
|
"PO-Revision-Date: 2017-07-01 03:35+0000\n"
|
||||||
|
"Last-Translator: Peter Hageman <hageman.p@gmail.com>, 2017\n"
|
||||||
|
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Language: nl_NL\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
|
#. module: web_widget_image_download
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/web_widget_image_download/static/src/xml/web_widget_image_download.xml:10
|
||||||
|
#, python-format
|
||||||
|
msgid "Download"
|
||||||
|
msgstr "Download"
|
||||||
8
web_widget_image_download/readme/CONTRIBUTORS.rst
Normal file
8
web_widget_image_download/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
|
* Flavio Corpa
|
||||||
|
* Jairo Llopis
|
||||||
|
* Pedro M. Baeza
|
||||||
|
* Ernesto Tejeda
|
||||||
|
|
||||||
|
* Kaushal Prajapati <kbprajapati@live.com>
|
||||||
2
web_widget_image_download/readme/DESCRIPTION.rst
Normal file
2
web_widget_image_download/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
This module was written to extend the functionality of the image widget and
|
||||||
|
allows to download it.
|
||||||
6
web_widget_image_download/readme/USAGE.rst
Normal file
6
web_widget_image_download/readme/USAGE.rst
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
To use this module, an example path is:
|
||||||
|
|
||||||
|
#. Go to the section `Contacts`.
|
||||||
|
#. Click on a contact.
|
||||||
|
#. Edit the contact.
|
||||||
|
#. Click the `Download` button (between `Edit` and `Clear`).
|
||||||
BIN
web_widget_image_download/static/description/icon.png
Normal file
BIN
web_widget_image_download/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,8 @@
|
|||||||
|
/* Copyright 2016 Flavio Corpa <flavio.corpa@tecnativa.com>
|
||||||
|
* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
|
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||||
|
|
||||||
|
.o_field_image .o_form_image_controls
|
||||||
|
.o_form_binary_file_download {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/* Copyright 2016 Flavio Corpa <flavio.corpa@tecnativa.com>
|
||||||
|
* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
|
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||||
|
odoo.define('web_widget_image_download.widget', function (require) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var FieldBinaryImage = require('web.basic_fields').FieldBinaryImage;
|
||||||
|
|
||||||
|
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 + '"]')
|
||||||
|
.attr('src');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'HEAD', // Avoid downloading full image, just headers
|
||||||
|
url: this.imgSrc,
|
||||||
|
complete: function (xhr) {
|
||||||
|
$widget.attr(
|
||||||
|
'download',
|
||||||
|
xhr.getResponseHeader("Content-Type")
|
||||||
|
.replace('/', '.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$widget.attr('href', this.imgSrc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Copyright 2016 Flavio Corpa <flavio.corpa@tecnativa.com>
|
||||||
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<t t-extend="FieldBinaryImage">
|
||||||
|
<t t-jquery=".o_select_file_button" t-operation="after">
|
||||||
|
<t t-if="widget.value">
|
||||||
|
<a class="fa fa-download o_form_binary_file_download"
|
||||||
|
title="Download"/>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
</template>
|
||||||
16
web_widget_image_download/views/assets.xml
Normal file
16
web_widget_image_download/views/assets.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright 2016 Flavio Corpa <flavio.corpa@tecnativa.com>
|
||||||
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<template id="assets_backend" inherit_id="web.assets_backend">
|
||||||
|
<xpath expr=".">
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="/web_widget_image_download/static/src/css/web_widget_image_download.css"/>
|
||||||
|
<script type="text/javascript"
|
||||||
|
src="/web_widget_image_download/static/src/js/web_widget_image_download.js"/>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user