website_slides_forum/views/forum_forum_templates.xml

58 lines
3.0 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<odoo><data>
<template name="Split regular forums/courses" id="website_slides_forum_index" inherit_id="website_forum.forum_all" active="True">
<xpath expr="//div[@id='o_wforum_forums_index_list']//*[@t-if='forums']" position="replace">
<t t-if="forums">
<t t-set="courses_discussions" t-value="forums.filtered(lambda f: f.slide_channel_id)"/>
<t t-set="regular_forums" t-value="forums - courses_discussions"/>
<t t-call="website_forum.forum_all_all_entries">
<t t-set="_forums" t-value="regular_forums"/>
</t>
<t t-call="website_forum.forum_all_all_entries">
<t t-set="_forums" t-value="courses_discussions"/>
</t>
</t>
</xpath>
</template>
<template name="Replace Breadcrumb Root" id="website_slides_forum_breadcrumb" inherit_id="website_forum.forum_model_nav" active="True">
<xpath expr="//nav[@id='o_wforum_nav']" position="before">
<t t-if="forum and forum.slide_channel_id" t-set="breadcrumb_kind" t-value="'slides'"/>
</xpath>
<xpath expr="//div[hasclass('o_wforum_breadcrumb_root_single')]" position="inside">
<ol t-if="breadcrumb_kind == 'slides'" class="breadcrumb order-first col-10 col-lg flex-grow-1 flex-nowrap my-0 p-0 fs-5">
<li class="breadcrumb-item">
<a t-attf-href="/slides/#{slug(forum.slide_channel_id)}#{'/' + slug(category) if category else ''}" t-out="forum.name"/>
</li>
<li class="breadcrumb-item text-nowrap">
<a t-attf-href="/forum/#{ slug(forum) }">Forum</a>
</li>
</ol>
</xpath>
<xpath expr="//div[hasclass('o_wforum_breadcrumb_root_list_or_edit')]" position="inside">
<ol t-if="breadcrumb_kind == 'slides'" class="breadcrumb order-first col-10 col-lg flex-grow-1 flex-nowrap my-0 p-0 fs-5">
<li class="breadcrumb-item text-nowrap">
<a t-attf-href="/slides/#{slug(forum.slide_channel_id)}#{'/' + slug(category) if category else ''}" t-out="forum.name"/>
</li>
<li class="breadcrumb-item text-nowrap">
<strong>Forum</strong>
</li>
</ol>
</xpath>
</template>
<template name="Add course badge" id="forum_all_all_entries" inherit_id="website_forum.forum_all_all_entries">
<xpath expr="//t[@t-foreach='sorted_forums']" position="before">
<t t-if="_forums == courses_discussions">
<t t-set="forum_badge">Course</t>
</t>
</xpath>
<xpath expr="//t[@t-foreach='sorted_forums']" position="after">
<div t-if="_forums == courses_discussions" class="d-flex justify-content-center">
<a href="/slides" class="btn btn-link">Check out our courses <i class="fa fa-long-arrow-right"/></a>
</div>
</xpath>
</template>
</data>
</odoo>