diff options
| author | David Beguin <dbe@odoo.com> | 2019-07-31 08:31:57 +0000 |
|---|---|---|
| committer | David Beguin <dbe@odoo.com> | 2019-07-31 09:08:44 +0000 |
| commit | b091014686d86ad793e2d1cbf0e7ffea8fbde361 (patch) | |
| tree | 4a95822f1fb6f3a0672db07d7001c06d97dea1e5 | |
| parent | 5bacf72319c1e20b968bf4015ea395fffa2c536f (diff) | |
[FIX] elearning : show only website_published badges in profile
Before, we were adding a card slot for each badge but displaying information on this
slot only if the badge was website_published. This led to empty slots.
Now, we add only the section if the badge is website_published.
Also, the badge count should only display the number of website_published
received badge of the user. As the profile page is only displayed the information
about 'frontend' achievements (elearning and forum) of the user.
Task ID:2045192
PR #35321
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
| -rw-r--r-- | addons/website_profile/views/website_profile.xml | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/addons/website_profile/views/website_profile.xml b/addons/website_profile/views/website_profile.xml index c28712f06ac..458ba979ff8 100644 --- a/addons/website_profile/views/website_profile.xml +++ b/addons/website_profile/views/website_profile.xml @@ -272,7 +272,7 @@ </tr> <tr> <th><small class="font-weight-bold">Badges</small></th> - <td t-if="user.badge_ids" t-esc="len(user.badge_ids)"/> + <td t-if="user.badge_ids" t-esc="len(user.badge_ids.filtered(lambda b: b.badge_id.website_published))"/> <td t-else="">0</td> </tr> </tbody> @@ -362,20 +362,22 @@ <template id="user_badges" name="User Bagdes"> <div t-if="user.badge_ids" class="row mx-n1"> - <div class="col px-1 mb-2 col-xl-4" t-foreach="user.badge_ids" t-as="badge"> + <t t-foreach="user.badge_ids" t-as="badge"> <t t-if="badge.badge_id.website_published"> - <div class="card"> - <div class="card-body p-2 pr-3"> - <div class="media align-items-center"> - <img height="38" t-attf-src="/web/image/gamification.badge/#{badge.badge_id.id}/image_small" class="mr-2"/> - <div class="media-body text-nowrap"> - <h6 class="my-0" t-field="badge.badge_id.name"/> + <div class="col px-1 mb-2 col-xl-4"> + <div class="card"> + <div class="card-body p-2 pr-3"> + <div class="media align-items-center"> + <img height="38" t-attf-src="/web/image/gamification.badge/#{badge.badge_id.id}/image_small" class="mr-2"/> + <div class="media-body text-nowrap"> + <h6 class="my-0" t-field="badge.badge_id.name"/> + </div> </div> </div> </div> </div> </t> - </div> + </t> </div> <div class="mb-3" t-if="not user.badge_ids"> <p class="text-muted">No badge yet</p> |
