Skip to content
Snippets Groups Projects
Commit 5125eecc authored by David Beguin's avatar David Beguin
Browse files

[IMP] website_slides_survey : add certifications in website profile page

For users viewing their own profile page on the website,
a new section 'Certifications' is added to the about tab.
Thoses certifications are the survey that activated certificate.

Task ID : 1922159
PR #31109
parent 3ab9f1d8
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
from . import controllers
......@@ -6,7 +6,6 @@
'description': """This module lets you use the full power of certifications within your courses.""",
'category': 'Hidden',
'version': '0.1',
'depends': ['website_slides', 'website_survey'],
'installable': True,
'auto_install': True,
......@@ -17,6 +16,7 @@
'views/website_slides_templates.xml',
'views/website_slides_templates_homepage.xml',
'views/survey_templates.xml',
'views/website_profile.xml',
'data/gamification_data.xml',
],
'demo': [
......
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import main
from . import slides
......
......@@ -47,3 +47,21 @@ class WebsiteSlides(WebsiteSlides):
result['certification_url'] = user_input._get_survey_url()
return result
# Profile
# ---------------------------------------------------
def _prepare_user_slides_profile(self, user):
values = super(WebsiteSlides, self)._prepare_user_slides_profile(user)
values.update({
'certificates': self._get_user_certificates(user),
})
return values
def _get_user_certificates(self, user):
domain = [
('partner_id', '=', user.partner_id.id),
('quizz_passed', '=', True),
('slide_partner_id.survey_quizz_passed', '=', True)
]
certifications = request.env['survey.user_input'].sudo().search(domain)
return certifications
// Certification Card
.o_wprofile_slides_certif_card_body {
height: 66px;
> div > div:first-child {
position: absolute;
padding: 0px;
top: 8px;
left: 8px;
width: 66px;
height: 66px;
}
> div > div:nth-child(3) > span {
position: absolute;
right: 32px;
top: 13px;
}
> div > div > div:nth-child(2) {
position: absolute;
bottom: 0px;
right: 32px;
a {
margin-left: 8px;
color: grey;
}
}
}
......@@ -5,8 +5,8 @@
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/website_slides_survey/static/src/js/slides_upload.js"/>
<script type="text/javascript" src="/website_slides_survey/static/src/js/slides_certification_download.js"/>
<link rel="stylesheet" type="text/scss" href="/website_slides_survey/static/src/scss/website_profile.scss"/>
</xpath>
</template>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo><data>
<template id="user_profile_content" inherit_id="website_profile.user_profile_content">
<xpath expr="//div[@id='profile_about_badge']" position="before">
<t t-if="channel">
<div class="mb32">
<h4><i class="fa fa-trophy"/> Certifications</h4>
<t t-call="website_slides_survey.display_certificate"/>
</div>
</t>
</xpath>
</template>
<template id="display_certificate">
<t t-if="certificates">
<div class="row">
<div class="col-lg-6 o_wprofile_slides_card" t-foreach="certificates" t-as="certificate">
<div class="card-body o_wprofile_slides_certif_card_body o_wprofile_bb_grey">
<div class="row">
<div><img class="o_wprofile_img_small" t-attf-src="/web/image/slide.slide/#{certificate.slide_id.id}/image_small"/></div>
<div class="col-10 o_wprofile_slides_title">
<span class="font-weight-bold" t-field="certificate.survey_id.title"/>
</div>
<div class="float-right" t-if="user.id == uid">
<span class="row">Score : <b t-field="certificate.quizz_score"/>%</span>
<div class="row">
<a role="button"
t-att-data-survey_id="certificate.survey_id.id"
class="o_wslides_survey_download_certification"
href="#">
<i class="fa fa-download"/>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</t>
<t t-else="">
<b>No certifications yet!</b>
</t>
</template>
</data></odoo>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment