Before this commit, when the admin had set his unsplash credentials in
the media dialog, he could search for unsplash images in the backend
(website builder, optimize SEO, html fields), but not on the frontend
(from the website_forum reply section for example). This was caused by a
wrong assets management for the media dialog views.
This commit reworks the assets_media_dialog introduced in [1], that were
not correctly defined. Until now, a web_editor.assets_media_dialog
bundle including js, scss and xml files was included in both the
web.assets_frontend and web.assets_backend bundles. It was built that
way, because the frontend only takes the views defined in the
web.assets_frontend bundle.
Two mistakes were made with that approach:
- The views defined in web.assets_backend are not added to the
webclient's templates list. Only the ones defined in web.assets_qweb
are. It was only working because web.assets_qweb was globally taking
every component view, defined as /component/*/*.xml.
- The qweb extensions templates for web_unsplash were defined in
web.assets_qweb (therefore, not included in web.assets_frontend and not
added to the frontend's template list).
To change that and include the web_editor and web_unsplash media dialog
views both for the frontend and the backend, a
web_editor.assets_media_dialog_templates is added, with the xml files
from the web_editor.assets_media_dialog bundle. But this time, this new
views-only bundle is included in web.assets_frontend and
web.assets_qweb.
When the public root's assets management is reworked and when it fetches
the templates from assets_common, these bundles should move to
assets_common, as discussed in [2].
Also, the extension template that adds the unsplash records is reworked:
the t-if is separated from the t-foreach, and set using an id instead of
the qweb instruction that it was using before, as it is more robust.
Finally, the isFetching getter was not set on the unsplash ImageSelector
patch, leading to a visual glitch ("No images found" was displayed while
querying unsplash). It is added in this commit.
task-2687506
[1]: https://github.com/odoo/odoo/pull/89223/commits/a154ee7ad6fd3ebdd38943e1439badae11c3151d
[2]: https://github.com/odoo/odoo/pull/89223#discussion_r895627061
closes odoo/odoo#94572
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
{
|
|
'name': 'Unsplash Image Library',
|
|
'category': 'Hidden',
|
|
'summary': 'Find free high-resolution images from Unsplash',
|
|
'version': '1.1',
|
|
'description': """Explore the free high-resolution image library of Unsplash.com and find images to use in Odoo. An Unsplash search bar is added to the image library modal.""",
|
|
'depends': ['base_setup', 'web_editor'],
|
|
'data': [
|
|
'views/res_config_settings_view.xml',
|
|
],
|
|
'auto_install': True,
|
|
'assets': {
|
|
'web.assets_frontend': [
|
|
'web_unsplash/static/src/js/unsplash_beacon.js',
|
|
],
|
|
'web_editor.assets_media_dialog_templates': [
|
|
'web_unsplash/static/src/components/media_dialog/*.xml',
|
|
],
|
|
'web_editor.assets_media_dialog': [
|
|
'web_unsplash/static/src/components/media_dialog/*.js',
|
|
'web_unsplash/static/src/services/unsplash_service.js',
|
|
],
|
|
},
|
|
'license': 'LGPL-3',
|
|
}
|