[IMP] website_slides: allow course to have prerequisites
This commit allows the course manager to add prerequisites courses to a course so that the final user will be notified on the frontend he has to take some courses before the one he wants. He could however request access to the course and take it without taking the prerequisites before if the access has been granted. Task-3213628 closes odoo/odoo#114710 Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
@@ -58,7 +58,7 @@ publicWidget.registry.websiteSlidesEnroll = publicWidget.Widget.extend({
|
||||
_openDialog: function (channelId) {
|
||||
new SlideEnrollDialog(this, {
|
||||
channelId: channelId,
|
||||
$element: this.$el
|
||||
$element: this.$el.closest('.alert')
|
||||
}).open();
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { qweb } from 'web.core';
|
||||
import publicWidget from 'web.public.widget';
|
||||
|
||||
publicWidget.registry.websiteSlidesCoursePrerequisite = publicWidget.Widget.extend({
|
||||
selector: '.o_wslides_js_prerequisite_course',
|
||||
|
||||
async start() {
|
||||
await this._super(...arguments);
|
||||
const channels = this.$el.data('channels');
|
||||
this.$el.popover({
|
||||
trigger: 'focus',
|
||||
placement: 'bottom',
|
||||
container: 'body',
|
||||
html: true,
|
||||
content: qweb.render('slide.course.prerequisite', {channels: channels}),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default {
|
||||
websiteSlidesCoursePrerequisite: publicWidget.registry.websiteSlidesCoursePrerequisite
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates>
|
||||
<t t-name="slide.course.prerequisite">
|
||||
<ul class="m-0 ps-3">
|
||||
<li t-foreach="channels" t-as="channel" t-key="channel.course_id">
|
||||
<a t-attf-href="/slides/#{channel.course_id}" t-out="channel.course_name"/>
|
||||
</li>
|
||||
</ul>
|
||||
</t>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user