[FIX] website_forum: fixed inclusion of css / js, notably ckeditor.
[odoo/odoo.git] / addons / website_forum / views / website_forum.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4
5 <!-- Editor custom -->
6 <template id="assets_editor" inherit_id="website.assets_editor" name="Forum Editor Assets" groups="base.group_user">
7     <xpath expr="." position="inside">
8         <script type="text/javascript" src="/website_forum/static/src/js/website.tour.forum.js"/>
9         <script type="text/javascript" src="/website_forum/static/src/js/website_forum.editor.js"/>
10     </xpath>
11 </template>
12
13 <!-- Front-end custom css / js + ckeditor lib and customization -->
14 <template id="assets_frontend" inherit_id="website.assets_frontend" name="Forum Assets">
15     <xpath expr="." position="inside">
16         <link rel='stylesheet' href="/web/static/lib/jquery.textext/jquery.textext.css"/>
17         <link rel='stylesheet' href='/website_forum/static/src/css/website_forum.css'/>
18         <script type="text/javascript" src="/website_forum/static/src/js/website_forum.js"/>
19         <script type="text/javascript" src="/web/static/lib/jquery.textext/jquery.textext.js"/>
20         <script type="text/javascript">
21             var CKEDITOR_BASEPATH = '/web/static/lib/ckeditor/';
22         </script>
23         <script type="text/javascript" src="/web/static/lib/ckeditor/ckeditor.js"></script>
24          <script type="text/javascript">
25                 CKEDITOR.config.toolbar = [['Bold','Italic','Underline','Strike'],['NumberedList','BulletedList', 'Blockquote']
26                 ,['Outdent','Indent','Link','Unlink','Image'],] ;
27         </script>
28
29     </xpath>
30 </template>
31
32 <!-- Layout add nav and footer -->
33 <template id="header_footer_custom" inherit_id="website.footer_default"
34     name="Footer Questions Link">
35     <xpath expr="//ul[@id='products']" position="inside">
36         <li><a t-attf-href="/forum/%(website_forum.forum_help)d">Q&amp;A</a></li>
37         <li><a href="/forum">Forums</a></li>
38     </xpath>
39 </template>
40
41 <!-- helper -->
42 <template id="link_button">
43     <form method="POST" t-att-action="url">
44         <button t-attf-class="fa btn-link #{classes} #{karma and 'karma_required text-muted' or ''}" t-attf-data-karma="#{karma}">
45             <t t-esc="label"/></button>
46     </form>
47 </template>
48
49 <!-- Page Index -->
50 <template id="header" name="Forum Index">
51     <t t-call="website.layout">
52         <div t-if="is_public_user and not no_introduction_message" class="alert alert-success alert-dismissable">
53             <div class="container">
54                 <div t-field="forum.introduction_message"/>
55                 <a class='btn btn-primary' t-attf-href="/web?redirect=#{ request.httprequest.url }">Register</a>
56                 <button type="button" class="btn btn-link js_close_intro" data-dismiss="alert" aria-hidden="true">Hide Intro</button>
57             </div>
58         </div>
59         <div class="container mt16 website_forum">
60             <div class="navbar navbar-default">
61                 <div class="navbar-header">
62                     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#oe-help-navbar-collapse">
63                         <span class="sr-only">Toggle navigation</span>
64                         <span class="icon-bar"></span>
65                         <span class="icon-bar"></span>
66                     </button>
67                     <a class="navbar-brand" t-attf-href="/forum/#{slug(forum)}">
68                         <span t-field="forum.name"/>
69                     </a>
70                 </div>
71                 <div class="collapse navbar-collapse" id="oe-help-navbar-collapse">
72                     <ul class="nav navbar-nav">
73                         <li t-att-class="sorting == 'relevancy desc' and 'active' or '' ">
74                             <a t-attf-href="/forum/#{ slug(forum) }?{{ keep_query( 'search', 'post_type', 'filters', sorting='relevancy desc') }}">Trending</a>
75                         </li>
76                         <li t-att-class="sorting == 'create_date desc' and 'active' or '' ">
77                             <a t-attf-href="/forum/#{ slug(forum) }?{{ keep_query( 'search', 'post_type', 'filters', sorting='create_date desc') }}">Newest</a>
78                         </li>
79                         <li t-att-class="searches.get('users') and 'active' or '' ">
80                             <a t-attf-href="/forum/#{ slug(forum) }/users">People</a>
81                         </li>
82                         <li t-att-class="searches.get('tags') and 'active' or '' ">
83                             <a t-attf-href="/forum/#{ slug(forum) }/tag">Tags</a>
84                         </li>
85                         <li t-att-class="searches.get('badges') and 'active' or '' ">
86                             <a t-attf-href="/forum/#{ slug(forum) }/badge">Badges</a>
87                         </li>
88                         <li t-if="not is_public_user" t-att-class="searches.get('my_profile') and 'active' or '' ">
89                             <a t-attf-href="/forum/#{ slug(forum) }/user/#{uid}">My Profile</a>
90                         </li>
91                     </ul>
92                     <form class="navbar-form navbar-right" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
93                         <div class="input-group">
94                             <input type="search" class="form-control" name="search" t-att-value="search or ''"/>
95                             <span class="input-group-btn">
96                                 <button type="submit" class="btn btn-default">Search</button>
97                             </span>
98                         </div>
99                     </form>
100                 </div>
101             </div>
102         </div>
103
104         <div id="wrap" class="container">
105             <div class="row">
106                 <div class="col-sm-9">
107                     <div t-foreach="notifications or []" t-as="notification" class="alert alert-success alert-dismissable">
108                         <button type="button" class="close notification_close" t-att-id="notification.id" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
109                         <div t-field="notification.body"/>
110                         <a t-attf-href="/forum/#{ slug(forum) }/user/#{ user.id }#badges" class="fa fa-arrow-right">View Your Badges</a>
111                     </div>
112                     <t t-raw="0"/>
113                 </div>
114                 <div class="col-sm-3" id="right-column">
115                     <div t-if="not header.get('ask_hide')" t-attf-class="btn-group btn-block mb16 #{user.karma &gt;= forum.karma_ask and '' or 'karma_required'}" t-attf-data-karma="#{forum.karma_ask}">
116                         <a type="button" class="btn btn-primary btn-lg col-sm-10" t-attf-href="/forum/#{slug(forum)}/#{forum.default_allow}">
117                             <t t-if="forum.default_allow == 'ask_question'">Ask a Question</t>
118                             <t t-if="forum.default_allow == 'post_link'">Submit a Post</t>
119                             <t t-if="forum.default_allow == 'post_discussion'">New Discussion</t>
120                         </a>
121                         <button type="button" class="btn btn-primary btn-lg col-sm-2 dropdown-toggle" data-toggle="dropdown">
122                             <span class="caret"></span>
123                             <span class="sr-only">Select Post</span>
124                         </button>
125                         <ul class="dropdown-menu" role="menu">
126                             <li t-if="forum.allow_link"><a t-attf-href="/forum/#{slug(forum)}/post_link">Submit a Post</a></li>
127                             <li t-if="forum.allow_question"><a t-attf-href="/forum/#{slug(forum)}/ask_question">Ask a Question</a></li>
128                             <li t-if="forum.allow_discussion"><a t-attf-href="/forum/#{slug(forum)}/post_discussion">Launch a Discussion</a></li>
129                         </ul>
130                     </div>
131                     <div class="panel panel-default">
132                         <div class="panel-heading">
133                             <h3 class="panel-title">Keep Informed</h3>
134                         </div>
135                         <div class="panel-body">
136                             <t t-call="website_mail.follow">
137                                 <t t-set="email" t-value="user.email"/>
138                                 <t t-set="object" t-value="forum"/>
139                             </t>
140                         </div>
141                     </div>
142                     <div class="panel panel-default" id="about_forum">
143                         <div class="panel-heading">
144                             <h3 class="panel-title">About This Community</h3>
145                         </div>
146                         <div class="panel-body">
147                             <t t-raw="forum.description"/>
148                             <a t-if="not header.get('is_guidelines')" t-attf-href="/forum/#{slug(forum)}/faq" class="fa fa-arrow-right"> Read Guidelines</a>
149                             <a t-if="header.get('is_guidelines')" t-attf-href="/forum/#{slug(forum)}" class="fa fa-arrow-right"> Back to <span t-field="forum.name"/></a>
150                         </div>
151                     </div>
152                     <div t-if="header.get('question_data')">
153                         <div class="panel panel-default">
154                             <div class="panel-heading text-center">
155                                 <h3 class="panel-title">Question tools</h3>
156                             </div>
157                             <div class="panel-body text-center">
158                                 <t t-call="website_mail.follow"><t t-set="object" t-value="question"/></t>
159                                 <div class="mt8">
160                                     <strong><t t-raw="len(question.message_follower_ids)"/></strong> follower(s)
161                                 </div>
162                             </div>
163                             <div class="panel-heading text-center">
164                                 <h3 class="panel-title ">Stats</h3>
165                             </div>
166                             <div class="panel-body">
167                                 <table class="table">
168                                     <thead><tr><td> Asked: <strong><span t-field="question.create_date" t-field-options='{"format":"short"}'/></strong></td></tr></thead>
169                                     <tr><td> Seen: <strong><t t-raw="question.views"/></strong>
170                                         <span t-if="question.views&gt;1">times</span>
171                                         <span t-if="question.views&lt;=1">time</span>
172                                     </td></tr>
173                                     <tr><td> Last updated: <strong><span t-field="question.write_date" t-field-options='{"format":"short"}'/></strong></td></tr>
174                                 </table>
175                             </div>
176                         </div>
177                     </div>
178                 </div>
179             </div>
180         </div>
181         <div class="oe_structure"/>
182     </t>
183 </template>
184
185 <!-- Display a post -->
186 <template id="display_post">
187     <div class="question row">
188         <div class="col-md-2 hidden-xs text-center">
189             <t t-call="website_forum.vote">
190                 <t t-set="post" t-value="question"/>
191             </t>
192         </div>
193         <div class="col-md-10 clearfix">
194             <div class="question-name">
195                 <t t-if="question.type == 'link'">
196                     <a t-att-href="question.content_link" t-raw="question.name"/>
197                 </t>
198                 <t t-if="question.type in ('question', 'discussion')">
199                     <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }" t-field="question.name"/>
200                 </t>
201                 <span t-if="not question.active"><b> [Deleted]</b></span>
202                 <span t-if="question.state == 'close'"><b> [Closed]</b></span>
203             </div>
204             <t t-foreach="question.tag_ids" t-as="question_tag">
205                 <a t-attf-href="/forum/#{ slug(forum) }/tag/#{slug(question_tag)}/questions">
206                     <span t-attf-class="pull-right label #{tag and tag.name == question_tag.name and 'label-primary' or 'label-default'}" t-field="question_tag.name"
207                         style="margin-right: 4px;"/>
208                 </a>
209             </t>
210             <small class="text-muted">
211                 By <span t-field="question.create_uid" t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}' style="display: inline-block;"/>
212                 â€¢ <span t-field="question.write_date" t-field-options='{"format":"short"}'/>
213                 â€¢ <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }">
214                     <t t-esc="question.child_count"/>
215                     <t t-if="question.child_count&gt;1">comments</t>
216                     <t t-if="question.child_count&lt;=1">comment</t>
217                 </a>
218             </small>
219         </div>
220     </div>
221 </template>
222
223 <!-- Display a post as an answer -->
224 <template id="display_post_answer">
225     <div class="clearfix">
226         <div t-attf-class="pull-left text-center mb16 box #{len(answer.vote_ids) and 'oe_green' or 'oe_grey'}">
227             <div t-esc="len(answer.vote_ids)"/>
228         </div>
229         <div class="question-name" style="margin-left: 32px;">
230             <a style="font-size: 15px;" t-attf-href="/forum/#{ slug(forum) }/question/#{ answer.parent_id.id }/#answer-#{ answer.id }" t-esc="answer.parent_id.name"/>
231             <t t-if="len(answer.website_message_ids)&gt;0">
232                 (<t t-esc="len(answer.website_message_ids)"/>
233                 <t t-if="len(answer.website_message_ids)&gt;1">Comments</t>
234                 <t t-if="len(answer.website_message_ids)&lt;=1">Comment</t>)
235             </t>
236         </div>
237     </div>
238 </template>
239
240 <!-- FAQ Layout -->
241 <template id="faq">
242     <t t-call="website_forum.header">
243         <div t-field="forum.faq"/>
244     </t>
245 </template>
246
247 <!-- All Forums Layout -->
248 <template id="forum_all">
249     <t t-call="website.layout">
250         <div class="container">
251             <h1 class="mb32">Our forums</h1>
252             <div class="row">
253                 <div t-foreach="forums" t-as="forum" class="col-sm-3 text-center mb32">
254                     <a t-attf-href="/forum/#{ slug(forum) }">
255                         <div class="fa fa-5x fa-comment mb16"/>
256                         <div t-field="forum.name"/>
257                     </a>
258                 </div>
259             </div>
260         </div>
261     </t>
262 </template>
263
264 <!-- Specific Forum Layout -->
265 <template id="forum_index" name="Forum">
266     <t t-call="website_forum.header">
267         <h2 class="page-header mt0">
268             <t t-esc="question_count"/>
269                 <span t-if="post_type == 'all'">Posts</span>
270                 <span t-if="post_type == 'question'">Questions</span>
271                 <span t-if="post_type == 'link'">Posts</span>
272                 <span t-if="post_type == 'discussion'">Discussions</span>
273             <t t-esc="search"/>
274             <small class="dropdown" t-if="filters in ('all', 'unanswered','followed', 'tag')">
275               <a href="#" class="dropdown-toggle" data-toggle="dropdown">
276                   <t t-if="filters == 'unanswered'">Unanswered</t>
277                   <t t-if="filters == 'followed'">Followed</t>
278                   <t t-if="tag"><span t-field="tag.name"/></t>
279                   <t t-if="sorting == 'relevancy desc'"> by relevancy</t>
280                   <t t-if="sorting == 'write_date desc'"> by activity date</t>
281                   <t t-if="sorting == 'create_date desc'"> by newest</t>
282                   <t t-if="sorting == 'child_count desc'"> by most answered</t>
283                   <t t-if="sorting == 'vote_count desc'"> by most voted</t>
284                   <b class="caret"/>
285               </a>
286               <ul class="dropdown-menu">
287                   <li class="dropdown-header">Filter on</li>
288                   <li t-att-class="filters == 'all' and 'active' or '' ">
289                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', filters='all')">All</a>
290                   </li>
291                   <li t-att-class="filters == 'unanswered' and 'active' or '' ">
292                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', filters='unanswered')">Unanswered</a>
293                   </li>
294                   <li t-if="uid" t-att-class="filters == 'followed' and 'active' or '' ">
295                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', filters='followed')">Followed</a>
296                   </li>
297                   <li class="dropdown-header">Tags</li>
298                   <li t-if="tag" t-att-class="tag and 'active' or '' ">
299                       <a href=""><t t-esc="tag.name"/></a>
300                   </li>
301                   <li class="dropdown-header">Sort by</li>
302                   <li t-att-class="sorting == 'relevancy desc' and 'active' or '' ">
303                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='relevancy desc')">Relevancy</a>
304                   </li>
305                   <li t-att-class="sorting == 'write_date desc' and 'active' or '' ">
306                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='write_date desc')">Last activity date</a>
307                   </li>
308                   <li t-att-class="sorting == 'create_date desc' and 'active' or '' ">
309                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='create_date desc')">Newest</a>
310                   </li>
311                   <li t-att-class="sorting == 'child_count desc' and 'active' or '' ">
312                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='child_count desc')">Most answered</a>
313                   </li>
314                   <li t-att-class="sorting == 'vote_count desc' and 'active' or '' ">
315                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='vote_count desc')">Most voted</a>
316                   </li>
317               </ul>
318             </small>
319         </h2>
320         <div t-foreach="question_ids" t-as="question" class="mb16">
321             <t t-call="website_forum.display_post"/>
322         </div>
323         <t t-call="website.pager"/>
324     </t>
325 </template>
326
327 <template id="404">
328     <t t-call="website_forum.header">
329         <div class="oe_structure oe_empty"/>
330         <h1 class="mt32">Question not found!</h1>
331         <p>Sorry, this question is not available anymore.</p>
332         <p>
333             <a t-attf-href="/forum">Return to the question list.</a>
334         </p>
335     </t>
336 </template>
337
338 <!-- Edition: Post Article -->
339 <template id="post_link">
340     <t t-call="website_forum.header">
341         <h1 class="mt0">Submit a Link</h1>
342         <p class="mb32">
343             Share an awesome link. Your post will appear in the 'Newest' top-menu.
344             If the community vote on your post, it will get traction by being promoted
345             in the homepage.
346         </p><p>
347             We keep a high level of quality in showcased posts, only 20% of the submited
348             posts will be featured.
349         </p>
350         <form t-attf-action="/forum/#{ slug(forum) }/link/new" method="post" role="form" class="tag_text form-horizontal">
351             <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
352             <div class="form-group">
353                 <label class="col-sm-2 control-label" for="content_link">URL to Share</label>
354                 <div class="col-sm-8">
355                     <input type="text" name="post_name" required="True" t-attf-value="#{post_name}"
356                         class="form-control mb16 link_url" placeholder="e.g. https://www.odoo.com"/>
357                 </div>
358             </div>
359             <div class="form-group">
360                 <label class="col-sm-2 control-label" for="post_name">Post Title</label>
361                 <div class="col-sm-8">
362                     <input type="text" name="content" readonly="True" required="True" t-attf-value="#{content}"
363                         class="form-control"/>
364                 </div>
365             </div>
366             <div class="form-group">
367                 <label class="col-sm-2 control-label" for="post_tags">Tags</label>
368                 <div class="col-sm-8">
369                     <input type="text" name="post_tags" readonly="True" class="form-control load_tags"/>
370                 </div>
371             </div>
372             <div class="form-group">
373                 <div class="col-sm-offset-2 col-sm-8">
374                     <button class="btn btn-primary" disabled="True" id="btn_post_your_article">Post Your Article</button>
375                 </div>
376             </div>
377         </form>
378     </t>
379 </template>
380
381 <!-- Edition: Post your Discussion Topic -->
382 <template id="post_discussion">
383     <t t-call="website_forum.header">
384         <h1 class="mt0">Post Your Discussion Topic</h1>
385         <p>
386             <b>Share</b> Start Something Awesome
387         </p>
388         <form t-attf-action="/forum/#{ slug(forum) }/discussion/new" method="post" role="form" class="tag_text">
389             <input type="text" name="post_name" required="True" t-attf-value="#{post_name}"
390                 class="form-control mb16" placeholder="Your Discussion Title..."/>
391             <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
392             <textarea name="content" id="content" required="True" class="form-control load_editor">
393                 <t t-esc="question_content"/>
394             </textarea>
395             <br/>
396             <input type="text" name="post_tags" placeholder="Tags" class="form-control load_tags"/>
397             <br/>
398             <button class="btn btn-primary" id="btn_ask_your_question">Post Your Topic</button>
399         </form>
400     </t>
401 </template>
402
403 <!-- Edition: ask your question -->
404 <template id="ask_question">
405     <t t-call="website_forum.header">
406         <t t-set="head">
407             <script type="text/javascript">
408                 $(function () {
409                     $("[data-toggle='popover']").popover();
410                 });
411             </script>
412         </t>
413         <h1 class="mt0">Ask Your Question</h1>
414         <p>
415             To improve your chance getting an answer:
416         </p>
417         <ul>
418             <li>Set a clear, explicit and concise question title
419                 (check
420                 <a href="#" data-placement="top" data-toggle="popover" data-content="Inventory Date Problem, Task remaining hours, Can you help solve solve my tax computation problem in Canada?" title="Click to get bad question samples">bad examples</a>
421                 and
422                 <a href="#" data-placement="bottom" data-toggle="popover" data-content="How to create a physical inventory at an anterior date?, How is the 'remaining hours' field computed on tasks?, How to configure TPS and TVQ's canadian taxes?" title="Click to get good question titles">good examples</a>
423                 ),
424             </li>
425             <li>Avoid unnecessary introductions (Hi,... Please... Thanks...),</li>
426             <li>Provide enough details and, if possible, give an example.</li>
427         </ul>
428         <form t-attf-action="/forum/#{ slug(forum) }/question/new" method="post" role="form" class="tag_text">
429             <input type="text" name="post_name" required="True" t-attf-value="#{post_name}"
430                 class="form-control mb16" placeholder="Your Question Title..."/>
431             <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
432             <textarea name="content" required="True" id="content" class="form-control load_editor">
433                 <t t-esc="question_content"/>
434             </textarea>
435             <br/>
436             <input type="text" name="post_tags" placeholder="Tags" class="form-control load_tags"/>
437             <br/>
438             <button t-attf-class="btn btn-primary #{(user.karma &lt;= forum.karma_ask) and 'karma_required' or ''}"
439                 id="btn_ask_your_question" t-att-data-karma="forum.karma_ask">Post Your Question</button>
440         </form>
441     </t>
442 </template>
443
444 <!-- Edition: edit a post -->
445 <template id="edit_post">
446     <t t-call="website_forum.header">
447         <h3 t-if="not is_answer">Edit <span t-field="post.type"/></h3>
448         <h3 t-if="is_answer">Edit reply</h3>
449         <form t-attf-action="/forum/#{slug(forum)}/post/#{slug(post)}/save" method="post" role="form" class="tag_text">
450             <div t-if="not is_answer">
451                 <input type="text" name="post_name" required="True"
452                     t-attf-value="#{post.name}" class="form-control mb8" placeholder="Edit your Post"/>
453                 <h5 t-if="post.type == 'question'" class="mt20">Please enter a descriptive question (should finish by a '?')</h5>
454             </div>
455             <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
456             <textarea name="content" id="content" required="True" class="form-control load_editor">
457                 <t t-esc="post.content"/>
458             </textarea>
459             <div t-if="not is_answer">
460                 <br/>
461                 <input type="text" name="post_tag" class="form-control col-md-9 load_tags" placeholder="Tags" t-attf-value="#{tags}"/>
462                 <br/>
463             </div>
464             <button class="btn btn-primary btn-lg">Save</button>
465         </form>
466     </t>
467 </template>
468
469 <!-- Moderation: close a post -->
470 <template id="close_post">
471     <t t-call="website_forum.header">
472         <h1 class="mt0">Close Post</h1>
473         <p class="text-muted">
474             If you close this post, it will be hidden for most users. Only
475             users having a high karma can see closed posts to moderate
476             them.
477         </p>
478         <form t-attf-action="/forum/#{ slug(forum) }/question/#{slug(question)}/close" method="post" role="form" class="form-horizontal mt32 mb64">
479             <input name="post_id" t-att-value="question.id" type="hidden"/>
480             <div class="form-group">
481                 <label class="col-md-3 control-label" for="reason">Post:</label>
482                 <div class="col-md-8 mt8">
483                     <span t-field="question.name"/>
484                 </div>
485             </div>
486             <div class="form-group">
487                 <label class="col-md-3 control-label" for="reason">Reason:</label>
488                 <div class="col-md-8">
489                     <select class="form-control" name="reason_id">
490                         <t t-foreach="reasons or []" t-as="reason">
491                             <option t-att-value="reason.id" t-att-selected="reason.id == question.closed_reason_id.id"><t t-esc="reason.name"/></option>
492                         </t>
493                     </select>
494                 </div>
495             </div>
496             <div class="form-group">
497                 <div class="col-md-offset-3 col-md-8">
498                     <button class="btn btn-primary">Close post</button>
499                     <span class="text-muted">or</span>
500                     <a class="btn btn-link" t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }">back to post</a>
501                 </div>
502             </div>
503         </form>
504     </t>
505 </template>
506
507 <!-- Edition: post a reply -->
508 <template id="post_reply">
509     <div class="css_editable_mode_hidden">
510         <form t-attf-id="reply#{ object._name.replace('.','') + '-' + str(object.id) }" class="collapse oe_comment_grey"
511             t-attf-action="/forum/#{ slug(forum) }/#{slug(object)}/reply" method="post" role="form">
512             <h3 class="mt10">Your Reply</h3>
513             <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
514             <textarea name="content" t-attf-id="content-#{str(object.id)}" class="form-control load_editor" required="True"/>
515             <button class="btn btn-primary" id="btn_ask_your_question">Post Your Reply</button>
516         </form>
517     </div>
518 </template>
519
520 <!-- Edition: post an answer -->
521 <template id="post_answer">
522     <h3 class="mt10">Your Reply</h3>
523     <p t-if="question.type == 'question'">
524         <b>Please try to give a substantial answer.</b> If you wanted to comment on the question or answer, just
525         <b>use the commenting tool.</b> Please remember that you can always <b>revise your answers</b>
526         - no need to answer the same question twice. Also, please <b>don't forget to vote</b>
527         - it really helps to select the best questions and answers!
528     </p>
529     <form t-attf-action="/forum/#{ slug(forum) }/#{slug(question)}/reply" method="post" role="form">
530         <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
531         <textarea name="content" t-attf-id="content-#{str(question.id)}" class="form-control load_editor" required="True"/>
532         <button t-attf-class="btn btn-primary mt16 #{not question.can_answer and 'karma_required' or ''}"
533                 id="btn_ask_your_question" t-att-data-karma="question.karma_answer">Post Your Reply</button>
534     </form>
535 </template>
536
537 <template id="vote">
538     <div t-attf-class="box oe_grey">
539         <a t-attf-class="vote_up fa fa-thumbs-up no-decoration #{post.user_vote == 1 and 'text-success' or ''} #{((post.user_vote == 1 and not post.can_downvote) or not post.can_upvote) and 'karma_required' or ''}"
540             t-attf-data-karma="#{post.user_vote == 1 and post.karma_downvote or post.karma_upvote}"
541             t-attf-data-href="/forum/#{slug(post.forum_id)}/post/#{slug(post)}/upvote"/>
542         <span id="vote_count" t-esc="post.vote_count"/>
543         <a t-attf-class="vote_down fa fa-thumbs-down no-decoration #{post.user_vote == -1 and 'text-warning' or ''} #{((post.user_vote == -1 and not post.can_upvote) or not post.can_downvote) and 'karma_required' or ''}"
544             t-attf-data-karma="#{post.user_vote == -1 and post.karma_upvote or post.karma_downvote}"
545             t-attf-data-href="/forum/#{slug(post.forum_id)}/post/#{slug(post)}/downvote"/>
546         <div t-if="vote_count &gt; 1" class="subtitle">
547             votes
548         </div>
549         <div t-if="vote_count &lt; 2" class="subtitle">
550             vote
551         </div>
552     </div>
553 </template>
554
555 <!-- Specific Post Layout -->
556 <template id="post_description_full" name="Question Navigation">
557     <t t-call="website_forum.header">
558         <div t-attf-class="row question">
559             <div class="col-md-2 hidden-xs text-center">
560                 <t t-call="website_forum.vote">
561                     <t t-set="post" t-value="question"/>
562                 </t>
563                 <div class="text-muted text-center">
564                     <span t-field="question.views"/> Views
565                 </div>
566                 <div class="mt4">
567                     <a t-attf-data-href="/forum/#{slug(question.forum_id)}/question/#{slug(question)}/toggle_favourite"
568                         t-attf-class="favourite_question no-decoration fa fa-2x fa-star #{question.user_favourite and 'forum_favourite_question' or ''}"/>
569                 </div>
570             </div>
571             <div t-attf-class="col-md-10 #{not question.active and 'alert alert-danger' or ''}">
572                 <h1 class="mt0">
573                     <t t-if="question.type == 'link'">
574                         <a t-att-href="question.content_link" t-raw="question.name"/>
575                     </t>
576                     <t t-if="question.type in ('question', 'discussion')">
577                         <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }" t-field="question.name"/>
578                     </t>
579                     <span t-if="not question.active"><b> [Deleted]</b></span>
580                     <span t-if="question.state == 'close'"><b> [Closed]</b></span>
581                 </h1>
582                 <div class="alert alert-info text-center" t-if="question.state == 'close'">
583                     <p class="mt16">
584                         <b>The <i t-field="question.type"/> has been closed<t t-if="question.closed_reason_id"> for reason: <i t-esc="question.closed_reason_id.name"/></t></b>
585                     </p>
586                     <t t-if="question.closed_uid">
587                         <b>by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.closed_uid.id }"
588                             t-field="question.closed_uid"
589                             t-field-options='{"widget": "contact", "fields": ["name"]}'
590                             style="display: inline-block;"/></b>
591                     </t>
592                     <b>on <span t-field="question.closed_date"/></b>
593                     <div class="mt16 mb24 text-center">
594                         <t t-call="website_forum.link_button">
595                             <t t-set="url" t-value="'/forum/' + slug(forum) + '/question/' + slug(question) + '/reopen'"/>
596                             <t t-set="label" t-value="'Reopen'"/>
597                             <t t-set="classes" t-value="'fa-arrow-right'"/>
598                             <t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
599                         </t>
600                     </div>
601                 </div>
602                 <div t-if="question.type != 'link'"><t t-raw="question.content"/></div>
603                 <div class="mt16 clearfix">
604                     <div class="pull-right">
605                         <div class="text-right">
606                             <t t-foreach="question.tag_ids" t-as="tag">
607                                 <a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }/questions" class="label label-default" t-field="tag.name"/>
608                             </t>
609                         </div>
610                         <ul class="list-inline" id="options">
611                             <li t-if="question.type == 'question'">
612                                 <a style="cursor: pointer" t-att-data-toggle="question.can_comment and 'collapse' or ''"
613                                     t-attf-class="fa fa-comment-o #{not question.can_comment and 'karma_required text-muted' or ''}"
614                                     t-attf-data-karma="#{not question.can_comment and question.karma_comment or 0}"
615                                     t-attf-data-target="#comment#{ question._name.replace('.','') + '-' + str(question.id) }">
616                                     Comment
617                                 </a>
618                             </li>
619                             <li t-if="question.state != 'close'">
620                                 <t t-call="website_forum.link_button">
621                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/ask_for_close'"/>
622                                     <t t-set="label" t-value="'Close'"/>
623                                     <t t-set="classes" t-value="'fa-times'"/>
624                                     <t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
625                                 </t>
626                             </li>
627                             <li t-if="question.state == 'close'">
628                                 <t t-call="website_forum.link_button">
629                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/reopen'"/>
630                                     <t t-set="label" t-value="'Reopen'"/>
631                                     <t t-set="classes" t-value="'fa-undo'"/>
632                                     <t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
633                                 </t>
634                             </li>
635                             <li>
636                                 <t t-call="website_forum.link_button">
637                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/post/' + slug(question) + '/edit'"/>
638                                     <t t-set="label" t-value="'Edit'"/>
639                                     <t t-set="classes" t-value="'fa-edit'"/>
640                                     <t t-set="karma" t-value="not question.can_edit and question.karma_edit or 0"/>
641                                 </t>
642                             </li>
643                             <li t-if="question.active">
644                                 <t t-call="website_forum.link_button">
645                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/delete'"/>
646                                     <t t-set="label" t-value="'Delete'"/>
647                                     <t t-set="classes" t-value="'fa-trash-o'"/>
648                                     <t t-set="karma" t-value="not question.can_unlink and question.karma_unlink or 0"/>
649                                 </t>
650                             </li>
651                             <li t-if="not question.active">
652                                 <t t-call="website_forum.link_button">
653                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/undelete'"/>
654                                     <t t-set="label" t-value="'Undelete'"/>
655                                     <t t-set="classes" t-value="'fa-trash-o'"/>
656                                     <t t-set="karma" t-value="not question.can_unlink and question.karma_unlink or 0"/>
657                                 </t>
658                             </li>
659                         </ul>
660                     </div>
661                     <div>
662                         <img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{question.create_uid.id}/avatar"/>
663                         <div>
664                             <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.create_uid.id }"
665                                 t-field="question.create_uid"
666                                 t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
667                                 style="display: inline-block;"/>
668                             <div t-field="question.create_uid" t-field-options='{"widget": "contact", "badges": true, "fields": ["karma"]}'/>
669                             <span class="text-muted">Asked on <span t-field="question.create_date" t-field-options='{"format":"short"}'/></span>
670                         </div>
671                     </div>
672                     <div class="visible-xs text-center">
673                         <t t-call="website_forum.vote">
674                             <t t-set="post" t-value="question"/>
675                         </t>
676                         <div class="text-muted text-center">
677                             <span t-field="question.views"/> Views
678                         </div>
679                         <div class="mt4">
680                             <a t-attf-data-href="/forum/#{slug(question.forum_id)}/question/#{slug(question)}/toggle_favourite"
681                                 t-attf-class="favourite_question no-decoration fa fa-2x fa-star #{question.user_favourite and 'forum_favourite_question' or ''}"/>
682                         </div>
683                     </div>
684                 </div>
685                 <t t-call="website_forum.post_comment">
686                     <t t-set="object" t-value="question"/>
687                 </t>
688             </div>
689         </div>
690         <hr/>
691         <div t-foreach="question.child_ids" t-as="post_answer" class="mt16 mb32">
692             <t t-call="website_forum.post_answers">
693                 <t t-set="answer" t-value="post_answer"/>
694             </t>
695         </div>
696         <div t-if="question.type != 'question' or question.type == 'question' and not question.uid_has_answered and question.state != 'close' and question.active != False">
697             <t t-call="website_forum.post_answer"/>
698         </div>
699         <div t-if="question.type == 'question' and question.uid_has_answered" class="mb16">
700             <a class="btn btn-primary" t-attf-href="/forum/#{slug(forum)}/question/#{slug(question)}/edit_answer">Edit Your Previous Answer</a>
701             <span class="text-muted">(only one answer per question is allowed)</span>
702         </div>
703     </t>
704 </template>
705
706 <template id="post_answers">
707     <a t-attf-id="answer-#{str(answer.id)}"/>
708     <div t-attf-class="forum_answer row" t-attf-id="answer_#{answer.id}" >
709         <div class="col-md-2 hidden-xs text-center">
710             <t t-call="website_forum.vote">
711                 <t t-set="post" t-value="answer"/>
712             </t>
713             <div t-if="question.type == 'question'" class="text-muted mt8">
714                 <a t-attf-class="accept_answer fa fa-2x fa-check-circle no-decoration #{answer.is_correct and 'oe_answer_true' or 'oe_answer_false'} #{not answer.can_accept and 'karma_required' or ''}"
715                     t-attf-data-karma="#{answer.karma_accept}"
716                     t-attf-data-href="/forum/#{slug(question.forum_id)}/post/#{slug(answer)}/toggle_correct"/>
717             </div>
718         </div>
719         <div class="col-md-10 clearfix">
720             <t t-raw="answer.content"/>
721             <div class="mt16">
722                 <ul class="list-inline pull-right">
723                     <li t-if="question.type == 'question'">
724                         <a t-attf-class="fa fa-comment-o #{not answer.can_comment and 'karma_required text-muted' or ''}"
725                             t-attf-data-karma="#{not answer.can_comment and answer.karma_comment or 0}"
726                             style="cursor: pointer" t-att-data-toggle="answer.can_comment and 'collapse' or ''"
727                             t-attf-data-target="#comment#{ answer._name.replace('.','') + '-' + str(answer.id) }"> Comment
728                         </a>
729                     </li>
730                     <li t-if="question.type != 'question' and not answer.parent_id or answer.parent_id and not answer.parent_id.parent_id">
731                         <a t-attf-class="fa fa-comment-o #{not answer.can_comment and 'karma_required text-muted' or ''}"
732                             t-attf-data-karma="#{not answer.can_comment and answer.karma_comment or 0}"
733                             style="cursor: pointer" data-toggle="collapse"
734                             t-attf-data-target="#reply#{ answer._name.replace('.','') + '-' + str(answer.id) }"> Reply
735                         </a>
736                     </li>
737                     <li>
738                         <t t-call="website_forum.link_button">
739                             <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/edit'"/>
740                             <t t-set="label" t-value="'Edit'"/>
741                             <t t-set="classes" t-value="'fa fa-edit'"/>
742                             <t t-set="karma" t-value="not answer.can_edit and answer.karma_edit or 0"/>
743                         </t>
744                     </li>
745                     <li>
746                         <t t-call="website_forum.link_button">
747                             <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/delete'"/>
748                             <t t-set="label" t-value="'Delete'"/>
749                             <t t-set="classes" t-value="'fa-trash-o'"/>
750                             <t t-set="karma" t-value="not answer.can_unlink and answer.karma_unlink or 0"/>
751                         </t>
752                     </li>
753                     <li t-if="question.type == 'question'">
754                         <t t-call="website_forum.link_button">
755                             <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/convert_to_comment'"/>
756                             <t t-set="label" t-value="'Convert as a comment'"/>
757                             <t t-set="classes" t-value="'fa-magic'"/>
758                             <t t-set="karma" t-value="not answer.can_comment_convert and answer.karma_comment_convert or 0"/>
759                         </t>
760                     </li>
761                 </ul>
762                 <img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{answer.create_uid.id}/avatar"/>
763                 <div>
764                     <a t-attf-href="/forum/#{ slug(forum) }/user/#{ answer.create_uid.id }"
765                         t-field="answer.create_uid"
766                         t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
767                         style="display: inline-block;"/>
768                     <div t-field="answer.create_uid" t-field-options='{"widget": "contact", "badges": true, "fields": ["karma"]}'/>
769                     <span class="text-muted">Answered on <span t-field="answer.create_date" t-field-options='{"format":"short"}'/></span>
770                 </div>
771                 <div class="visible-xs text-center">
772                     <t t-call="website_forum.vote">
773                         <t t-set="post" t-value="answer"/>
774                     </t>
775                     <div class="text-muted mt8">
776                         <a t-attf-class="accept_answer fa fa-2x fa-check-circle no-decoration #{answer.is_correct and 'oe_answer_true' or 'oe_answer_false'} #{not answer.can_accept and 'karma_required' or ''}"
777                             t-attf-data-karma="#{answer.karma_accept}"
778                             t-attf-data-href="/forum/#{slug(question.forum_id)}/post/#{slug(answer)}/toggle_correct"/>
779                     </div>
780                 </div>
781             </div>
782             <t t-if="answer.type == 'question'" t-call="website_forum.post_comment">
783                 <t t-set="object" t-value="answer"/>
784             </t>
785             <div t-if="answer.type != 'question' and question.state != 'close' and question.active != False">
786                 <t t-call="website_forum.post_reply">
787                     <t t-set="object" t-value="answer"/>
788                 </t>
789             </div>
790             <div t-foreach="answer.child_ids" t-as="child_answer" class="mt16 mb16">
791                 <t t-call="website_forum.post_answers">
792                     <t t-set="answer" t-value="child_answer"/>
793                 </t>
794             </div>
795         </div>
796     </div>
797 </template>
798
799 <!-- Utility template: Post a Comment -->
800 <template id="post_comment">
801     <div class="row clearfix">
802         <div class="col-sm-10 col-sm-offset-2">
803             <div t-foreach="reversed(object.website_message_ids)" t-as="message" class="comment oe_comment_grey">
804                 <small class="text-muted">
805                     <t t-set="required_karma" t-value="message.author_id.id == user.partner_id.id and object.forum_id.karma_comment_unlink_own or object.forum_id.karma_comment_unlink_all"/>
806                     <t t-call="website_forum.link_button">
807                         <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/delete'"/>
808                         <t t-set="label" t-value="' '"/>
809                         <t t-set="karma" t-value="user.karma&lt;required_karma and required_karma or 0"/>
810                         <t t-set="classes" t-value="'close comment_delete fa-times'"/>
811                     </t>
812
813                     <span t-field="message.body"/>
814                     <t t-set="required_karma" t-value="message.author_id.id == user.partner_id.id and object.forum_id.karma_comment_convert_own or object.forum_id.karma_comment_convert_all"/>
815                     <t t-if="(object.parent_id and object.parent_id.state != 'close' and object.parent_id.active != False) or (not object.parent_id and object.state != 'close' and object.active != False)">
816                         <t t-set="allow_post_comment" t-value="True" />
817                     </t>
818                     <t t-if="allow_post_comment">
819                         <t t-call="website_forum.link_button" >
820                             <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/convert_to_answer'"/>
821                             <t t-set="label" t-value="'Convert as an answer'"/>
822                             <t t-set="karma" t-value="user.karma&lt;required_karma and required_karma or 0"/>
823                             <t t-set="classes" t-value="'fa-magic pull-right'"/>
824                         </t>
825                     </t>
826                     <a t-attf-href="/forum/#{slug(forum)}/partner/#{message.author_id.id}"
827                         t-field="message.author_id" t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
828                         style="display: inline-block;"/>
829                     on <span t-field="message.date" t-field-options='{"format":"short"}'/>
830                 </small>
831             </div>
832             <div class="css_editable_mode_hidden">
833                 <form t-attf-id="comment#{ object._name.replace('.','') + '-' + str(object.id) }" class="collapse oe_comment_grey"
834                         t-attf-action="/forum/#{slug(forum)}/post/#{slug(object)}/comment" method="POST">
835                     <input name="post_id" t-att-value="object.id" type="hidden" class="mt8"/>
836                     <textarea name="comment" class="form-control" placeholder="Comment this post..."/>
837                     <button type="submit" class="btn btn-primary mt8">Post</button>
838                 </form>
839             </div>
840         </div>
841     </div>
842 </template>
843
844 <template id="tag">
845     <t t-call="website_forum.header">
846         <h1 class="mt0">
847             Tags
848         </h1>
849         <p class="text-muted">
850             A tag is a label that categorizes your question with other,
851             similar questions. Using the right tags makes it easier for
852             others to find and answer your question.
853         </p>
854         <div class="row">
855             <div class="col-sm-3 mt16" t-foreach="tags" t-as="tag">
856                 <a t-attf-href="/forum/#{ slug(forum) }/tag/#{ slug(tag) }/questions?{{ keep_query( filters='tag') }}" class="label label-default">
857                     <span t-field="tag.name"/>
858                 </a>
859                 <span>
860                     X <t t-esc="tag.posts_count"/>
861                 </span>
862             </div>
863         </div>
864     </t>
865 </template>
866
867 <template id="badge">
868     <t t-call="website_forum.header">
869         <h1 class="mt0">
870             Badges
871         </h1>
872         <p>
873             Besides gaining reputation with your questions and answers,
874             you receive badges for being especially helpful. Badges
875             appear on your profile page, and your posts.
876         </p>
877         <table class="table mt32 mb64">
878             <tr t-foreach="badges" t-as="badge">
879                 <td>
880                     <a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge) }" class="badge pull-left">
881                         <span t-if="badge.level == 'gold'" class="fa fa-circle badge-gold"/>
882                         <span t-if="badge.level == 'silver'" class="fa fa-circle badge-silver"/>
883                         <span t-if="badge.level == 'bronze'" class="fa fa-circle badge-bronze"/>
884                         <span t-field="badge.name"/>
885                     </a>
886                 </td><td>
887                     <b t-esc="badge.stat_count_distinct"/>
888                     <i class="text-muted">awarded users</i>
889                 </td><td>
890                     <span t-field="badge.description"/>
891                 </td>
892             </tr>
893         </table>
894     </t>
895 </template>
896
897 <template id="badge_user">
898     <t t-call="website_forum.header">
899         <h3 class="mt32 mb32">
900             <b>Badge "<span t-field="badge.name"/>"</b>
901         </h3>
902         <div>
903             <div class="pull-left badge">
904                 <span t-if="badge.level == 'gold'" class="fa fa-circle badge-gold"/>
905                 <span t-if="badge.level == 'silver'" class="fa fa-circle badge-silver"/>
906                 <span t-if="badge.level == 'bronze'" class="fa fa-circle badge-bronze"/>
907                 <span t-field="badge.name"/>
908             </div>
909             <span t-field="badge.description" style="margin-left:20px"/>
910         </div>
911         <h4 class="mt32">
912             <t class="pull-left" t-esc="badge.stat_count_distinct"/>
913             <span t-if="badge.stat_count_distinct&gt;1">users</span>
914             <span t-if="badge.stat_count_distinct&lt;=1">user</span>
915             received this badge:
916         </h4>
917         <div class="row">
918             <div class="col-sm-3 mt16" t-foreach="users" t-as="user">
919                 <img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{user.id}/avatar"/>
920                 <div>
921                     <a t-attf-href="/forum/#{slug(forum)}/user/#{user.id}" t-field="user.name"/>
922                 </div>
923             </div>
924         </div>
925     </t>
926 </template>
927
928 <template id="users">
929     <t t-call="website_forum.header">
930         <div t-foreach="users" t-as="row_users" class="row mt16">
931             <div t-foreach="row_users" t-as="user" class="col-sm-4">
932                 <img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{user.id}/avatar"/>
933                 <div>
934                     <a t-attf-href="/forum/#{slug(forum)}/user/#{user.id}" t-field="user.name"/>
935                     <t t-if="user.country_id">
936                         <span t-field="user.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}'/>
937                     </t>
938                     <b><t t-esc="user.karma"/></b>
939                     <t t-raw="separator"/>
940                     <div>
941                         <b> badges:</b>
942                         <span class="fa fa-circle badge-gold"/>
943                         <t t-esc="user.gold_badge"/>
944                         <span class="fa fa-circle badge-silver"/>
945                         <t t-esc="user.silver_badge"/>
946                         <span class="fa fa-circle badge-bronze"/>
947                         <t t-esc="user.bronze_badge"/>
948                     </div>
949                     <t t-raw="0"/>
950                 </div>
951             </div>
952         </div>
953         <div class="pull-left">
954             <t t-call="website.pager"/>
955         </div>
956     </t>
957 </template>
958
959 <!--Private profile-->
960 <template id="private_profile">
961     <t t-call="website_forum.header">
962         <h1 class="mt32">This profile is private!</h1>
963         <p>
964             <a t-attf-href="/forum/#{slug(forum)}">Return to the question list.</a>
965         </p>
966     </t>
967 </template>
968
969 <template id="edit_profile">
970     <t t-call="website_forum.header">
971         <h3>Edit Profile</h3>
972         <div class="row">
973             <div class="col-md-2">
974                 <img class="img img-responsive img-circle" t-attf-src="/forum/user/#{user.id}/avatar"/>
975             </div>
976             <div class="col-md-10">
977             <form t-attf-action="/forum/#{slug(forum)}/user/#{slug(user)}/save" method="post" role="form" class="form-horizontal">
978                 <input name="user_id" t-att-value="user.id" type="hidden"/>
979                 <div class="form-group">
980                     <label class="col-md-2 control-label mb16" for="user_name">Real name</label>
981                     <div class="col-md-8 mb16">
982                         <input type="text" class="form-control" name="name" id="user_name" required="True" t-attf-value="#{user.name}"/>
983                     </div>
984                 </div>
985                 <div class="form-group">
986                     <label class="col-md-2 control-label mb16" for="user_website_published" t-if="user.id == uid">Public profile</label>
987                     <div class="col-md-8 mb16" t-if="user.id == uid">
988                         <input type="checkbox" class="mt8" name="website_published" id="user_website_published" value="True" t-if="not user.website_published"/>
989                         <input type="checkbox" class="mt8" name="website_published" id="user_website_published" value="True" checked="checked" t-if="user.website_published"/>
990                     </div>
991                 </div>
992                 <div class="form-group">
993                     <label class="col-md-2 control-label mb16" for="user_website">Website</label>
994                     <div class="col-md-8 mb16">
995                         <input type="text" class="form-control" name="website" id="user_website" t-attf-value="#{user.partner_id.website or ''}"/>
996                     </div>
997                 </div>
998                 <div class="form-group">
999                     <div t-if="email_required" class="alert alert-danger alert-dismissable oe_forum_email_required">
1000                         <button type="button" class="close" data-dismiss="alert">x</button>
1001                         <p>Please enter a valid email address in order to receive notifications from answers or comments.</p>
1002                     </div>
1003                     <label class="col-md-2 control-label mb16" for="user_email">Email</label>
1004                     <div class="col-md-8 mb16">
1005                         <input type="text" class="form-control" name="email" id="user_email" required="True" t-attf-value="#{user.partner_id.email}"/>
1006                     </div>
1007                 </div>
1008                 <div class="form-group">
1009                     <label class="col-md-2 control-label mb16" for="user_city">City</label>
1010                     <div class="col-md-8 mb16">
1011                         <input type="text" class="form-control" name="city" id="user_city" t-attf-value="#{user.partner_id.city or ''}"/>
1012                     </div>
1013                 </div>
1014                 <div class="form-group">
1015                     <label class="col-md-2 control-label mb16">Country</label>
1016                     <div class="col-md-8 mb16">
1017                         <select class="form-control" name="country">
1018                             <option value="">Country...</option>
1019                             <t t-foreach="countries or []" t-as="country">
1020                                 <option t-att-value="country.id" t-att-selected="country.id == user.partner_id.country_id.id"><t t-esc="country.name"/></option>
1021                             </t>
1022                          </select>
1023                     </div>
1024                 </div>
1025                 <!--Note: using website_description fiels instead of using commnt firld of partner-->
1026                 <div class="form-group">
1027                     <label class="col-md-2 control-label mb16" for="description">Biography</label>
1028                     <div class="col-md-8 mb16">
1029                         <textarea name="description" id="description" style="min-height: 120px" required="True" 
1030                             class="form-control load_editor"><t t-esc="user.partner_id.website_description"/></textarea>
1031                     </div>
1032                 </div>
1033                 <div class="col-sm-offset-2 col-md-2 mb16">
1034                     <button class="btn btn-primary btn-lg">Update</button>
1035                 </div>
1036             </form>
1037             </div>
1038         </div>
1039         <script type="text/javascript">
1040             CKEDITOR.replace("description");
1041         </script>
1042     </t>
1043 </template>
1044
1045 <template id="user_detail_full">
1046     <t t-call="website_forum.header">
1047         <h1 class="mt0 page-header">
1048             <span t-field="user.name"/>
1049             <small>profile</small>
1050             <t t-call="website.publish_management" groups="base.group_website_publisher">
1051                 <t t-set="object" t-value="user"/>
1052             </t>
1053         </h1>
1054         <div class="row">
1055             <div class="col-sm-2">
1056                 <img class="img img-responsive img-circle" t-attf-src="/forum/user/#{user.id}/avatar"/>
1057             </div>
1058             <div class="col-sm-10">
1059                 <table class="table table-condensed">
1060                 <tr>
1061                     <td rowspan="2" valign="top"><span class="text-muted">contributions</span></td>
1062                     <td>member since</td>
1063                     <td><span t-field="user.create_date" t-field-options='{"format": "short"}'/></td>
1064                 </tr><tr>
1065                     <td>last connection</td>
1066                     <td><span t-field="user.login_date" t-field-options='{"format": "short"}'/></td>
1067                 </tr>
1068                 <tr>
1069                     <td rowspan="2" valign="top"><span class="text-muted">bio</span></td>
1070                     <td>website</td>
1071                     <td>
1072                         <a t-att-href="user.website" t-if="user.website">
1073                             <span t-field="user.website"/>
1074                         </a>
1075                     </td>
1076                 </tr><tr>
1077                     <td>location</td>
1078                     <td>
1079                         <span t-field="user.city"/>
1080                         <span t-if="user.city and user.country_id">, </span>
1081                         <span t-field="user.country_id"/>
1082                         <t t-if="user.country_id"> <span t-field="user.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}'/></t>
1083
1084                     </td>
1085                 </tr>
1086                 <tr>
1087                     <td rowspan="2" valign="top"><span class="text-muted">stats</span></td>
1088                     <td>karma</td>
1089                     <td><span t-field="user.karma"/></td>
1090                 </tr><tr>
1091                     <td>votes</td>
1092                     <td>
1093                         <span class="fa fa-thumbs-up"/>
1094                         <span t-esc="up_votes"/>
1095                         <span class="fa fa-thumbs-down"/>
1096                         <span t-esc="down_votes"/>
1097                     </td>
1098                 </tr>
1099                 </table>
1100                 <div class="well well-sm">
1101                     <span t-field="user.partner_id.website_description" class="oe_no_empty"/>
1102                     <t t-if="uid == user.id">
1103                         <a class="fa fa-arrow-right" t-attf-href="/forum/#{slug(forum)}/user/#{slug(user)}/edit"> Edit Your Bio</a>
1104                     </t>
1105                 </div>
1106             </div>
1107         </div>
1108
1109         <ul class="nav nav-tabs">
1110             <li class="active">
1111                 <a href="#questions" data-toggle="tab"><t t-esc="count_questions"/> Questions</a>
1112             </li>
1113             <li>
1114                 <a href="#answers" data-toggle="tab"><t t-esc="count_answers"/> Answers</a>
1115             </li>
1116             <li t-if="uid == user.id">
1117                 <a href="#favourite_question" data-toggle="tab"><t t-esc="len(favourite)"/> Favourite Questions</a>
1118             </li>
1119             <li t-if="uid == user.id">
1120                 <a href="#followed_question" data-toggle="tab"><t t-esc="len(followed)"/> Followed Questions</a>
1121             </li>
1122             <li t-if="uid == user.id">
1123                 <a href="#activity" data-toggle="tab">Activity</a>
1124             </li>
1125             <li>
1126                 <a href="#badges" data-toggle="tab">Badges</a>
1127             </li>
1128             <li t-if="uid == user.id">
1129                 <a href="#votes" data-toggle="tab">Votes</a>
1130             </li>
1131         </ul>
1132         <div class="tab-content mt16">
1133             <div class="tab-pane active" id="questions">
1134                 <div class="mb16" t-foreach="questions" t-as="question">
1135                     <t t-call="website_forum.display_post"/>
1136                 </div>
1137             </div><div class="tab-pane" id="answers">
1138                 <div t-foreach="answers" t-as="answer">
1139                     <t t-call="website_forum.display_post_answer"/>
1140                 </div>
1141             </div>
1142             <div class="tab-pane" id="karma">
1143                 <h1>Karma</h1>
1144             </div>
1145             <div class="tab-pane" id="badges">
1146                 <t t-call="website_forum.user_badges"/>
1147             </div>
1148             <div class="tab-pane" id="favourite_question" t-if="uid == user.id">
1149                 <div t-foreach="favourite" t-as="question">
1150                     <t t-call="website_forum.display_post"/>
1151                 </div>
1152             </div>
1153             <div class="tab-pane" id="followed_question" t-if="uid == user.id">
1154                 <div t-foreach="followed" t-as="question" class="mb16">
1155                     <t t-call="website_forum.display_post"/>
1156                 </div>
1157             </div>
1158             <div class="tab-pane" id="votes" t-if="uid == user.id">
1159                 <t t-call="website_forum.user_votes"/>
1160             </div>
1161             <div class="tab-pane" id="activity" t-if="uid == user.id">
1162                 <ul class="list-unstyled">
1163                     <li t-foreach="activities" t-as="activity">
1164                         <span t-field="activity.date" t-field-options='{"format": "short"}'/>
1165                         <span t-esc="activity.subtype_id.name" class="label label-info"/>
1166                         <t t-set="post" t-value="posts[activity.res_id]"/>
1167                         <span t-if="post[1]">
1168                             <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }#answer-#{ str(post[1].id) }">
1169                                 <span t-esc="post[0].name"/>
1170                             </a>
1171                         </span>
1172                         <span t-if="not post[1]">
1173                             <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }">
1174                                 <span t-esc="post[0].name"/>
1175                             </a>
1176                         </span>
1177                     </li>
1178                 </ul>
1179             </div>
1180         </div>
1181     </t>
1182 </template>
1183
1184 <template id="user_badges">
1185     <table class="table mt32 mb64">
1186         <tr t-foreach="user.badge_ids" t-as="badge">
1187             <td>
1188                 <a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge.badge_id) }" class="badge pull-left">
1189                     <span t-if="badge.badge_id.level == 'gold'" class="fa fa-circle badge-gold"/>
1190                     <span t-if="badge.badge_id.level == 'silver'" class="fa fa-circle badge-silver"/>
1191                     <span t-if="badge.badge_id.level == 'bronze'" class="fa fa-circle badge-bronze"/>
1192                     <span t-field="badge.badge_id.name"/>
1193                 </a>
1194             </td><td>
1195                 <b t-esc="badge.badge_id.stat_count_distinct"/>
1196                 <i class="text-muted">awarded users</i>
1197             </td><td>
1198                 <span t-field="badge.badge_id.description"/>
1199             </td>
1200         </tr>
1201     </table>
1202     <div class="mb16" t-if="not user.badge_ids">
1203         <b>No badge yet!</b><br/>
1204         <a t-attf-href="/forum/#{ slug(forum) }/badge" class="fa fa-arrow-right"> Check available badges</a>
1205     </div>
1206 </template>
1207
1208 <template id="user_votes">
1209     <div t-foreach="vote_post" t-as="vote">
1210         <t t-esc="vote.post_id.create_date"/>
1211         <span t-if="vote.vote == '1'" class="fa fa-thumbs-up text-success" style="margin-left:30px"/>
1212         <span t-if="vote.vote == '-1'" class="fa fa-thumbs-down text-warning" style="margin-left:30px"/>
1213         <t t-if="vote.post_id.parent_id">
1214             <a t-attf-href="/forum/#{ slug(forum) }/question/#{ vote.post_id.parent_id.id }/#answer-#{ vote.post_id.id }" t-esc="vote.post_id.parent_id.name" style="margin-left:10px"/>
1215         </t>
1216         <t t-if="not vote.post_id.parent_id">
1217             <a t-attf-href="/forum/#{ slug(forum) }/question/#{ vote.post_id.id }" style=" color:black;margin-left:10px" t-esc="vote.post_id.name"/>
1218         </t>
1219     </div>
1220     <div class="mb16" t-if="not vote_post">
1221         <b>No vote given by you yet!</b>
1222     </div>
1223 </template>
1224
1225 <!-- User Navbar -->
1226 <template id="content_new_forum" inherit_id="website.user_navbar" groups="base.group_user">
1227     <xpath expr="//ul[@id='oe_systray']/li/ul[@class='dropdown-menu oe_content_menu']" position="inside">
1228         <li><a href="#" data-action="new_forum">New Forum</a></li>
1229     </xpath>
1230 </template>
1231
1232     </data>
1233 </openerp>