5be0dc380e46e3e925860bf340b9833a1755030e
[odoo/odoo.git] / addons / website_forum_doc / views / website_doc.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4
5         <!-- Layout add nav and footer -->
6         <template id="header_footer_custom" inherit_id="website.layout"
7             name="Footer Documentation Link">
8             <xpath expr="//footer//ul[@name='products']" position="inside">
9                 <li><a href="/forum/how-to">Documentation</a></li>
10             </xpath>
11         </template>
12
13         <!-- Page Index -->
14         <template id="toc" name="Documentation Index">
15             <t t-set="level" t-value="level+1"/>
16             <t t-foreach="titles" t-as="title">
17                 <div t-attf-class="h#{str(level) + (level&lt;3 and ' page-header' or '')}">
18                     <t t-esc="title.name"/>
19                     <small t-if="len(title.post_ids)">
20                         <t t-esc="len(title.post_ids)"/>
21                         <t t-if="len(title.post_ids)==1">essay</t>
22                         <t t-if="len(title.post_ids)&gt;1">essays</t>
23                     </small>
24                 </div>
25
26                 <ul t-if="title.post_ids" class="mt32">
27                     <li t-foreach="title.post_ids" t-as="post">
28                         <a t-attf-href="/forum/how-to/#{slug(title)}/#{slug(post)}" t-field="post.name"/>
29                     </li>
30                 </ul>
31
32                 <t t-set="titles" t-value="title.child_ids"/>
33                 <t t-call="website_forum_doc.toc"/>
34             </t>
35         </template>
36
37         <template id="breadcrumb" name="Documentation Breadcrumb">
38             <t t-if="toc.parent_id">
39                 <t t-call="website_forum_doc.breadcrumb">
40                     <t t-set="toc" t-value="toc.parent_id"/>
41                 </t>
42             </t>
43             <li t-if="toc">
44                 <a t-attf-href="/forum/how-to/#{ slug(toc) }" t-field="toc.name"/>
45             </li>
46         </template>
47
48         <template id="documentation" name="Documentation Index">
49             <t t-call="website.layout">
50                 <section class="container mt16" t-if="toc">
51                     <div class="row">
52                         <div class="col-sm-8">
53                             <ol class="breadcrumb mb0">
54                                 <t t-call="website_forum_doc.breadcrumb">
55                                     <t t-set="toc" t-value="toc.parent_id"/>
56                                 </t>
57                                 <li class="active">
58                                     <span t-field="toc.name"/>
59                                 </li>
60                             </ol>
61                         </div>
62                         <div class="col-sm-4 text-right">
63                             <form class="navbar-form navbar-right mt0" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
64                                 <div class="form-group">
65                                     <input type="search" class="form-control"
66                                         name="search" placeholder="Search..."
67                                         t-att-value="search or ''"/>
68                                     <button type="submit" class="btn btn-default">Search</button>
69                                 </div>
70                             </form>
71                         </div>
72                     </div>
73                 </section>
74                 <section class="container">
75                     <t t-set="level" t-value="toc and 1 or 0"/>
76                     <h1 class="page-header" t-if="toc">
77                         <t t-esc="toc.name"/>
78                     </h1>
79                     <t t-set="titles" t-value="sections"/>
80                     <t t-call="website_forum_doc.toc"/>
81                 </section>
82                 <div class="oe_structure"/>
83             </t>
84         </template>
85
86         <template id="documentation_post" name="Documentation Question">
87             <t t-call="website.layout">
88                 <section class="container mt16" t-if="toc">
89                     <div class="row">
90                         <div class="col-sm-8">
91                             <ol class="breadcrumb mb0">
92                                 <t t-call="website_forum_doc.breadcrumb">
93                                     <t t-set="toc" t-value="toc.parent_id"/>
94                                 </t>
95                                 <li>
96                                     <a t-attf-href="/forum/how-to/#{ slug(toc) }" t-field="toc.name"/>
97                                 </li>
98                             </ol>
99                         </div>
100                         <div class="col-sm-4 text-right" t-if="forum">
101                             <form class="navbar-form navbar-right mt0" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
102                                 <div class="form-group">
103                                     <input type="search" class="form-control"
104                                         name="search" placeholder="Search..."
105                                         t-att-value="search or ''"/>
106                                     <button type="submit" class="btn btn-default">Search</button>
107                                 </div>
108                             </form>
109                         </div>
110                     </div>
111                 </section>
112
113                 <section class="container">
114                     <div class="row">
115                         <div class="col-sm-9">
116                             <h1 class="page-header" t-field="post.name"/>
117                             <blockquote t-if="bool(post.content)">
118                                 <t t-raw="post.content"/>
119                             </blockquote>
120
121                             <t t-if="post.child_ids">
122                                 <t t-raw="post.child_ids[0].content"/>
123                             </t>
124                             <div t-if="len(toc.post_ids)&gt;1">
125                                 <h2 class="page-header">Related topics</h2>
126                                 <ul>
127                                     <t t-foreach="toc.post_ids" t-as="topic">
128                                         <li t-if="post.id != topic.id">
129                                             <a t-attf-href="/forum/how-to/#{slug(toc)}/#{slug(topic)}" t-field="post.name"/>
130                                         </li>
131                                     </t>
132                                 </ul>
133                             </div>
134                         </div><div class="col-sm-3">
135                             <div class="panel panel-default mt48" id="about_doc">
136                                 <div class="panel-heading">
137                                     <h3 class="panel-title">Need more info?</h3>
138                                 </div>
139                                 <div class="panel-body">
140                                     <div class="text-muted">
141                                         This documentation page has been extracted
142                                         from the Q&amp;A section where you can
143                                         discuss it and get feedback.
144                                     </div>
145                                     &amp;nbsp; <a t-attf-href="/forum/#{slug(forum)}/question/#{slug(post)}" class="fa fa-arrow-right mt16"> Related question</a>
146                                 </div>
147                             </div>
148                         </div>
149                     </div>
150                 </section>
151                 <div class="oe_structure mt16 mb16"/>
152             </t>
153         </template>
154
155
156         <!--TOC ON FORUM POST-->
157         <template id="forum_question_right_column" inherit_id="website_forum.header" name="Table of Content">
158             <xpath expr="//script[@src='/website_forum/static/src/js/website_forum.js']" position="after">
159                 <script type="text/javascript" src="/website_doc/static/src/js/website_doc.js"/>
160             </xpath>
161             <xpath expr="//div[@id='about_forum']" position="before">
162                 <div t-if="header.get('question_data')" groups="website_doc.group_documentaion_moderator">
163                     <div class="panel panel-default">
164                         <div class="panel-heading" id="about_forum">
165                             <h3 class="panel-title">Documentation</h3>
166                         </div>
167                         <div class="panel-body">
168                             <form t-attf-action="/forum/#{ slug(forum) }/question/#{ slug(question) }/toc" role="form" method="post">
169                                 <div class="input-group navbar-right">
170                                     <select class="form-control" name="content">
171                                         <option value=""></option>
172                                         <t t-foreach="documentaion_toc or []" t-as="toc">
173                                             <option t-att-value="toc.id" t-att-selected="toc.id == question.toc_id.id"><t t-esc="toc.name"/></option>
174                                         </t>
175                                     </select>
176                                     <span class="input-group-btn">
177                                         <button class="btn btn-primary ">save</button>
178                                     </span>
179                                 </div>
180                             </form>
181                         </div>
182                     </div>
183                 </div>
184             </xpath>
185         </template>
186
187     </data>
188 </openerp>