diff --git a/web_widget_image_download/README.rst b/web_widget_image_download/README.rst new file mode 100644 index 00000000..ce5b0932 --- /dev/null +++ b/web_widget_image_download/README.rst @@ -0,0 +1,92 @@ +=========================== +Web Widget - Image Download +=========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/12.0/web_widget_image_download + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_widget_image_download + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module was written to extend the functionality of the image widget and +allows to download it. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +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`). + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa +* Kaushal Prajapati + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Flavio Corpa + * Jairo Llopis + * Pedro M. Baeza + * Ernesto Tejeda + +* Kaushal Prajapati + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_widget_image_download/__init__.py b/web_widget_image_download/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_widget_image_download/__manifest__.py b/web_widget_image_download/__manifest__.py new file mode 100644 index 00000000..bc96cd23 --- /dev/null +++ b/web_widget_image_download/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2016 Flavio Corpa +# 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": "12.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", + ] +} diff --git a/web_widget_image_download/i18n/hr.po b/web_widget_image_download/i18n/hr.po new file mode 100644 index 00000000..edb04e1c --- /dev/null +++ b/web_widget_image_download/i18n/hr.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_image_download +# +# Translators: +# Bole , 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 , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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" diff --git a/web_widget_image_download/i18n/lt.po b/web_widget_image_download/i18n/lt.po new file mode 100644 index 00000000..798cb550 --- /dev/null +++ b/web_widget_image_download/i18n/lt.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_image_download +# +# Translators: +# Viktoras Norkus , 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 , 2018\n" +"Language-Team: Lithuanian (https://www.transifex.com/oca/teams/23907/lt/)\n" +"Language: lt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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" diff --git a/web_widget_image_download/i18n/nl_NL.po b/web_widget_image_download/i18n/nl_NL.po new file mode 100644 index 00000000..1be78a58 --- /dev/null +++ b/web_widget_image_download/i18n/nl_NL.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_image_download +# +# Translators: +# Peter Hageman , 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 , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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" diff --git a/web_widget_image_download/i18n/web_widget_image_download.pot b/web_widget_image_download/i18n/web_widget_image_download.pot new file mode 100644 index 00000000..df4ad1b2 --- /dev/null +++ b/web_widget_image_download/i18n/web_widget_image_download.pot @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_image_download +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \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 "" + diff --git a/web_widget_image_download/readme/CONTRIBUTORS.rst b/web_widget_image_download/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..afeb1d51 --- /dev/null +++ b/web_widget_image_download/readme/CONTRIBUTORS.rst @@ -0,0 +1,8 @@ +* `Tecnativa `_: + + * Flavio Corpa + * Jairo Llopis + * Pedro M. Baeza + * Ernesto Tejeda + +* Kaushal Prajapati diff --git a/web_widget_image_download/readme/DESCRIPTION.rst b/web_widget_image_download/readme/DESCRIPTION.rst new file mode 100644 index 00000000..c4b36dd5 --- /dev/null +++ b/web_widget_image_download/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module was written to extend the functionality of the image widget and +allows to download it. diff --git a/web_widget_image_download/readme/USAGE.rst b/web_widget_image_download/readme/USAGE.rst new file mode 100644 index 00000000..f1685b6a --- /dev/null +++ b/web_widget_image_download/readme/USAGE.rst @@ -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`). diff --git a/web_widget_image_download/static/description/icon.png b/web_widget_image_download/static/description/icon.png new file mode 100644 index 00000000..65dabfc9 Binary files /dev/null and b/web_widget_image_download/static/description/icon.png differ diff --git a/web_widget_image_download/static/description/index.html b/web_widget_image_download/static/description/index.html new file mode 100644 index 00000000..a7523300 --- /dev/null +++ b/web_widget_image_download/static/description/index.html @@ -0,0 +1,439 @@ + + + + + + +Web Widget - Image Download + + + +
+

Web Widget - Image Download

+ + +

Beta License: LGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

This module was written to extend the functionality of the image widget and +allows to download it.

+

Table of contents

+ +
+

Usage

+

To use this module, an example path is:

+
    +
  1. Go to the section Contacts.
  2. +
  3. Click on a contact.
  4. +
  5. Edit the contact.
  6. +
  7. Click the Download button (between Edit and Clear).
  8. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
  • Kaushal Prajapati
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + 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 new file mode 100644 index 00000000..075a33cb --- /dev/null +++ b/web_widget_image_download/static/src/js/web_widget_image_download.js @@ -0,0 +1,31 @@ +/* Copyright 2016 Flavio Corpa + * Copyright 2016 Jairo Llopis + * 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); + } + }); +}); diff --git a/web_widget_image_download/static/src/scss/web_widget_image_download.scss b/web_widget_image_download/static/src/scss/web_widget_image_download.scss new file mode 100644 index 00000000..c5691a97 --- /dev/null +++ b/web_widget_image_download/static/src/scss/web_widget_image_download.scss @@ -0,0 +1,38 @@ + +.o_field_widget { + &.o_field_image { + .o_form_image_controls { + > .fa, .o_form_binary_file_download { + margin: 5px 0; + padding: 1px 0; + width: 33.333333%; + } + .o_form_binary_file_download { + border: none; + background-color: transparent; + line-height: 0px; + + > button.fa { + width: 100%; + height: 100%; + margin: 0px; + border: none; + background-color: transparent; + cursor: pointer; + } + } + } + @include media-breakpoint-down(xs, $o-extra-grid-breakpoints) { + .o_form_image_controls{ + .o_form_binary_file_download { + display: none; + } + > .fa{ + width: 50%; + padding: 6px; + margin: 0px; + } + } + } + } +} diff --git a/web_widget_image_download/static/src/xml/web_widget_image_download.xml b/web_widget_image_download/static/src/xml/web_widget_image_download.xml new file mode 100644 index 00000000..c459e132 --- /dev/null +++ b/web_widget_image_download/static/src/xml/web_widget_image_download.xml @@ -0,0 +1,15 @@ + + + + diff --git a/web_widget_image_download/views/assets.xml b/web_widget_image_download/views/assets.xml new file mode 100644 index 00000000..98bcca29 --- /dev/null +++ b/web_widget_image_download/views/assets.xml @@ -0,0 +1,16 @@ + + + + + +