Browse Source
Merge pull request #945 from ernestotejeda/11.0-mig-web_widget_image_download
11.0 mig web_widget_image_download
pull/950/head
Pedro M. Baeza
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with
186 additions and
0 deletions
-
web_widget_image_download/README.rst
-
web_widget_image_download/__init__.py
-
web_widget_image_download/__manifest__.py
-
web_widget_image_download/i18n/hr.po
-
web_widget_image_download/i18n/lt.po
-
web_widget_image_download/i18n/nl_NL.po
-
web_widget_image_download/readme/CONTRIBUTORS.rst
-
web_widget_image_download/readme/DESCRIPTION.rst
-
web_widget_image_download/readme/USAGE.rst
-
BIN
web_widget_image_download/static/description/icon.png
-
web_widget_image_download/static/src/css/web_widget_image_download.css
-
web_widget_image_download/static/src/js/web_widget_image_download.js
-
web_widget_image_download/static/src/xml/web_widget_image_download.xml
-
web_widget_image_download/views/assets.xml
|
|
@ -0,0 +1 @@ |
|
|
|
**This file is going to be generated by oca-gen-addon-readme.** |
|
|
@ -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", |
|
|
|
] |
|
|
|
} |
|
|
@ -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" |
|
|
@ -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" |
|
|
@ -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" |
|
|
@ -0,0 +1,8 @@ |
|
|
|
* `Tecnativa <https://www.tecnativa.com>`_: |
|
|
|
|
|
|
|
* Flavio Corpa |
|
|
|
* Jairo Llopis |
|
|
|
* Pedro M. Baeza |
|
|
|
* Ernesto Tejeda |
|
|
|
|
|
|
|
* Kaushal Prajapati <kbprajapati@live.com> |
|
|
@ -0,0 +1,2 @@ |
|
|
|
This module was written to extend the functionality of the image widget and |
|
|
|
allows to download it. |
|
|
@ -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`). |
Width: 128
|
Height: 128
|
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> |
|
|
@ -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> |