<field name="name" invisible="1" />
<field name="description" invisible="1" />
<field name="questions" invisible="1" />
+ <field name="question_items" invisible="1" />
<t t-name="kanban-box">
- <div class="oe_kanban_card oe_semantic_html_override oe_resource_details oe_kanban_global_click_edit faq_question_panel">
+ <div class="oe_kanban_card oe_semantic_html_override oe_resource_details faq_question_panel">
<div class="oe_dropdown_kanban">
<div class="oe_dropdown_toggle">
</div>
<div t-attf-class="oe_kanban_content faq_question_content">
- <h2><t t-esc="record.name.value" /></h2>
-
- <h4>Description</h4>
+ <h1><a t-att-href="'#id='+record.id.value+'&view_type=form&model=faq.theme'">
+ <t t-esc="record.name.value" />
+ </a></h1>
<t t-esc="record.description.value" />
- <h4>Questions</h4>
- <t t-foreach="record.questions.raw_value" t-as="question">
- <p><t t-call="kanban-question" /></p>
- </t>
+ <h2>Questions :</h2>
+
+ <ul t-if="record.question_items.value" t-att-class="question_parity">
+ <li t-foreach="record.question_items.value" t-as="question" class="question_frame">
+ <t t-call="question_template.sub">
+ <t t-set="title" t-value="question.name"/>
+ <t t-set="id" t-value="question.id"/>
+ <t t-set="answers" t-value="question.answer_items"/>
+ </t>
+ </li>
+ </ul>
- <p>Domain: <t t-esc="record.questions.domain" /></p>
- <p>String: <t t-esc="record.questions.string" /></p>
- <p>Views: <t t-esc="record.questions.views" /></p>
- <p>Relation: <t t-esc="record.questions.relation" /></p>
- <p>Context: <t t-esc="record.questions.context" /></p>
- <p>Relation_field: <t t-esc="record.questions.relation_field" /></p>
- <p>Selectable: <t t-esc="record.questions.selectable" /></p>
- <p>Type: <t t-esc="record.questions.type" /></p>
- <p>Value: <t t-esc="record.questions.value" /></p>
- <p>Raw_value: <t t-esc="record.questions.raw_value" /></p>
+ <p t-if="record.question_items.value == ''">Pas de question pour ce thème.</p>
</div>
-
</div>
</t>
+ <t t-name="question_template.sub">
+ <a t-att-href="'#id='+id+'&view_type=form&model=faq.question'" >
+ <t t-esc="title"/>
+ </a>
+ <ul t-if="answers!=''">
+ <li t-foreach="answers" t-as="answer" class="bullet">
+ <t t-call="answer_template.sub">
+ <t t-set="title" t-value="answer.name"/>
+ <t t-set="id" t-value="answer.id"/>
+ </t>
+ </li>
+ </ul>
+ <ul t-if="answers == ''"><li>Pas de réponse pour cette question.</li></ul>
+ </t>
+ <t t-name="answer_template.sub">
+ <a t-att-href="'#id='+id+'&view_type=form&model=faq.answer'" >
+ <t t-esc="title"/>
+ </a>
+ </t>
+
+
+ <!-- Exemple sans le template
+ <t t-name="question_template.sub">
+ <h4><t t-esc="title"/> (ID : <t t-esc="id"/>)</h4>
+
+ <ul t-if="answers">
+ <li t-foreach="answers" t-as="answer" t-att-class="answer_parity">
+ <t t-esc="answer.name"/> (ID : <t t-esc="answer.id"/>)
+ </li>
+ </ul>
+
+ <ul t-if="answers == ''"><li>Pas de réponse pour cette question.</li></ul>
+ </t>-->
</templates>
</kanban>
</field>
<field name="arch" type="xml">
<form string="Question Form" version="7.0">
<field name="name" />
+ <field name="theme_id" />
<field name="description" />
<field name="answers" />
</form>
<kanban>
<templates>
<t t-name="kanban-box">
- <div class="oe_kanban_card oe_semantic_html_override oe_kanban_global_click_edit faq_question_panel">
+ <div class="oe_kanban_card oe_semantic_html_override faq_question_panel">
<div class="oe_dropdown_kanban">
<div class="oe_dropdown_toggle">
</div>
<div t-attf-class="oe_kanban_content">
- <h2><field name="name" /></h2>
- <h4>Description</h4>
- <field name="description" />
- <field name="answers">
- <tree string="Machin">
- <field name="name" />
- </tree>
- </field>
- <h4>Tests</h4>
- <p>Domain: <t t-esc="record.answers.domain" />(<t t-esc="typeof record.answers.domain" />)</p>
- <p>String: <t t-esc="record.answers.string" />(<t t-esc="typeof record.answers.string" />)</p>
- <p>Views: <t t-esc="record.answers.views" />(<t t-esc="typeof record.answers.views" />)</p>
- <p>Relation: <t t-esc="record.answers.relation" />(<t t-esc="typeof record.answers.relation" />)</p>
- <p>Context: <t t-esc="record.answers.context" />(<t t-esc="typeof record.answers.context" />)</p>
- <p>Relation_field: <t t-esc="record.answers.relation_field" />(<t t-esc="typeof record.answers.relation_field" />)</p>
- <p>Selectable: <t t-esc="record.answers.selectable" />(<t t-esc="typeof record.answers.selectable" />)</p>
- <p>Type: <t t-esc="record.answers.type" />(<t t-esc="typeof record.answers.type" />)</p>
- <p>Value: <t t-esc="record.answers.value" />(<t t-esc="typeof record.answers.value" />)</p>
- <p>Raw_value: <t t-esc="record.answers.raw_value" />(<t t-esc="typeof record.answers.raw_value" />)</p>
-
- <p>View 0: <t t-esc="record.answers.views[0]" /></p>
- <p>Context 0: <t t-esc="record.answers.context[0]" /></p>
-
- <h4>Réponses</h4>
- <ul t-name="Answers">
- <li t-foreach="record.answers.raw_value" t-as="answer">
- <span class="oe_tag" t-att-data-answer="answer"></span><!--
- <t t-esc="answer"/>(<t t-esc="typeof answer"/>)
- <t t-esc="kanban_image('faq.anwser', 'name', answer)"/>
- 11<t t-esc="answer.name"/>
- 12<t t-esc="answer[name]"/>
- 13<t t-esc="answer['name']"/>
- 14<t t-esc="answer.name.value"/>
- 15<t t-esc="answer[name].value"/>
- 16<t t-esc="answer['name'].value"/>
- <t t-call="example_template.sub">
- <t t-set="arg" t-value="answer_value"/>
- </t>-->
+ <h2>
+ <a t-att-href="'#id='+record.id.value+'&view_type=form&model=faq.question'" >
+ <field name="name" /> (Thème : <field name="theme_id" />)
+ </a>
+ </h2>
+ <h3><field name="description" /></h3>
+
+ <h4>Réponses :</h4>
+ <field name="answer_items" invisible="1" />
+ <ul t-if="record.answer_items.value">
+ <li t-foreach="record.answer_items.value" t-as="answer" class="bullet">
+ <t t-call="answer_template.sub">
+ <t t-set="title" t-value="answer.name"/>
+ <t t-set="id" t-value="answer.id"/>
+ </t>
</li>
</ul>
- </div>
+ <ul t-if="record.answer_items.value == ''"><li>Pas de réponse pour l'instant.</li></ul>
+ </div>
</div>
</t>
- <t t-name="example_template.sub">
- 21<t t-esc="arg.name"/>
- 22<t t-esc="arg[name]"/>
- 23<t t-esc="arg['name']"/><!--
- 24<t t-esc="arg.name.value"/>
- 25<t t-esc="arg[name].value"/>
- 26<t t-esc="arg['name'].value"/>-->
- </t>
+ <t t-name="answer_template.sub">
+ <a t-att-href="'#id='+id+'&view_type=form&model=faq.answer'" >
+ <t t-esc="title"/>
+ </a>
+ </t>
</templates>
</kanban>
</field>