-
-
Notifications
You must be signed in to change notification settings - Fork 684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] 9.0 website_base_multi_image #252
Changes from 8 commits
850e460
ae9103a
52c1e0b
e70a9c4
ee2d903
4ff4a7a
233dcf2
2ebdc95
9c55698
67f1d36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html | ||
:alt: License: LGPL-3 | ||
|
||
======================== | ||
Website Base Multi-Image | ||
======================== | ||
|
||
This module extends the functionality of 'base_multi_image' module | ||
to show winery data in website | ||
|
||
Usage | ||
===== | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usage instructions? Don't know what to test... |
||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/{id} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put right id |
||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/xxx/issues>`_. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. xxx? |
||
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 | ||
`here <https://github.com/OCA/website/issues/new?body=module:%mypopwine_website_portal_purchase_winery%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use newer template. |
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Carlos Dauden <carlos.dauden@tecnativa.com> | ||
* Sergio Teruel <sergio.teruel@tecnativa.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
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. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Sergio Teruel <sergio.teruel@tecnativa.com> | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Sergio Teruel <sergio.teruel@tecnativa.com> | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
'name': "Website Base Multi Image", | ||
'summary': "Show multi images data in frontend", | ||
'category': 'Website', | ||
'version': '9.0.1.0.0', | ||
'depends': [ | ||
'website', | ||
'base_multi_image', | ||
], | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
'views/assets.xml', | ||
'views/layout.xml', | ||
], | ||
'qweb': ['static/src/xml/*.xml'], | ||
'author': 'Tecnativa', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and oca? |
||
'website': 'http://www.tecnativa.com', | ||
'license': 'LGPL-3', | ||
'installable': True, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_base_multi_image | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-09-19 13:56+0200\n" | ||
"PO-Revision-Date: 2016-09-19 13:57+0200\n" | ||
"Last-Translator: Sergio Teruel <sergio@incaser.es>\n" | ||
"Language-Team: sergio.teruel@tecnativa.com\n" | ||
"Language: es_ES\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"X-Generator: Poedit 1.8.7.1\n" | ||
|
||
#. module: website_base_multi_image | ||
#: model:ir.ui.view,arch_db:website_base_multi_image.upload_image_action | ||
msgid "Add Pictures" | ||
msgstr "Añadir fotos" | ||
|
||
#. module: website_base_multi_image | ||
#: code:addons/website_base_multi_image/controllers/main.py:26 | ||
#, python-format | ||
msgid "Failed to remove image" | ||
msgstr "Error al intentar borrar una imagen" | ||
|
||
#. module: website_base_multi_image | ||
#: code:addons/website_base_multi_image/controllers/main.py:54 | ||
#, python-format | ||
msgid "Failed to set main image" | ||
msgstr "Error al intentar establecer la imagen principal" | ||
|
||
#. module: website_base_multi_image | ||
#: model:ir.ui.view,arch_db:website_base_multi_image.image_main | ||
msgid "Image" | ||
msgstr "Imagen" | ||
|
||
#. module: website_base_multi_image | ||
#: model:ir.ui.view,arch_db:website_base_multi_image.image_thumbnails | ||
msgid "More Images" | ||
msgstr "Más imágenes" | ||
|
||
#. module: website_base_multi_image | ||
#. openerp-web | ||
#: code:addons/website_base_multi_image/static/src/js/website_multi_image.js:58 | ||
#, python-format | ||
msgid "This image already exists" | ||
msgstr "Esta imagen ya existe." | ||
|
||
#. module: website_base_multi_image | ||
#. openerp-web | ||
#: code:addons/website_base_multi_image/static/src/xml/website_multi_image.xml:36 | ||
#, python-format | ||
msgid "Warning!" | ||
msgstr "¡Aviso!" | ||
|
||
#. module: website_base_multi_image | ||
#: model:ir.model,name:website_base_multi_image.model_base_multi_image_image | ||
msgid "base_multi_image.image" | ||
msgstr "" | ||
|
||
#. module: website_base_multi_image | ||
#: model:ir.model,name:website_base_multi_image.model_base_multi_image_owner | ||
msgid "base_multi_image.owner" | ||
msgstr "" | ||
|
||
#~ msgid "Main Image" | ||
#~ msgstr "Imágen principal" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import image |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) | ||
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
import base64 | ||
from openerp import api, models | ||
|
||
|
||
class Image(models.Model): | ||
_inherit = "base_multi_image.image" | ||
|
||
@api.model | ||
def get_images_to_add(self, post, model_name): | ||
""" | ||
@param post: dict with images in format 'new_image_xxx' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@param model_name: Model to store image | ||
@return: List of images to add | ||
""" | ||
images_to_add = [] | ||
for key in post.keys(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not |
||
if 'new_image_' in key: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if isinstance(post[key], list): | ||
new_image = post[key][0] | ||
else: | ||
new_image = post[key] | ||
images_to_add.append((0, 0, { | ||
'storage': 'db', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could get this from context ( |
||
'file_db_store': base64.encodestring(new_image.read()), | ||
'owner_model': model_name, | ||
'name': new_image.filename, | ||
'extension': 'jpg', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, but base_multi_image.image does not have mimetype field. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think @lasley means that you should guess the mimetype from the incoming bytes and then choose the right extension instead of hardcoding |
||
})) | ||
return images_to_add |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_portal_supplier_base_multi_image,access_portal_supplier_base_multi_image,base_multi_image.model_base_multi_image_image,base.group_portal,1,1,1,0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So any portal users can modify any image? 👎 write/create/unlink perms must be ir.rule-constrained, and I guess that should be made per submodule, so delete this please. |
||
access_public_base_multi_image,access_public_base_multi_image,base_multi_image.model_base_multi_image_image,base.group_public,1,0,0,0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use a single rule for this, with no group. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are still giving access to public and portal users to every image in the database. As this is right now, this is a 👎 blocking security issue. I think the best fix you could apply is something similar to what I do here for That IMP should go direclty into |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* Theme css */ | ||
|
||
.custom-file-input input { | ||
visibility: hidden; | ||
width: 100%; | ||
} | ||
|
||
#file_input_multi{ | ||
display: none; | ||
} | ||
|
||
.image-thumb { | ||
max-width: 90px; | ||
} | ||
|
||
.image_main{ | ||
max-width: 250px; | ||
max-height: 250px; | ||
} | ||
|
||
#base_multi_image .carousel-indicators{ | ||
position: relative; | ||
bottom: 0px; | ||
left: 0px; | ||
z-index: 15; | ||
width: 100%; | ||
margin-left: 0px; | ||
padding-left: 0; | ||
list-style: none; | ||
text-align: left; | ||
} | ||
|
||
#base_multi_image .carousel-indicators li{ | ||
display: inline-block; | ||
width: 120px; | ||
height: 100px; | ||
margin: 1px; | ||
text-indent: 0px; | ||
border: 1px solid #000; | ||
border-radius: 0px; | ||
cursor: pointer; | ||
background-color: #000 \9; | ||
background-color: rgba(0, 0, 0, 0); | ||
background-size: cover; | ||
} | ||
|
||
#base_multi_image .carousel-indicators .active { | ||
/*display: none;*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this (see @yajo useless code comment) |
||
|
||
} | ||
|
||
#base_multi_image .existing-attachment-cell{ | ||
height: 0px; | ||
width: 110px; | ||
margin-left: 5px; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All this line would become more readable/reusable if written into less/sass. Not blocking 😉 |
||
|
||
/*#base_multi_image .thumb-container{ | ||
width: 130px; | ||
float: left; | ||
margin-top: 5px; | ||
}*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not leave useless code around please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
winery?