Skip to content
Permalink
Browse files

[REF] website_slide: split short from long description in channel model

Purpose of this commit is to provide a better way to display channel information.
Description is split into two fields. A text one, holding the short description
and used in channel header. A long html one, holding more details course
description.

Commit linked to task ID 1941250 and PR #31272.
  • Loading branch information...
tde-banana-odoo committed Feb 20, 2019
1 parent 8866412 commit 22fa2cffb2bf29733eb0810568f6d0b5117e39b7
@@ -4,14 +4,13 @@
<record id="website_slides.channel_public" model="slide.channel">
<field name="name">Basics of Gardening</field>
<field name="channel_type">training</field>
<field name="promote_strategy">latest</field>
<field name="promote_strategy">most_voted</field>
<field name="tag_ids" eval="[(5, 0),
(4, ref('website_slides.slide_channel_tag_level_basic')),
(4, ref('website_slides.slide_channel_tag_role_gardener')),
(4, ref('website_slides.slide_channel_tag_other_0'))]"/>
<field name="image" type="base64" file="website_slides/static/src/img/channel_demo_gardening.jpg"/>
<field name="description" type="html">
<div>Learn the basics of gardening !</div></field>
<field name="description">Learn the basics of gardening !</field>
</record>
<record id="slide_category_demo_0_0" model="slide.category">
<field name="name">Requirements</field>
@@ -34,8 +33,7 @@
<field name="website_published" eval="True"/>
<field name="enroll">public</field>
<field name="image" type="base64" file="website_slides/static/src/img/channel_demo_gardening_2.jpg"/>
<field name="description" type="html">
<div>In this training you will learn how to take care of trees: when to plant, potted trees, ...</div></field>
<field name="description">Learn how to take care of your favorite trees. Learn when to plant, how to manage potted trees, ...</field>
</record>
<record id="slide_category_demo_1_0" model="slide.category">
<field name="name">Interesting Facts</field>
@@ -60,8 +58,7 @@
<field name="website_published" eval="True"/>
<field name="enroll">public</field>
<field name="image" type="base64" file="website_slides/static/src/img/channel_demo_flowers.jpg"/>
<field name="description" type="html">
<div>A lot of nice documentation: trees, wood, gardens. After that you will know everything.</div></field>
<field name="description">A lot of nice documentation: trees, wood, gardens. A gold mine for references.</field>
</record>
<record id="slide_category_demo_2_0" model="slide.category">
<field name="name">Trees</field>
@@ -87,9 +84,8 @@
<field name="website_published" eval="True"/>
<field name="enroll">public</field>
<field name="image" type="base64" file="website_slides/static/src/img/channel_demo_flowers.jpg"/>
<field name="description" type="html">
<div>Knowing which kind of wood to use depending on your application is important. In this course you
will learn the basics of wood characteristics.</div></field>
<field name="description">Knowing which kind of wood to use depending on your application is important. In this course you
will learn the basics of wood characteristics.</field>
</record>
<record id="slide_category_demo_3_0" model="slide.category">
<field name="name">Introduction</field>
@@ -107,9 +103,7 @@ will learn the basics of wood characteristics.</div></field>
<field name="website_published" eval="True"/>
<field name="enroll">invite</field>
<field name="image" type="base64" file="website_slides/static/src/img/channel_demo_furniture.jpg"/>
<field name="description" type="html">
<div>We're also Santa Claus! Belligerent and numerous. I am the man with no name,
Zapp Brannigan! </div></field>
<field name="description">We're also Santa Claus! Belligerent and numerous. I am the man with no name, Zapp Brannigan!</field>
</record>
<record id="slide_category_demo_4_0" model="slide.category">
<field name="name">Introduction</field>
@@ -129,7 +123,7 @@ will learn the basics of wood characteristics.</div></field>
<field name="website_published" eval="True"/>
<field name="enroll">invite</field>
<field name="image" type="base64" file="website_slides/static/src/img/channel_demo_furniture.jpg"/>
<field name="description" type="html"><div>All you need to know about furniture creation.</div></field>
<field name="description">All you need to know about furniture creation.</field>
</record>
<record id="slide_category_demo_5_0" model="slide.category">
<field name="name">Introduction</field>
@@ -74,7 +74,8 @@ def _default_access_token(self):
# description
name = fields.Char('Name', translate=True, required=True)
active = fields.Boolean(default=True)
description = fields.Html('Description', translate=tools.html_translate, sanitize_attributes=False)
description = fields.Text('Short Description', translate=True)
description_html = fields.Html('Description', translate=tools.html_translate, sanitize_attributes=False)
channel_type = fields.Selection([
('documentation', 'Documentation'), ('training', 'Training')],
string="Course type", default="documentation", required=True)
@@ -238,8 +238,8 @@
</template>

<template id="course_content_training" name="Content of a training channel">
<div style="width:70%;" class="d-flex align-items-center ml-4 justify-content-center">
<div class="course-content oe_js_course_slides_list" style="width: 100%">
<div class="col-8 d-flex flex-column ml-4">
<div class="course-content oe_js_course_slides_list w-100 mt8">
<ul>
<t t-set="i" t-value="1"/>
<t t-set="j" t-value="0"/>
@@ -302,6 +302,7 @@
<a class="oe_slide_js_add_section" t-attf-channel_id="#{channel.id}" href="#">Add Section</a>
</div>
</div>
<div t-field="channel.description_html"/>
</div>
</template>

@@ -353,6 +354,7 @@
</t>
</div>
</div>
<div t-field="channel.description_html"/>
</div>
</template>

0 comments on commit 22fa2cf

Please sign in to comment.
You can’t perform that action at this time.