* = hr, im_livechat, mail, payment, purchase, web, web_editor, web_unsplash,
website_profile, website_slides
Since the merge of all image tools into one function, the intermediary functions
are not needed anymore.
task-1958000
PR: #31811
This commit introduces the possibility to resize and to select the quality when
optimizing an image for web.
This will be used by the media dialog in a future commit.
The arbitrary resolution limit of 42e6 has been increased to 45e6 to fit some
of the biggest images we might get from Unsplash, and this value has been moved
into a variable so it can be customized.
The mimetype computation has been moved after the image processing because in a
next commit the operation could return the image in a different format than what
was originally given. Eg. BMP -> PNG, or unsupported format -> JPEG.
task-1958000
PR: #31811
Issue: wysiwyg asset slow down the loading of the website, error
inadvertently introduced: https://github.com/odoo/odoo/pull/29775
The assets are now loaded assynchroneously, when the editor is needed,
its assets will be loaded.
closesodoo/odoo#30700
* account, auth_signup, payment, portal, project, sale, sale_management,
web_unsplash, website, website_mail, website_rating, website_sale
This commit does probably not do what is stated for all non-website apps
but it is a first step. It also uses the system in apps which could have
already used it but did not.
Part of https://github.com/odoo/odoo/pull/29442
task-1932066
* web_unsplash, website_sale
- Visual improvements and cleaning in each tab: video, documents,
pictogram, images.
- Only one search input for both the local library and unsplash.
- Replace the idea of multiple pages by adding a 'Load More' button.
task-1896705
* auth_password_policy_signup, auth_signup, website, portal, survey,
web_unsplash, website
Following the new editor's merge at https://github.com/odoo/odoo/pull/29775
web_editor.base has been moved to website while it was still used by
frontend pages which do not depend on website (especially portal).
This commit moves web_editor.base to portal while waiting for
https://github.com/odoo/odoo/pull/29442. It also removes the unnecessary
dependencies to it in non-portal pages (in survey for example).
* Creating a new structure by transforming all the plugins in the
library using the odoo inheritance system. Plugins are easier to
implement with the AbstractPlugin to add Odoo behaviors.
* From now on, the methods of the library (in this case Summernote) can
no longer be called by other modules or files. Only the wysiwyg
widgets can access it, to simplify the updating process. The wysiwyg
object serves as an interface.
* Depending on the options the snippets will be loaded or not, the
editor will be in an iframe or not... all of this is transparent from
the outside.
* Regarding iframes, all controllers related to editing have been
removed: the new API no longer needs them. This speeds up loading,
eases testing and removes complexity for the same
features.
PUBLIC FEATURES
There are several public methods on the Wysiwyg class:
* Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the
library (xml, lazy, assets...) is loaded.
* Wysiwyg.getRange (DOM): returns the range (selection in the dom)
* Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates
a range (selection in the dom)
* Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an
element (option available to select all, start or end)
A jQuery selector was added: :o_editable, which indicates whether the
current element is editable. That is, if it is contained in a tag with
the attribute 'contentEditable = "true"' or in a tag with the class
o_editable.
Several methods are also present:
* focusIn: makes a focus and places the cursor at the beginning of the
element
* focusInEnd: makes a focus and places the cursor at the end of the
element
* selectContent: makes a focus and selects the content
HTML FIELD
The HTML field can receive different options:
* style-inline: {boolean} transforms a class into an inline style when
saving and vice versa when reading.
* no-attachment: {boolean} prevents the use of attachments (in media
dialog)
* cssEdit: {xml_id} to use a template containing the css to loaded in
an iframe when editing
* cssReadonly: {xml_id} to use a template containing the css to load
into an iframe when viewing in readonly
* snippets: {xml_id} snippets template (can be used with or without
cssEdit)
* wrapper: {template} qweb static template (containing a tag:
id = "wrapper") that will include the content during editing (removed
on save)
MASS MAILING
A widget was created for mass mailing. There are now two fields:
body_html and body_arch.
body_arch contains the code with the class without conversion into
inline style, useful when editing and one with the inline style that is
visible in readonly mode and sent by email.
Advantage: no spreading errors, able to update css/theme, able to do
more changes when converting to inline style so that a maximum of mail
clients have an impeccable rendering.
Co-authored-by: Antoine Guenet <age@odoo.com>
Go on the website, create a new product from there
Click on the image to change it, select an unsplash image
Save your product.
Beforer this commit, the image wasn't saved because the qweb field image
did not know what to do with /unsplash/ urls
After this commit, the image is saved on the product (or any object...)
OPW 1936191
closesodoo/odoo#31328
Before this commit:
An unsplash image would be saved as an attachement with:
- A name like 'x54ze78z.JPEG'
- An url like '/unsplash/x54ze78z.JPEG'
- A filename like 'x54ze78z.JPGED'
We would not store the searched terms in the name/url.
Then, we would not be able to search on local attachement in the media dialog
to retrieve the images based on what we searched.
Now:
We store the searched terms in the name/url so it can be used later in the
media dialog search:
- Name like 'big_lion.jpg' (duplicates may be possible)
- Url like '/unsplash/x54ze78z/big_lion.jpg'
- Filename like 'unsplash_x54ze78z_big_lion.jpg'
Task-1911345
Unsplash CEO asked us to stop exposing our key client side (even if it was
only in the browser network and previously allowed by their API team leader).
After multiple exchange, it has been negociated that:
1. Our non saas user won't be able to apply for a production key and should
prefix they Unsplash application name by 'Odoo:'. Their key will remain in
test mode.
Indeed, Unsplash won't be able to review every Odoo application and ensure
it respects the API terms and it is a real application.
2. Our saas user will query Unsplash with a dedicated enterprise key
3. The documentation should explain it all
Task-1911345
As empty arrays are considered truthy, the call to `/web_unsplash/get_app_id`
would always be performed even if no Unsplash images.
closesodoo/odoo#28421
Doc links were created before the doc, then the doc was merged under a
different URL.
This commit corrects the links to the Unsplash documentation.
closesodoo/odoo#28355
Unsplash API requirements does not directly allow to store their images on
our server (We should use hotlinking unless the image is edited (cropped etc)).
Still, they have the `Image Beacon Alternative` to allow to store their images
on our server if we really need it with our use case.
With the Beacon Alternative, we should ping Unsplash server to notify an image
view.
To do so, we need to be able to recognize Unsplash imagesin the DOM, this is
why we are now using /unsplash/ in the URL.
The Unsplash image name should be the image ID as it will be the identifier
needed to ping their server.
This commit also adds credit to Unsplash in the media dialog next to the
unsplash input search.
It also add the `w-100` on the media dialog card as we lost that UI behavior
from BS3 to BS4.
opw-35060
closesodoo/odoo#27377