[FIX] website_slides_survey: fix certification share button

Bug
===
In the user profile view, we can see the certifications of the current user.

If we click on the share button, we are redirected to the course instead
of opening the share modal.

Technical
=========
Since 1f52435966 we use an on-lick event to
redirect the user when he click on the card. We use the JS event instead
of an standard anchor because nested anchors are forbidden in HTML.

That cause an issue if we click on a child anchor and if we stay on the
same page (which is the case when we open a bootstrap modal) because the
on-click event will be triggered.

We can not just stop the click propagation otherwise the modal won't be
opened.

Also, as the bootstrap modal element (`website_slides.slide_share_modal`)
is inside the element with the on-click event, so, if we click anywhere
on the modal, we will be redirected...

So, the solution is to open manually the modal, to stop the click
propagation and to move the modal element.

Task-2337693

closes odoo/odoo#59545

X-original-commit: 2a63f98bd359907169d14539feaa99a1d83263f0
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
std-odoo
2020-10-08 16:14:14 +00:00
parent 6aeb905958
commit 406cf8e80d
@@ -26,18 +26,18 @@
<a role="button" class="float-right" t-att-href="'/survey/%s/get_certification' % certificate.survey_id.id">
<i class="fa fa-download" aria-label="Download certification" title="Download Certification"/>
</a>
<a role="button" class="mr-2" href="#" data-toggle="modal"
t-att-data-target="'#slideChannelShareModal_%s' % certificate.slide_id.channel_id.id">
<a role="button" class="mr-2" href="#"
t-attf-onclick="event.stopPropagation(); $('#slideChannelShareModal_#{certificate.slide_id.channel_id.id}').modal('show');">
<i class="fa fa-share-alt" aria-label="Share" title="Share"/>
</a>
</div>
</div>
</div>
<t t-call="website_slides.slide_share_modal">
<t t-set="record" t-value="certificate.slide_id.channel_id"/>
</t>
</div>
</div>
<t t-call="website_slides.slide_share_modal">
<t t-set="record" t-value="certificate.slide_id.channel_id"/>
</t>
</div>
</div>
</t>