[IMP] website_slides_survey: share channel from result page
This commit enables eLearning users to share the channel linked to
certification they cleared directly from the result page.
Notes:
1 - We already have the option to share a certificate from the user info page
or from the slide page, and the same mechanism has been utilised here.
2 - With a recent commit[1], top padding was added to the modal opened on
website front-end to prevent modal overlapping the navbar. But it caused
a side effect on survey result page, where navbar is hidden. So we remove
this top padding on modal for the survey result page.
[1] - https://github.com/odoo/odoo/commit/6ef622772f7d0172553aca6dbce9eb71855460d7
taskId - 2337696
closes odoo/odoo#58104
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Dharmraj Jhala
parent
8883980986
commit
c7f4f6d978
@@ -8,7 +8,7 @@ class Survey(main.Survey):
|
||||
def _prepare_survey_finished_values(self, survey, answer, token=False):
|
||||
result = super(Survey, self)._prepare_survey_finished_values(survey, answer, token)
|
||||
if answer.slide_id:
|
||||
result['channel_url'] = answer.slide_id.channel_id.website_url
|
||||
result['channel_id'] = answer.slide_id.channel_id
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Certification Share modal on survey result page
|
||||
|
||||
/*
|
||||
When website is installed, modal overlaps the navbar. And to fix that,
|
||||
'top' css property has been utilized. As a side-effect, it shows white
|
||||
stripe in some survey related pages (due to hidden navbar).
|
||||
|
||||
So we simply set the 'top' to 0 to for avoiding it for those pages. Thankfully,
|
||||
for such pages, there's a separate asset bundle where we include this file, and
|
||||
so it won't affect the rest of the website pages.
|
||||
*/
|
||||
|
||||
#wrapwrap .modal {
|
||||
top: 0;
|
||||
}
|
||||
@@ -11,5 +11,10 @@
|
||||
<script type="text/javascript" src="/website_slides_survey/static/src/js/slides_certification_upload_toast.js"/>
|
||||
</xpath>
|
||||
</template>
|
||||
<template id="survey_assets" inherit_id="survey.survey_assets" name="Survey Results assets">
|
||||
<xpath expr="//link[last()]" position="after">
|
||||
<link rel="stylesheet" type="text/scss" href="/website_slides_survey/static/src/scss/website_slides_survey_result.scss"/>
|
||||
</xpath>
|
||||
</template>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -2,11 +2,22 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<template id="survey_fill_form_done_inherit_website_slides" inherit_id="survey.survey_fill_form_done">
|
||||
<xpath expr="//div[hasclass('o_survey_finished')]//a[hasclass('btn-primary')][1]" position="after">
|
||||
<t t-if="channel_id">
|
||||
<a role="button" class="mr-2 mt-2 mt-md-0 btn btn-secondary btn-lg" href="#" data-toggle="modal" t-attf-data-target="#slideChannelShareModal_{{channel_id.id}}">
|
||||
<i class="fa fa-share-alt" aria-label="Share certification" title="Share certification"/>
|
||||
Share your certification
|
||||
</a>
|
||||
<t t-call="website_slides.slide_share_modal">
|
||||
<t t-set="record" t-value="channel_id"/>
|
||||
</t>
|
||||
</t>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('o_survey_finished')]/div[last()]" position="after">
|
||||
<div t-if="channel_url" class="mt16">
|
||||
<div t-if="channel_id" class="mt16">
|
||||
<a role="button"
|
||||
class="btn btn-primary btn-lg"
|
||||
t-att-href="channel_url">
|
||||
t-att-href="channel_id.website_url">
|
||||
Go back to course
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user