* = website_profile, website_slides
Before this commit, the returned Content-Type was not always correct, for
example if the image tool was changing the format, which happens when given
a BMP (converted to PNG), or other types being converted to JPEG.
The previous method `force_contenttype` was too specific and it wasn't available
in every controller. It didn't even need to be a controller method because it
didn't use self.
Now we create a generic helper to ease updating headers.
The Content-Type is only updated when it is safe to do. It is especially unsafe
for example for SVG files.
task-1958000
PR: #31811
* = 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
* = website_partner, website_profile, website_sale, website_slides
Before
======
Since commit: 2e3848b394
The images that are resized have additional borders if the target ratio is
different than the image ratio. Those borders are transparent if the image
format supports it, and are white otherwise.
With that current solution, if the background where the image is displayed is
another color than white, it is looking really bad.
Moreover, most images are stored resized like this, so it is not even possible
to decide if it should have borders or not depending on the context, the
original image and ratio is forever lost.
It is also inconsistent because if the image is already smaller than the target
size then it doesn't include borders. In that case it keeps the original ratio
instead of the target ratio. So it isn't even guaranteed that the target
ratio is going to be respected.
After
=====
This commit will solve all of those problems by always keeping the ratio of the
original image.
This implies the views should be taking care of adding borders when necessary.
task-1958000
PR: #31811
There is a mix in the variable names: before this commit, what is called
`image_base64` is actually not base64 encoded, and what is called `content` is
actually base64 encoded.
The variables have been renamed to avoid further confusion.
task-1958000
PR: #31811
Notably
* remove cdata and fix html code when necessary;
* re-order fields declaration to have globally the same order in various
template definition;
* remove unnecessary reply-to, make user signature and auto delete fields
explicit when necessary;
* improve some name to ease template ordering and understanding in the
template list view;
Related to task 1972615
Linked to PR #32872
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose: use more email_formatted when possible, clean and simplify
email_from, email_to and partner_to computation.
Next step is to try to extract some common patterns in tools or methods in
order to simplify template creation and customization.
Related to task 1972615
Linked to PR #32872
Improve the email validation banner and allow adding custom classes when
calling its templates. Also improve top banner design as well as navigation
and tabs.
Finally perform some minor tweaks on design.
Commit linked to task ID 1941250 and PR #31977
- Fix certification card in user's profile page
Since design review, certification card were not displaying well.
This commit applies the course card template on certification card
and modifies the way the certification get downloaded by calling directly the
controller instead of using class catched in javascript that calls afterward the
controller.
- Allow review button only if allow_comment in FS mode + redirect url
'write a review' button in fullscreen mode must not be displayed if the course
is not in allow_comment mode. Also, the url if this button was redirecting
to slide view in non fullscreen mode. As no review can be done from this point,
the url redirect now to the course view.
- Fix fullscreen slide height.
- Fix all slides view per category pager and page rendering
Since the introduction of categorized data dictionnary that is given to the template,
if a category is empty, it's rendered anyway, which is good for publisher,
to quickly see all existing categories.
But other users should not see those empty categories.
Also, if the slides from a course are filtered (with View all button) by category,
all the slides should be reachable, using the pager. This was not the case as
categorized slides dictionnary returned no slides if page <= 2.
(as bound of array was from offset to limit and offset and limit were equals)
The number of slides per category must be overwritten if search category is activated,
to see more than the 4 first slides of the category.
Finally, if search category is activated, only the target category should be displayed,
and not the others, for performance reason.
- Show 'not verified' next to user's name if user karma = 0
Instead of using the email_validation_done flag. As email validation is only used
to offer the user some karma in order to be able to interact in the forum or eLearning.
If the user already has karma, he is already considered as active and 'verified'
- Correct URL of certification in FS mode
Task ID : 1941250
Closes PR #31567
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Merge ranks & badges pages. This commit adapt the final page
layout, controllers and templates.
Added the badge category filter. If used in url parameter, hide ranks and show
only the badge part of the page, filtered on matching badge_category.
Task ID : 1941250
PR #31567
Co-authored-by: @stefanorigano
Co-authored-by: @dbeguin
This commit adds the search bar in 'All users' page in order to filter on name or company name.
To be able to keep the position, a non stored computed field has been added on res_users
to get the position depending on the user's karma.
The podium (top 3 users) is now displayed only if there is no search applied and if the page = 1
because it has no sens anymore in other cases.
Special thanks to @jem-odoo who helped me finding smart solution for position computing.
Task ID : 1943788
PR #31321
Email validation was necessary on the forum to be able to begin to use the forum
(ask or answer questions, vote, etc..)
As the new elearning also uses karma since 705376a982,
the email validation is now also necessary in the eLearning platform.
This is why this commit is moving the email validation process to website_profile
and extend website_slides (eLearning) and website_forum to use this feature.
In function of where the user asked to send him the validation email,
the user is redirected on the forum or on the elearning when he clicks on
'Validate my account' in the received 'email validation' email.
Task ID : 1943788
PR #31321
If there are too much users to show on the page and to avoid performance
issues, a pager is now applied on the all users page.
A new pager based on website_pager is added in order to ease the navigation
through the potential high number of pages. 'Go to first page' and 'Go to last
page' buttons have been added and the design of the pager have been adapted
to be more integrated into the new eLearning platform.
Also add the pager on the slide page if search category is applied. The pager
was already computed in the controller but not displayed.
Task ID : 1946160
PR #31697
If a new user try to access the elearning platform or his porfile, if he has
no karma, has it is the case for new users, he won't get any rank. So that
the next rank karma minus current rank karma equals zero.
To avoid this, next_rank will always be first one existing if the user has no
karma. Also, the current rank will not be displayed if the user has no karma.
finally, next rank will not be displayed if the user reached the last existing
rank.
Task ID : 1941250
PR #31512
Badges that should be displayed on user's profile page must be website
published. Badges that are website_published are typically forum badges or
others that will be configured for eLearning.
Task ID : 1941250
PR #31512
Purpose is to perform a cleaning pass on website_profile templates. It
cleans the DOM, templates and CSS and proposes various improvements on
general design and layouting. This includes notably
* lessen custom CSS and use bootstrap 4 classes;
* simplify layout when possible;
* make is responsive and mobile friendly;
No functional changes should occur with this commit.
Sub modules are impacted as profile is extended in various other
applications: eLearning, forum and certification.
Commit linked to task ID 1941250 and PR #31453
Purpose of this commit is to add a circular progress around the rank of
a user when seing its profile. It allows to see at a glance advance for
next karma rank.
Commit linked to task ID 1941250 and PR #31317.
The main condition to be able to see a profile is that the user we want to
see the profile is website_published.
But if a new user sign up and wants to access his own profile, he must
get access to his own profile, even if he is (not yet) website_published.
Commit linked to task ID 1941250 and PR #31279.
As the eLearning (website_slides) is also using website_profile users,
the All Users page is moved from website_forum to website_profile, to be
useable in both forum and eLearning.
This page displays also the number of karma point, badges and certificates
of each user.
The users are sorted by their karma points and the first 3 users are
promoted on a podium.
Use span instead of b tag in profile page
Task ID : 1922159
PR #31109
Since 556b6454dab07cdf716d404ec0db9aa51a09b165, channel can be linked to a dedicated forum.
But the link could only be done in backend, in the slide.channel configuration
For now on, website_publishers can create a new dedicated forum when they create
a new slide.channel.
Link buttons have been added in both forum and slide.channel headers to navigate easily
between them.
Fix the relation between course and forum in a model point of view.
Task ID : 1922159
PR #31109
Purpose of this commit is to improve karma and gamification inclusion in
elearning [1].
* remove a border, replaced by a standard hr, in rank template. It allows to
reuse it easier as we don't necessarily want that border in other templates
using it;
Commit linked to task ID 1941250 and PR #31133.
[1] task ID 1922159 (landed at 5fa651cb01)
Purpose of this commit is to
* clean user avatar controller and its calls;
* extract default image computation;
* add a controller to get slide image even when not having access to the slide
as all slide name and images are displayed even if not available to the
current user;
Commit linked to task ID 1941250 and PR #31133.
Purpose of this commit is to give a specific route to access users image
used as avatar in profile and various frontend applications.
Indeed current web/image controller basically checks record access rights
with current user. However in some cases we want to display user avatars
even if current user cannot read user records, which is generally the case.
Indeed res.users is a private and technical model.
To solve that issue we add a controller for avatar. Basically published
and frontend active user avatars are available.
This commit is linked to task ID 1936153 and PR #30770.
Since 56645335b7, when a user get a badge,
an email is sent. The subtype is not used anymore, so the alert
mecanism in forum to display a message to the user to show him
his new badges can not work.
This commit removes this dead code.
Task-1922159
Move Profile part from website_forum into this module in order to be usable in other modules
(like website_slides) that will depend of this module.
Applies gamification.ranks on website_profile page. Show the current rank and the next rank
but also the progression until the next rank. Adds also an 'about rank' page to allow users to know
more about available ranks.
The goal here is to make the profile page more modular and to allow other modules to add informations
or modify easily link or part of profile page in order to be specifically contextualised
for the module in question.
Task ID : 1922159
PR #30988
Purpose is to be able to re-use frontend-related model, data and tools
for gamification. Currently only forum uses gamification. Soon slides module
will use them and user profile / biography will be expanded. This commit
prepares those features by already preparing the bridge module and adding
a publish option on badges.
Partial commit linked to eLearning project. Main specifications related
to gamification and user profile can be found on task 1922159 (PR #30514).
Main specifications related to eLearning can be found on task 1902304
(PR #29876).
Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>