Skip to content
Snippets Groups Projects
Commit f029bf71 authored by David Beguin's avatar David Beguin Committed by Thibault Delavallée
Browse files

[IMP] website_slides_forum : allow to create a forum and to comment on course frontend creation

When creating a course via the frontend, the behaviour with forum and comment
should be the same than from backend. The website_publisher can decide to
create or not a forum linked to this course and decide independantely to allow
the review and comment on that course.

Commit linked to task ID 1941250 and PR #31584.
parent 47b308d8
No related branches found
No related tags found
No related merge requests found
......@@ -8,15 +8,12 @@ from odoo.addons.website_slides.controllers.main import WebsiteSlides
class WebsiteSlidesForum(WebsiteSlides):
def _slide_channel_prepare_values(self, **kwargs):
communication_type = kwargs.get('communication_type')
channel = super(WebsiteSlidesForum, self)._slide_channel_prepare_values(**kwargs)
if communication_type:
if communication_type == 'forum':
forum = request.env['forum.forum'].create({
'name': kwargs.get('name')
})
channel['forum_id'] = forum.id
channel['allow_comment'] = communication_type == 'comment'
if bool(kwargs.get('link_forum')):
forum = request.env['forum.forum'].create({
'name': kwargs.get('name')
})
channel['forum_id'] = forum.id
return channel
# Profile
......
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-extend="website.slide.channel.create">
<t t-jquery=".o_wslide_channel_communication_type" t-operation="replace">
<fieldset id="channel_create_forum" class="form-group">
<div class="row">
<legend class="col-form-label col-sm-2">Communication</legend>
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="radio" name="communication_type" id="communication_type1" value="nothing" checked="checked"/>
<label class="form-check-label" for="communication_type1">
No communication
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="communication_type" id="communication_type2" value="forum"/>
<label class="form-check-label" for="communication_type2">
Create a Forum
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="communication_type" id="communication_type3" value="comment"/>
<label class="form-check-label" for="communication_type3">
Allow comments
</label>
</div>
<t t-jquery=".o_wslide_channel_communication_type" t-operation="after">
<div class="form-group row">
<div class="col-sm-2">Communication</div>
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="link_forum" name="link_forum"/>
<label class="form-check-label" for="link_forum">Create a Forum</label>
</div>
</div>
</fieldset>
</div>
</t>
</t>
</templates>
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