Permalink
Browse files

[IMP] website_slides_survey : adds certifications in website profile …

…page
  • Loading branch information...
dbeguin committed Feb 11, 2019
1 parent 12fcb9a commit 8bd2e5a561d3cb6d5b1eff10c8eaba02572decef
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import controllers
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': "website_slides_survey",
'summary': 'Add certification capabilities to your courses',
'description': """This module lets you use the full power of certifications within your courses.""",
'category': 'Hidden',
'version': '0.1',

'depends': ['website_slides', 'survey'],
'installable': True,
'auto_install': True,
'data': [
'views/website_profile.xml',
],
}
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import main
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo.http import request
from odoo.addons.website_slides.controllers.main import WebsiteSlides


class WebsiteSlidesSurvey(WebsiteSlides):
# Profile
# ---------------------------------------------------
def _prepare_open_slide_user(self, user):
values = super(WebsiteSlidesSurvey, self)._prepare_open_slide_user(user)

survey_done = request.env['survey.user_input'].sudo().search(['&', ('partner_id', '=', user.partner_id.id), ('state', '=', 'done')])
certificates = survey_done.filtered(lambda s: s.survey_id.certificate)

values.update({
'certificates': certificates,
})
return values
@@ -0,0 +1,26 @@
// Certification Card
.o_wprofile_slides_certif_card_body {
max-height: 64px;
.o_wprofile_slides_certif_img {
position: absolute;
padding: 0px;
top: 8px;
left: 8px;
width: 66px;
height: 66px;
}
.o_wprofile_slides_certif_score {
position: absolute;
right: 32px;
top: 13px;
}
.o_wprofile_slides_certif_actions {
position: absolute;
bottom: 0px;
right: 32px;
a {
margin-left: 8px;
color: grey;
}
}
}
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="assets_frontend" inherit_id="website.assets_frontend">
<xpath expr="link[last()]" position="after">
<link rel="stylesheet" type="text/scss" href="/website_slides_survey/static/src/scss/website_profile.scss"/>
</xpath>
</template>

<template id="user_detail_content" inherit_id="website_profile.user_detail_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 class="o_wprofile_slides_certif_img">
<img class="o_img_small mb-3" t-attf-src="/web/image/survey.user_input/#{certificate.id}/image_small"/>
</div>
<div class="col-10 o_wprofile_slides_title">
<b t-field="certificate.survey_id.title"/>
</div>
<div class="float-right" t-if="user.id == uid">
<div class="row o_wprofile_slides_certif_score">
<span>Score : <b t-field="certificate.quizz_score"/>%</span>
</div>
<div class="row o_wprofile_slides_certif_actions">
<a href=""><i class="fa fa-download"/></a>
<a href=""><i class="fa fa-share-alt"/></a>
</div>
</div>
</div>
</div>
</div>
</div>
</t>
<t t-else="">
<b>No certifications yet!</b>
</t>
</template>
</data>
</odoo>

0 comments on commit 8bd2e5a

Please sign in to comment.