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