Files
odoo_source/addons/website_slides/views/slide_slide_views.xml
T
Thibault Delavallée 924ca810ef [IMP] website_slides: add views and access for slide progress
Purpose of this commit is to have access to slide.slide.partner model that
holds member progress on specific slide. It is used notably to build completion
on slide.channel.partner or to store vote data. It is interesting to have
access to it to have some detailed informations.

It is now reachable through the "attendees" smart button that replaces the
'views' button. Public / other views are moved in slide details as those
buttons do not add much to the slide usability.

Task-2607416

Part-of: odoo/odoo#74171
2022-02-28 11:07:38 +00:00

437 lines
27 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- SLIDE.TAG -->
<record id="view_slide_tag_form" model="ir.ui.view">
<field name="name">slide.tag.form</field>
<field name="model">slide.tag</field>
<field name="arch" type="xml">
<form string="Tag">
<sheet>
<group>
<field name="name"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_slide_tag_tree" model="ir.ui.view">
<field name="name">slide.tag.tree</field>
<field name="model">slide.tag</field>
<field name="arch" type="xml">
<tree string="Tags" editable="bottom">
<field name="name" placeholder="e.g 'HowTo'"/>
</tree>
</field>
</record>
<record id="action_slide_tag" model="ir.actions.act_window">
<field name="name">Content Tags</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">slide.tag</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a Content Tag
</p>
<p>
Use Content Tags to classify your Content.
</p>
</field>
</record>
<!-- SLIDE.SLIDE -->
<record id="view_slide_slide_form" model="ir.ui.view">
<field name="name">slide.slide.form</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<form string="Lesson">
<sheet>
<field name="channel_type" invisible="1" readonly="1"/>
<field name="channel_allow_comment" invisible="1" readonly="1"/>
<div class="oe_button_box" name="button_box">
<button name="%(slide_slide_partner_action_from_slide)d"
class="oe_stat_button" type="action" icon="fa-graduation-cap"
attrs="{'invisible': [('slide_views', '=', 0)]}">
<span class="o_stat_value">
<field name="slide_views" widget="statinfo" nolabel="1"/> Attendees
</span>
</button>
<button disabled="1" icon="fa-thumbs-up" class="oe_stat_button oe_read_only"
attrs="{'invisible': ['|', ('channel_type', '=', 'training'), ('likes', '=', 0)]}">
<span class="o_stat_value" >
<field class="ml-1" name="likes" widget="statinfo" nolabel="1"/> Likes
</span>
</button>
<button disabled="1" icon="fa-thumbs-down" class="oe_stat_button oe_read_only"
attrs="{'invisible': ['|', ('channel_type', '=', 'training'), ('dislikes', '=', 0)]}">
<span class="o_stat_value">
<field class="ml-1" name="dislikes" widget="statinfo" nolabel="1"/> Dislikes
</span>
</button>
<button disabled="1" icon="fa-comments" class="oe_stat_button oe_read_only"
attrs="{'invisible': ['|', ('channel_allow_comment', '!=', True), ('comments_count','=', 0)]}">
<span class="o_stat_value">
<field class="ml-1" name="comments_count" widget="statinfo" nolabel="1"/> Comments
</span>
</button>
<button name="action_view_embeds" class="oe_stat_button" type="object" icon="fa-share-alt"
attrs="{'invisible': [('embed_count', '=', 0)]}">
<div class="o_stat_info">
<field name="embed_count"/>
<span class="o_stat_text">Embed Views</span>
</div>
</button>
<field name="is_published" class="ml-1" widget="website_redirect_button"
attrs="{'invisible': ['|',('is_category', '=', True), ('channel_id', '=', False)]}"/>
</div>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="image_1920" widget="image" class="oe_avatar" options='{"preview_image": "image_256"}'
attrs="{'invisible': [('is_category', '=', True)]}"/>
<div class="oe_title pr-xl-0">
<div>
<label for="name" string="Content Title"/>
</div>
<h1>
<field name="name" default_focus="1" placeholder="e.g. Setting up your computer" class="mr-0"/>
<field name="is_category" invisible="1"/>
</h1>
<field name="tag_ids" attrs="{'invisible': [('is_category', '=', True)]}" widget="many2many_tags" placeholder="Tags..."/>
</div>
<notebook attrs="{'invisible': [('is_category', '=', True)]}">
<page name="document" string="Document">
<group>
<group name="lesson_details">
<field name="active" invisible="1"/>
<field name="channel_id"/>
<field name="slide_category" string="Content Type"/>
<field name="slide_type" invisible="1"/>
<div class="text-muted" colspan="2" attrs="{
'invisible': [('slide_category', '!=', 'quiz')]}">
You can add questions to this quiz in the 'Quiz' tab.
</div>
<label for="source_type" string="" attrs="{
'invisible': [('slide_category', 'not in', ['infographic', 'document'])]}"/>
<field name="source_type" widget="radio" nolabel="1" attrs="{
'invisible': [('slide_category', 'not in', ['infographic', 'document'])]}" />
<field name="video_url" attrs="{
'required': [('slide_category', '=', 'video')],
'invisible': [('slide_category', '!=', 'video')],
'readonly': [('slide_category', '!=', 'video')]}"
placeholder='e.g "www.youtube.com/watch?v=ebBez6bcSEc"'
widget="url"/>
<field name="document_google_url" attrs="{
'invisible': ['|', ('source_type', '!=', 'external'), ('slide_category', '!=', 'document')],
'readonly': ['|', ('source_type', '!=', 'external'), ('slide_category', '!=', 'document')]}"
placeholder='e.g "https://drive.google.com/file/..."'
widget="url"/>
<field name="image_google_url" attrs="{
'invisible': ['|', ('source_type', '!=', 'external'), ('slide_category', '!=', 'infographic')],
'readonly': ['|', ('source_type', '!=', 'external'), ('slide_category', '!=', 'infographic')]}"
placeholder='e.g "https://drive.google.com/file/..."'
widget="url"/>
<field name="document_binary_content" string="" options="{'accepted_file_extensions': '.pdf'}"
attrs="{
'invisible': ['|', ('source_type', '=', 'external'), ('slide_category', '!=', 'document')],
'readonly': ['|', ('source_type', '=', 'external'), ('slide_category', '!=', 'document')]}"/>
<field name="image_binary_content" string="" options="{'accepted_file_extensions': 'image/*'}"
attrs="{
'invisible': ['|', ('source_type', '=', 'external'), ('slide_category', '!=', 'infographic')],
'readonly': ['|', ('source_type', '=', 'external'), ('slide_category', '!=', 'infographic')]}"/>
</group>
<group name="related_details">
<field name="user_id" string="Responsible" widget="many2one_avatar"/>
<label for="completion_time"/>
<div>
<field name="completion_time" widget="float_time" class="oe_inline"/>
<span> hours</span>
</div>
<field name="slide_resource_downloadable" attrs="{'invisible': ['|', ('slide_category', '!=', 'document'), ('source_type', '!=', 'local_file')]}"/>
<field name="date_published" string="Published Date" attrs="{'invisible': [('date_published', '=', False)]}" groups="base.group_no_one"/>
<field name="is_preview"/>
<field name="public_views"/>
<field name="total_views"/>
</group>
</group>
</page>
<page name="description" string="Description">
<field name="description" placeholder="e.g. In this video, we'll give you the keys on how Odoo can help you to grow your business. At the end, we'll propose you a quiz to test your knowledge."/>
</page>
<page string="Additional Resources" name="external_links" >
<group>
<field name="slide_resource_ids" widget="one2many" nolabel="1">
<tree editable="top">
<field name="resource_type"/>
<field name="name" required="1"/>
<field name="file_name" invisible="1"/>
<field name="data" attrs="{'readonly': [('resource_type', '=', 'url')]}" filename="file_name"/>
<field name="link" string="Link"
attrs="{'readonly': [('resource_type', '=', 'file')],'required': [('resource_type', '=', 'url')],}"/>
</tree>
</field>
</group>
</page>
<page name="quiz" string="Quiz">
<group name="quiz_details">
<group name="quiz_rewards" string="Points Rewards">
<group>
<field string="First Try" name="quiz_first_attempt_reward"/>
<field string="Second Try" name="quiz_second_attempt_reward"/>
<field string="Third Try" name="quiz_third_attempt_reward"/>
<field string="Fourth Try &amp; More" name="quiz_fourth_attempt_reward"/>
</group>
</group>
<group name="questions">
<field name="question_ids" nolabel="1">
<tree>
<field name="sequence" widget="handle"/>
<field name="question" string="Question"/>
<field name="answer_ids" string="Answers" widget="many2many_tags"/>
</tree>
</field>
</group>
</group>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
<record id="view_slide_slide_form_wo_channel_id" model="ir.ui.view">
<field name="name">slide.slide.form.wo.channel_id</field>
<field name="model">slide.slide</field>
<field name="inherit_id" ref="view_slide_slide_form"/>
<field name="priority" eval="50"/>
<field name="mode">primary</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="channel_id" position="attributes">
<attribute name="invisible">1</attribute>
<attribute name="required">0</attribute>
</field>
</field>
</record>
<record id="slide_slide_view_kanban" model="ir.ui.view">
<field name="name">slide.slide.view.kanban</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<kanban edit="false" group_create="0"
records_draggable="0"
class="o_slide_kanban"
sample="1">
<field name="id"/>
<field name="channel_id"/>
<field name="slide_category"/>
<field name="user_id"/>
<field name="image_128"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill">
<t t-set="placeholder" t-value="'/website_slides/static/src/img/channel-training-default.jpg'"/>
<t t-if="record.image_128.raw_value" t-set="image" t-value="kanban_image('slide.slide', 'image_128', record.id.raw_value, placeholder)"/>
<t t-else="" t-set="image" t-value="'/website_slides/static/src/img/channel-training-default.jpg'"/>
<div class="o_kanban_image_fill_left d-none d-md-block"
t-attf-style="background-image:url('#{image}')">
<img class="o_kanban_image_inner_pic"
t-att-alt="record.channel_id.value"
t-att-src="kanban_image('slide.channel', 'image_128', record.channel_id.raw_value)"/>
</div>
<div class="o_kanban_image rounded-circle d-md-none"
t-attf-style="background-image:url('#{image}')">
<img class="o_kanban_image_inner_pic"
t-att-alt="record.channel_id.value"
t-att-src="kanban_image('slide.channel', 'image_128', record.channel_id.raw_value)"/>
</div>
<div class="oe_kanban_details d-flex flex-column">
<strong class="o_kanban_record_title oe_partner_heading"><field name="name"/></strong>
<div class="text-mutex"><field name="channel_id"/></div>
<div class="o_kanban_tags_section mb-2">
<span class="oe_kanban_list_many2many">
<field name="tag_ids" widget="many2many_tags"/>
</span>
</div>
<div class="o_kanban_record_bottom mt-auto d-flex justify-content-between align-items-end">
<span>
<t t-if="record.slide_category.raw_value == 'infographic'">
<i class="fa fa-file-image-o mr-2" aria-label="Infographic" role="img" title="Infographic"/>
</t>
<t t-elif="record.slide_category.raw_value == 'article'">
<i class="fa fa-file-code-o mr-2" aria-label="article" role="img" title="Article"/>
</t>
<t t-elif="record.slide_category.raw_value == 'video'">
<i class="fa fa-file-video-o mr-2" aria-label="Video" role="img" title="Video"/>
</t>
<t t-elif="record.slide_category.raw_value == 'quiz'">
<i class="fa fa-flag mr-2" aria-label="Quiz" role="img" title="Quiz"/>
</t>
<t t-else=""><i class="fa fa-file-pdf-o mr-2" aria-label="Document" role="img" title="Document"/></t>
<field name="slide_category"/>
</span>
<span>
<i class="fa fa-clock-o mr-2" aria-label="Duration" role="img" title="Duration"/><field name="completion_time" widget="float_time"/>
</span>
<span>
<i class="fa fa-question mr-2" aria-label="Number of Questions" role="img" title="Number of Questions"/><field name="questions_count"/>
</span>
<span>
<i class="fa fa-eye mr-2" aria-label="Views" role="img" title="Views"/><field name="total_views"/>
</span>
<field name="user_id" widget="many2one_avatar_user"/>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="view_slide_slide_tree" model="ir.ui.view">
<field name="name">slide.slide.tree</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<tree string="Contents" sample="1" multi_edit="1">
<field name="name" readonly="1"/>
<field name="channel_id" readonly="1"/>
<field name="category_id" readonly="1" optional="hide"/>
<field name="user_id" widget="many2one_avatar_user"/>
<field name="is_published"/>
<field name="date_published" readonly="1"/>
<field name="completion_time" sum="Total" readonly="1" widget="float_time"/>
</tree>
</field>
</record>
<record id="slide_slide_view_tree_report" model="ir.ui.view">
<field name="name">slide.slide.view.tree.report</field>
<field name="model">slide.slide</field>
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<tree string="Contents" sample="1">
<field name="name"/>
<field name="user_id" widget="many2one_avatar_user"/>
<field name="channel_id"/>
<field name="category_id" optional="hide"/>
<field name="date_published"/>
<field name="total_views" string="# Views" sum="Total Views"/>
<field name="questions_count" string="# Questions" sum="Total Questions"/>
<field name="completion_time" sum="Total Duration" widget="float_time"/>
</tree>
</field>
</record>
<record id="view_slide_slide_search" model="ir.ui.view">
<field name="name">slide.slide.filter</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<search string="Search Contents">
<field name="name"/>
<filter name="published" string="Published" domain="[('is_published', '=', True)]"/>
<filter name="not_published" string="Waiting for validation" domain="[('is_published', '=', False)]"/>
<filter name="filter_user_id_uid" string="My Content" domain="[('user_id', '=', uid)]"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<group expand="0" string="Group By">
<filter string="Course" name="groupby_channel" domain="[]" context="{'group_by': 'channel_id'}"/>
<filter string="Category" name="groupby_category" domain="[]" context="{'group_by': 'category_id'}"/>
<filter string="Type" name="groupby_type" domain="[]" context="{'group_by': 'slide_category'}"/>
</group>
</search>
</field>
</record>
<record id="slide_slide_view_graph" model="ir.ui.view">
<field name="name">slide.slide.view.graph</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<graph string="Graph of Contents" stacked="0" sample="1">
<field name="channel_id"/>
<field name="slide_category"/>
<field name="total_views" type="measure"/>
<field name="quiz_first_attempt_reward" invisible="1"/>
<field name="quiz_second_attempt_reward" invisible="1"/>
<field name="quiz_third_attempt_reward" invisible="1"/>
<field name="quiz_fourth_attempt_reward" invisible="1"/>
<field name="sequence" invisible="1"/>
</graph>
</field>
</record>
<record id="slide_slide_view_pivot" model="ir.ui.view">
<field name="name">slide.slide.view.pivot</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<pivot sample="1">
<field name="channel_id" type="row"/>
<field name="total_views" type="measure"/>
</pivot>
</field>
</record>
<record id="slide_slide_action" model="ir.actions.act_window">
<field name="name">Contents</field>
<field name="res_model">slide.slide</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{'search_default_own_publications':True}</field>
<field name="domain">[('is_category', '=', False)]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Add Content
</p>
<p>
Content are the lessons that compose a course
<br/>and can be of different types (presentations, documents, videos, ...).
</p>
</field>
</record>
<record id="slide_slide_action_report" model="ir.actions.act_window">
<field name="name">Contents</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">slide.slide</field>
<field name="view_mode">graph,tree,form,pivot</field>
<field name="context">{"search_default_published": 1}</field>
<field name="domain">[('is_category', '=', False)]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No data yet!
</p><p>
Create new content for your eLearning
</p>
</field>
</record>
<record id="slide_slide_action_report_view_graph" model="ir.actions.act_window.view">
<field name="sequence" eval="0"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="slide_slide_view_graph"/>
<field name="act_window_id" ref="slide_slide_action_report"/>
</record>
<record id="slide_slide_action_report_view_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="slide_slide_view_tree_report"/>
<field name="act_window_id" ref="slide_slide_action_report"/>
</record>
<record id="slide_slide_action_report_view_form" model="ir.actions.act_window.view">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_slide_slide_form"/>
<field name="act_window_id" ref="slide_slide_action_report"/>
</record>
<record id="slide_slide_action_report_view_pivot" model="ir.actions.act_window.view">
<field name="sequence" eval="3"/>
<field name="view_mode">pivot</field>
<field name="view_id" ref="slide_slide_view_pivot"/>
<field name="act_window_id" ref="slide_slide_action_report"/>
</record>
</data>
</odoo>