[IMP] better layout for documentation
[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-md-9">
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-md-3 text-right">
63                             Search:
64                         </div>
65                     </div>
66                 </section>
67                 <section class="container">
68                     <t t-set="level" t-value="toc and 1 or 0"/>
69                     <h1 class="page-header" t-if="toc">
70                         <t t-esc="toc.name"/>
71                     </h1>
72                     <t t-set="titles" t-value="sections"/>
73                     <t t-call="website_forum_doc.toc"/>
74                 </section>
75                 <div class="oe_structure"/>
76             </t>
77         </template>
78
79         <template id="documentation_post" name="Documentation Question">
80             <t t-call="website.layout">
81                 <section class="container mt16" t-if="toc">
82                     <div class="row">
83                         <div class="col-sm-8">
84                             <ol class="breadcrumb mb0">
85                                 <t t-call="website_forum_doc.breadcrumb">
86                                     <t t-set="toc" t-value="toc.parent_id"/>
87                                 </t>
88                                 <li>
89                                     <a t-attf-href="/forum/how-to/#{ slug(toc) }" t-field="toc.name"/>
90                                 </li>
91                             </ol>
92                         </div>
93                         <div class="col-sm-4 text-right" t-if="forum">
94                             <form class="navbar-form navbar-right mt0" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
95                                 <div class="form-group">
96                                     <input type="search" class="form-control"
97                                         name="search" placeholder="Search..."
98                                         t-att-value="search or ''"/>
99                                     <button type="submit" class="btn btn-default">Search</button>
100                                 </div>
101                             </form>
102                         </div>
103                     </div>
104                 </section>
105
106                 <section class="container">
107                     <div class="row">
108                         <div class="col-sm-9">
109                             <h1 class="page-header" t-field="post.name"/>
110                             <blockquote t-if="bool(post.content)">
111                                 <t t-raw="post.content"/>
112                             </blockquote>
113
114                             <t t-if="post.child_ids">
115                                 <t t-raw="post.child_ids[0].content"/>
116                             </t>
117                             <div t-if="len(toc.post_ids)&gt;1">
118                                 <h2 class="page-header">Related topics</h2>
119                                 <ul>
120                                     <t t-foreach="toc.post_ids" t-as="topic">
121                                         <li t-if="post.id != topic.id">
122                                             <a t-attf-href="/forum/how-to/#{slug(toc)}/#{slug(topic)}" t-field="post.name"/>
123                                         </li>
124                                     </t>
125                                 </ul>
126                             </div>
127                         </div><div class="col-sm-3">
128                             <div class="panel panel-default mt48" id="about_doc">
129                                 <div class="panel-heading">
130                                     <h3 class="panel-title">Need more info?</h3>
131                                 </div>
132                                 <div class="panel-body">
133                                     <div class="text-muted">
134                                         This documentation page has been extracted
135                                         from the Q&amp;A section where you can
136                                         discuss it and get feedback.
137                                     </div>
138                                     &amp;nbsp; <a t-attf-href="/forum/#{slug(forum)}/question/#{slug(post)}" class="fa fa-arrow-right mt16"> Related question</a>
139                                 </div>
140                             </div>
141                         </div>
142                     </div>
143                 </section>
144                 <div class="oe_structure mt16 mb16"/>
145             </t>
146         </template>
147
148
149         <!--TOC ON FORUM POST-->
150         <template id="forum_question_right_column" inherit_id="website_forum.header" name="Table of Content">
151             <xpath expr="//script[@src='/website_forum/static/src/js/website_forum.js']" position="after">
152                 <script type="text/javascript" src="/website_doc/static/src/js/website_doc.js"/>
153             </xpath>
154             <xpath expr="//div[@id='about_forum']" position="before">
155                 <div t-if="header.get('question_data')" groups="website_doc.group_documentaion_moderator">
156                     <div class="panel panel-default">
157                         <div class="panel-heading" id="about_forum">
158                             <h3 class="panel-title">Documentation</h3>
159                         </div>
160                         <div class="panel-body">
161                             <form t-attf-action="/forum/#{ slug(forum) }/question/#{ slug(question) }/toc" role="form" method="post">
162                                 <div class="input-group navbar-right">
163                                     <select class="form-control" name="content">
164                                         <option value=""></option>
165                                         <t t-foreach="documentaion_toc or []" t-as="toc">
166                                             <option t-att-value="toc.id" t-att-selected="toc.id == question.toc_id.id"><t t-esc="toc.name"/></option>
167                                         </t>
168                                     </select>
169                                     <span class="input-group-btn">
170                                         <button class="btn btn-primary ">save</button>
171                                     </span>
172                                 </div>
173                             </form>
174                         </div>
175                     </div>
176                 </div>
177             </xpath>
178         </template>
179
180     </data>
181 </openerp>